Habari\CronJob::__set PHP Method

__set() public method

Serializes the callback if needed.
See also: QueryRecord::__set()
public __set ( string $name, mixed $value ) : mixed
$name string The name of the property to set.
$value mixed The value of the property to set.
return mixed The new value of the property.
    public function __set($name, $value)
    {
        switch ($name) {
            case 'callback':
                if (is_array($value) || is_object($value)) {
                    $value = serialize($value);
                }
                break;
            case 'next_run':
            case 'last_run':
            case 'start_time':
            case 'end_time':
                if (!$value instanceof DateTime && !is_null($value)) {
                    $value = DateTime::create($value);
                }
                break;
        }
        return parent::__set($name, $value);
    }