Pinq\Parsing\FunctionLocation::fromReflection PHP Method

fromReflection() public static method

Creates a function location instance from the supplied reflection.
public static fromReflection ( ReflectionFunctionAbstract $reflection ) : self
$reflection ReflectionFunctionAbstract
return self
    public static function fromReflection(\ReflectionFunctionAbstract $reflection)
    {
        if ($reflection instanceof \ReflectionFunction) {
            $namespace = $reflection->getNamespaceName();
        } elseif ($reflection instanceof \ReflectionMethod) {
            $namespace = $reflection->getDeclaringClass()->getNamespaceName();
        } else {
            $namespace = null;
        }
        return new self($reflection->getFileName(), $namespace, $reflection->getStartLine(), $reflection->getEndLine());
    }