gossi\codegen\parser\visitor\parts\ValueParserPart::getExpression PHP Méthode

getExpression() private méthode

Returns the value from a node
private getExpression ( PhpParser\Node $node ) : mixed
$node PhpParser\Node
Résultat mixed
    private function getExpression(Node $node)
    {
        if ($node instanceof ConstFetch) {
            $const = $node->name->parts[0];
            if (isset($this->constMap[$const])) {
                return $this->constMap[$const];
            }
            return $const;
        }
        if ($node instanceof ClassConstFetch) {
            return $node->class->parts[0] . '::' . $node->name;
        }
        if ($node instanceof MagicConst) {
            return $node->getName();
        }
        if ($node instanceof Array_) {
            $prettyPrinter = new PrettyPrinter();
            return $prettyPrinter->prettyPrintExpr($node);
        }
    }