WordPress\ORM\BaseModel::__call PHP Méthode

__call() public méthode

Magically handle getters and setters.
public __call ( string $function, array $arguments ) : mixed
$function string
$arguments array
Résultat mixed
    public function __call($function, $arguments)
    {
        // Getters following the pattern 'get_{$property}'
        if (substr($function, 0, 4) == 'get_') {
            $model_props = $this->properties();
            $property = substr($function, 4);
            if (array_key_exists($property, $model_props)) {
                return $this->{$property};
            }
        }
        // Setters following the pattern 'set_{$property}'
        if (substr($function, 0, 4) == 'set_') {
            $model_props = $this->properties();
            $property = substr($function, 4);
            if (array_key_exists($property, $model_props)) {
                $this->{$property} = $arguments[0];
            }
        }
    }