Zend\Stratigility\MiddlewarePipe::getReflectionFunction PHP Method

getReflectionFunction() private method

private getReflectionFunction ( callable $middleware ) : ReflectionFunctionAbstract
$middleware callable
return ReflectionFunctionAbstract
    private function getReflectionFunction(callable $middleware)
    {
        if (is_array($middleware)) {
            $class = array_shift($middleware);
            $method = array_shift($middleware);
            return new ReflectionMethod($class, $method);
        }
        if ($middleware instanceof Closure || !is_object($middleware)) {
            return new ReflectionFunction($middleware);
        }
        return new ReflectionMethod($middleware, '__invoke');
    }