Habari\Post::__set PHP Method

__set() public method

Overrides QueryRecord __set to implement custom object properties
public __set ( string $name, mixed $value ) : mixed
$name string Name of property to return
$value mixed Value to set
return mixed The requested field value
    public function __set($name, $value)
    {
        switch ($name) {
            case 'pubdate':
            case 'updated':
            case 'modified':
                if (!$value instanceof DateTime) {
                    $value = DateTime::create($value);
                }
                break;
            case 'tags':
                if ($value instanceof Terms) {
                    return $this->tags_object = $value;
                } elseif (is_array($value)) {
                    return $this->tags_object = new Terms($value);
                } else {
                    return $this->tags_object = Terms::parse($value, '\\Habari\\Term', Tags::vocabulary());
                }
            case 'status':
                return $this->setstatus($value);
        }
        return parent::__set($name, $value);
    }