extensions/felixfbecker.php-intellisense-0.0.12/vendor/felixfbecker/language-server/src/Protocol/SymbolInformation.php
/**
     * Converts a Node to a SymbolInformation
     *
     * @param Node $node
     * @param string $fqn If given, $containerName will be extracted from it
     * @return self
     */
Converts a Node to a SymbolInformation
@param Node $node
@param string $fqn If given, $containerName will be extracted from it
@return self
Converts a Node to a SymbolInformation @param Node $node @param string $fqn If given $containerName will be extracted from it @return self
public static function fromNode(Node $node, string $fqn = null)
    {
        $nodeSymbolKindMap = [
            Node\Stmt\Class_::class           => SymbolKind::CLASS_,
            Node\Stmt\Trait_::class           => SymbolKind::CLASS_,
            Node\Stmt\Interface_::class       => SymbolKind::INTERFACE,
            Node\Stmt\Namespace_::class       => SymbolKind::NAMESPACE,
            Node\Stmt\Function_::class        => SymbolKind::FUNCTION,
            Node\Stmt\ClassMethod::class      => SymbolKind::METHOD,
            Node\Stmt\PropertyProperty::class => SymbolKind::PROPERTY,
            Node\Const_::class                => SymbolKind::CONSTANT
        ];
        $class = get_class($node);
        if (!isset($nodeSymbolKindMap[$class])) {
            throw new Exception("Not a declaration node: $class");
        }
        $symbol = new self;
        $symbol->kind = $nodeSymbolKindMap[$class];
        $symbol->name = (string)$node->name;
        $symbol->location = Location::fromNode($node);
        if ($fqn !== null) {
            $parts = preg_split('/(::|\\\\)/', $fqn);
            array_pop($parts);
            $symbol->containerName = implode('\\', $parts);
        }
        return $symbol;
    }
public static function fromNode ( Node $ node , string $ fqn = null ) { $ nodeSymbolKindMap = [ Node \ Stmt \ Class_ :: class => SymbolKind :: CLASS_ , Node \ Stmt \ Trait_ :: class => SymbolKind :: CLASS_ , Node \ Stmt \ Interface_ :: class => SymbolKind :: INTERFACE , Node \ Stmt \ Namespace_ :: class => SymbolKind :: NAMESPACE , Node \ Stmt \ Function_ :: class => SymbolKind :: FUNCTION , Node \ Stmt \ ClassMethod :: class => SymbolKind :: METHOD , Node \ Stmt \ PropertyProperty :: class => SymbolKind :: PROPERTY , Node \ Const_ :: class => SymbolKind :: CONSTANT ] ; $ class = get_class ( $ node ) ; if ( ! isset ( $ nodeSymbolKindMap [ $ class ] ) ) { throw new Exception ( " Not a declaration node:  $ class " ) ; } $ symbol = new self ; $ symbol -> kind = $ nodeSymbolKindMap [ $ class ] ; $ symbol -> name = ( string ) $ node -> name ; $ symbol -> location = Location :: fromNode ( $ node ) ; if ( $ fqn !== null ) { $ parts = preg_split ( '/(::|\\\\)/' , $ fqn ) ; array_pop ( $ parts ) ; $ symbol -> containerName = implode ( '\\' , $ parts ) ; } return $ symbol ; }
Converts a Node to a SymbolInformation
 @param Node $node
 @param string $fqn If given, $containerName will be extracted from it
 @return self
Converts a Node to a SymbolInformation @param Node $node @param string $fqn If given $containerName will be extracted from it @return self