Returns the visibility from a node

@param Node $node
@return string
340744
private function getVisibility(Node $node) {
		if ($node->isPrivate()) {
			return AbstractPhpMember::VISIBILITY_PRIVATE;
		}

		if ($node->isProtected()) {
			return AbstractPhpMember::VISIBILITY_PROTECTED;
		}

		return AbstractPhpMember::VISIBILITY_PUBLIC;
	}
1127356
protected function getRouteConfig($node)
    {
        if ((!$node instanceof SimpleXmlElement) || !$node->route) {
            return false;
        }

        $config = array();

        foreach ($node->route as $route) {
            $type = (string)$route['type'];
            $name = (string)$route['name'];
            if (!$name) {
                continue;
            }

            $routeConfig = $this->getRouteConfigOptions($route, $type);
            if (!is_array($routeConfig)) {
                return null;
            }

            $config[$name] = $routeConfig;
            if (isset($route['mayterminate'])) {
                $config[$name]['may_terminate'] = $route->is('mayterminate');
            }

            $children = $this->getRouteConfig($route->routes);
            if (!empty($children)) {
                $config[$name]['child_routes'] = $children;
            }
        }

        return $config;
    }
1300824
public function getNodeAttributes(Node $node)
    {
        // Extract the properties of the node
        $attributes = $node->getProperties();

        // Add the node id to the attributes since \Everyman\Neo4j\Node
        // does not consider it to be a property, it is treated differently
        // and available through the getId() method.
        $attributes['id'] = $node->getId();

        return $attributes;
    }
560965
public function getOtherNode(Node $node)
    {
        if ($node === $this->getStartNode()) {
            return $this->getEndNode();
        }

        return $this->getStartNode();
    }
1344824
public function getDocumentationFromNode($node)
    {
        // Any NamespaceDefinition comments likely apply to the file, not the declaration itself.
        if ($node instanceof Node\Statement\NamespaceDefinition) {
            return null;
        }

        // For properties and constants, set the node to the declaration node, rather than the individual property.
        // This is because they get defined as part of a list.
        $constOrPropertyDeclaration = ParserHelpers\tryGetPropertyDeclaration($node) ?? ParserHelpers\tryGetConstOrClassConstDeclaration($node);
        if ($constOrPropertyDeclaration !== null) {
            $node = $constOrPropertyDeclaration;
        }

        // For parameters, parse the function-like declaration to get documentation for a parameter
        if ($node instanceof Node\Parameter) {
            $variableName = $node->getName();

            $functionLikeDeclaration = ParserHelpers\getFunctionLikeDeclarationFromParameter($node);
            $docBlock = $this->getDocBlock($functionLikeDeclaration);

            $parameterDocBlockTag = $this->tryGetDocBlockTagForParameter($docBlock, $variableName);
            return $parameterDocBlockTag !== null ? $parameterDocBlockTag->getDescription()->render() : null;
        }

        // For everything else, get the doc block summary corresponding to the current node.
        $docBlock = $this->getDocBlock($node);
        if ($docBlock !== null) {
            // check whether we have a description, when true, add a new paragraph
            // with the description
            $description = $docBlock->getDescription()->render();

            if (empty($description)) {
                return $docBlock->getSummary();
            }

            return $docBlock->getSummary() . "\n\n" . $description;
        }
        return null;
    }
782606
public function getParent(Node $node)
    {
        $this->init();
        if ($node->getParent() && array_key_exists(
                $node->getParent()->getId(),
                $this->allNodes
            )
        ) {
            return $this->allNodes[$node->getParent()->getId()];
        }

        return false;
    }
308375
private function resolveNamespace(Node $node)
    {
        try {
            return $this->namespaceFromNode($node);
        } catch (Exception $e) {
        }

        foreach ($node->getDescendantNodes() as $node) {
            try {
                return $this->namespaceFromNode($node);
            } catch (Exception $e) {
            }
        }

        return '';
    }
124951
public function getFlattenChildren(Node $node)
    {
        $flatten = array();
        foreach ($node->getNodes() as $subNode) {
            if (count($subNode->getNodes()) > 1 || isset($subNode->getTrace()['query_source']) || !empty($subNode->getValues())) {
                $flatten[] = $subNode;
            } else {
                $flatten = array_merge($flatten, $this->getFlattenChildren($subNode));
            }
        }

        return $flatten;
    }
1238775
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);
		}
	}
1300187
protected function getDeprecatedDocComment(Node $node)
    {
        try {
            $docBlock = new DocBlock((string) $node->getDocComment());
            /** @var DocBlock\Tag\DeprecatedTag[] $deprecatedTag */
            $deprecatedTag = $docBlock->getTagsByName('deprecated');

            if (0 === count($deprecatedTag)) {
                return;
            }

            $comment = $deprecatedTag[0]->getContent();

            return preg_replace('/[[:blank:]]+/', ' ', $comment);
        } catch (\Exception $e) {
            return;
        }
    }
629976
protected function &getNode(&$node, $key)
    {
        if (is_object($node) && isset($node->$key)) {
            return $node->$key;
        }

        if (is_array($node) && isset($node[$key])) {
            return $node[$key];
        }

        // Special handling of eloquent relations
        if (!$this->isEloquentModel($node)) {
            $result = null;

            return $result;
        }

        if (!method_exists($node, $key)) {
            $result = null;

            return $result;
        }

        $relation = $node->{$key}();

        if (!$this->isEloquentRelation($relation)) {
            $result = null;

            return $result;
        }

        return $relation->getResults();
    }
