ExpressiveDate::__call PHP Method

__call() public method

Dynamically handle calls for date attributes and testers.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed
    public function __call($method, $parameters)
    {
        if (substr($method, 0, 3) == 'get' or substr($method, 0, 3) == 'set') {
            $attribute = substr($method, 3);
        } elseif (substr($method, 0, 2) == 'is') {
            $attribute = substr($method, 2);
            return $this->isDateAttribute($attribute);
        }
        if (!isset($attribute)) {
            throw new InvalidArgumentException('Could not dynamically handle method call [' . $method . ']');
        }
        if (substr($method, 0, 3) == 'set') {
            return $this->setDateAttribute($attribute, $parameters[0]);
        }
        // If not setting an attribute then we'll default to getting an attribute.
        return $this->getDateAttribute($attribute);
    }