Zend\Expressive\Application::__call PHP Method

__call() public method

public __call ( string $method, array $args ) : Zend\Expressive\Router\Route
$method string
$args array
return Zend\Expressive\Router\Route
    public function __call($method, $args)
    {
        if (!in_array(strtoupper($method), $this->httpRouteMethods, true)) {
            throw new Exception\BadMethodCallException('Unsupported method');
        }
        switch (count($args)) {
            case 2:
                // We have path and middleware; append the HTTP method.
                $args[] = [$method];
                break;
            case 3:
                // Need to reflow arguments to (0 => path, 1 => middleware, 2 => methods, 3 => name)
                // from (0 => path, 1 => middleware, 2 => name)
                $args[3] = $args[2];
                // place name in $args[3]
                $args[2] = [$method];
                // method becomes $args[2]
                break;
            default:
                throw new Exception\BadMethodCallException(sprintf('%s::%s requires at least 2 arguments, and no more than 3; received %d', __CLASS__, $method, count($args)));
        }
        // @TODO: we can use variadic parameters when dependency is raised to PHP 5.6
        return call_user_func_array([$this, 'route'], $args);
    }