HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/bomacon/bomacon.nl/app/Components/ComponentType/SaveState/HasSaveStateTrait.php
<?php

namespace App\Components\ComponentType\SaveState;

trait HasSaveStateTrait
{
    /** @var SaveStateInterface */
    private $saveStateInstance;

    /**
     * Mutator for the saveStateInstance model attribute
     *
     * @param $value
     */
    public function setSaveStateInstanceAttribute($value)
    {
        if(! is_a($value, SaveStateInterface::class)) throw new \InvalidArgumentException('The attribute instance must be a subclass of "'.SaveStateInterface::class.'"');
        $this->saveStateInstance = $value;
        $this->attributes['save_state'] = serialize($this->save_state_instance);
    }

    /**
     * Accessor for the saveStateInstance model attribute
     */
    public function getSaveStateInstanceAttribute()
    {
        return $this->saveStateInstance;
    }
}