1201374
public function resolveReferenceNodeToDefinition(Node $node)
    {
        $parent = $node->parent;
        // Variables are not indexed globally, as they stay in the file scope anyway.
        // Ignore variable nodes that are part of ScopedPropertyAccessExpression,
        // as the scoped property access expression node is handled separately.
        if ($node instanceof Node\Expression\Variable &&
            !($parent instanceof Node\Expression\ScopedPropertyAccessExpression)) {
            // Resolve $this to the containing class definition.
            if ($node->getName() === 'this' && $fqn = $this->getContainingClassFqn($node)) {
                return $this->index->getDefinition($fqn, false);
            }

            // Resolve the variable to a definition node (assignment, param or closure use)
            $defNode = $this->resolveVariableToNode($node);
            if ($defNode === null) {
                return null;
            }
            return $this->createDefinitionFromNode($defNode);
        }
        // Other references are references to a global symbol that have an FQN
        // Find out the FQN
        $fqn = $this->resolveReferenceNodeToFqn($node);
        if (!$fqn) {
            return null;
        }

        if ($fqn === 'self' || $fqn === 'static') {
            // Resolve self and static keywords to the containing class
            // (This is not 100% correct for static but better than nothing)
            $classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class);
            if (!$classNode) {
                return;
            }
            $fqn = (string)$classNode->getNamespacedName();
            if (!$fqn) {
                return;
            }
        } else if ($fqn === 'parent') {
            // Resolve parent keyword to the base class FQN
            $classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class);
            if (!$classNode || !$classNode->classBaseClause || !$classNode->classBaseClause->baseClass) {
                return;
            }
            $fqn = (string)$classNode->classBaseClause->baseClass->getResolvedName();
            if (!$fqn) {
                return;
            }
        }

        // If the node is a function or constant, it could be namespaced, but PHP falls back to global
        // http://php.net/manual/en/language.namespaces.fallback.php
        // TODO - verify that this is not a method
        $globalFallback = ParserHelpers\isConstantFetch($node) || $parent instanceof Node\Expression\CallExpression;

        // Return the Definition object from the index index
        return $this->index->getDefinition($fqn, $globalFallback);
    }
1040357
private static function getNodeOpacity(SVGNode $node)
    {
        $opacity = $node->getStyle('opacity');

        if (is_numeric($opacity)) {
            return floatval($opacity);
        } elseif ($opacity === 'inherit') {
            $parent = $node->getParent();
            if (isset($parent)) {
                return self::getNodeOpacity($parent);
            }
        }

        return 1;
    }
19823
public function get($node = null)
    {
        if ($node !== null) {
            $nodes         = explode(':', $node);
            $configuration = $this->getConfiguration();
            foreach ($nodes as $node) {
                $configuration = $configuration->{$node};
            }
        } else {
            $configuration = $this->getConfiguration();
        }

        return $configuration;
    }
233286
public function visitNode(Node &$node)
    {
        $changed_at = $this->formatDate($this->versioning->getLastChange());
        $first_hit  = $this->formatDate($this->dynamic_analysis->getFirstHit());
        $last_hit   = $this->formatDate($this->dynamic_analysis->getLastHit());

        $json["leaf"]             = false !== strpos($node->getPath(), '::');
        $json["changed_at"]       = $changed_at;
        $json["function_count"]   = $this->dynamic_analysis->getFunctionCount();
        $json["hit_count"]        = $this->dynamic_analysis->getCount();
        $json["dead_count"]       = $this->dynamic_analysis->getDeadCount();
        $json["first_hit"]        = $first_hit;
        $json["last_hit"]         = $last_hit;
        $json["color"]            = $this->ratioToColor($this->dynamic_analysis->getRatioDead());
        $json["pct_dead"]         = $this->dynamic_analysis->getPctDead();
        $json["class"]            = $this->cssEncode($node->getPath());
        $json["name"]             = $node->getPath();
        $json["path"]             = $node->getFullPath();
        $this->json['children'][] = $json;
    }
393457
public function render(&$node)
    {
        $id = call_user_func_array([&$this, 'fetchId'], $node);
        $output = call_user_func_array([&$this, 'fetchItem'], $node);
        list ($source) = $node;
        list ($plugin) = pluginSplit($source);

        $options = [
            'id'     => $id,
            'output' => $output,
            'class'  => $node['class'],
        ];

        $element = 'Toolbar/wrapper';
        if ($plugin !== null) {
            $element = $plugin . '.' . $element;
        }

        return $this->_view->element($element, $options);
    }
966439
protected function lastTagName($node)
    {
        $lastNode = $node->previousSibling;
        while ($lastNode != null) {
            if ($lastNode instanceof DOMElement) {
                break;
            }
            $lastNode = $lastNode->previousSibling;
        }
        $lastTag = '';
        if ($lastNode instanceof DOMElement && $lastNode != null) {
            $lastTag = strtolower($lastNode->nodeName);
        }

        return $lastTag;
    }