Pinq\Parsing\FunctionScope::fromReflection PHP Метод

fromReflection() публичный статический Метод

Creates a function scope instance from the supplied reflection and callable.
public static fromReflection ( ReflectionFunctionAbstract $reflection, callable $callable ) : self
$reflection ReflectionFunctionAbstract
$callable callable
Результат self
    public static function fromReflection(\ReflectionFunctionAbstract $reflection, callable $callable)
    {
        if (is_array($callable)) {
            /** @var $reflection \ReflectionMethod */
            $thisObject = is_object($callable[0]) ? $callable[0] : null;
            $scopeType = $reflection->getDeclaringClass()->getName();
        } elseif (is_object($callable) && !$callable instanceof \Closure) {
            /** @var $reflection \ReflectionMethod */
            $thisObject = $callable;
            $scopeType = $reflection->getDeclaringClass()->getName();
        } elseif ($reflection->isClosure()) {
            $thisObject = $reflection->getClosureThis();
            $scopeClass = $reflection->getClosureScopeClass();
            $scopeType = $scopeClass === null ? null : $scopeClass->getName();
        } else {
            $thisObject = null;
            $scopeType = null;
        }
        $variableTable = $reflection->getStaticVariables();
        return new self($thisObject, $scopeType, $variableTable);
    }