Dotink\Parody\Mime::__call PHP Метод

__call() публичный Метод

Handle missing calls which, in short, means we should be looking for an extension.
public __call ( string $method, array $args ) : Mime
$method string The method we tried to call
$args array The arguments we passed to it
Результат Mime The mime for method chaining
    public function __call($method, $args)
    {
        if ($method == 'create') {
            return new self(self::create($this->class));
        }
        if (!isset(self::$extensions[$method])) {
            throw new \Exception(sprintf('Unknown extension %s', $method));
        }
        if (!self::$extensions[$method] instanceof \Closure) {
            throw new \Exception(sprintf('Extension %s must be an instance of Closure', $method));
        }
        $extension = self::$extensions[$method];
        foreach (call_user_func_array($extension, $args) as $property => $value) {
            $this->quip->extended[$property] = $value;
        }
        return $this;
    }