Dotink\Parody\Quip::__call PHP Method

__call() public method

This method will look for the value assigned via Mime::onCall which whose expectations match the arguments provided. If the value is a Closure the return value of the closure will be returned, but the Quip's mime will be passed as the first and only argument so that future behavior can be modified based on the call.
public __call ( string $method, array $args ) : mixed
$method string The method we are trying to call
$args array The arguments that were passed to the method
return mixed The value as mimicked by the call
    public function __call($method, $args)
    {
        if (isset($this->methods[$method])) {
            foreach ($this->methods[$method] as $quip) {
                if ($args == $quip['expectation']) {
                    return $quip['value'] instanceof \Closure ? $quip['value']($this->mime) : $quip['value'];
                }
            }
            throw new \Exception(sprintf('The method %s was never mimicked with the provided expectations: %s', $method, print_r($args, TRUE)));
        } else {
            throw new \Exception(sprintf('The method %s was never mimicked', $method));
        }
    }