@param mixed                $node
@param JsonPointerInterface $pointer

@return mixed

@throws InvalidPathException
357384
public function get($node, JsonPointerInterface $pointer)
    {
        $value = $node;
        foreach ($pointer->toArray() as $singlePath) {
            $accessor = $this->getAccessorForNode($value, $pointer, $singlePath);
            $value = $accessor->get($value, $singlePath);
        }

        return $value;
    }
425825
public function query( $path, $node = NULL )
	{
		if( !$this->xPath )
			throw new Exception( 'No XML loaded yet.' );
		if( $node )
			$nodeList	= $this->xPath->query( $path, $node );
		else
			$nodeList	= $this->xPath->query( $path );
		return $nodeList;
	}
716730
public function decompress(LocalFileNodeInterface $node, array $options = [])
    {
        $pathInfo = pathinfo($node->getPath());

        if (!$node->exists()) {
            throw new InvalidArgumentException("The file: $node does not exist");
        }

        $outputFile = $node->getClone()
                           ->setPath($pathInfo['dirname'] . '/' . $pathInfo['filename'])
                           ->setCompression(CompressionFactory::TYPE_NONE);

        $this->log(LogLevel::INFO, "DeCompressing file: {file} into {target} using {compression}", [
            'file'        => $node,
            'target'      => $outputFile,
            'compression' => $this->getName(),
        ]);

        $cmd = $this->getDecompressCommand($node, $outputFile);

        $keepOld = (isset($options['keepOldFile'])) ? $options['keepOldFile'] : true;

        return $this->processFile($node, $outputFile, $cmd, $keepOld);
    }
538737
public function invoke($node, NodeInterface $parent): void
    {
        if ($this->config->hasInterfaceParsing()) {
            if (! $node instanceof Node\Stmt\Interface_ || ! $parent instanceof PhpFileModelInterface) {
                throw new Exception('InterfaceNodeParser is made to parse an interface node');
            }

            $interface = new InterfaceModel();
            $interface->setParentNode($parent);
            $interface->setName(ClassLikeNameHelper::getName($node));
            $parent->addConcreteUse($parent->getFullNameFor($interface->getName()), $interface->getName());

            if (($documentation = $node->getDocComment()) !== null) {
                $this->documentationNodeParser->invoke($documentation, $interface);
            }

            $this->parseSubNodes($node->stmts, $interface);

            $parent->addInterface($interface);
        }
    }
73740
protected function validateConcreteNode(ArrayNode $node)
    {
        $path = $node->getPath();

        if (null !== $this->key) {
            throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path));
        }

        if (false === $this->allowEmptyValue) {
            throw new InvalidDefinitionException(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s"', $path));
        }

        if (true === $this->atLeastOne) {
            throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path));
        }

        if ($this->default) {
            throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path));
        }

        if (false !== $this->addDefaultChildren) {
            throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path));
        }
    }
1055956
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Doc || ! $parent instanceof DocumentationInterface) {
            throw new Exception('DocumentationNodeParser is made to parse a documentation node');
        }

        $documentation = $node->getText();
        $parent->setDocumentation($documentation);

        $this->annotationParser->invoke($parent, $documentation);
    }
795670
private function &getNodeReference(&$node, array $pointerArray)
    {
        foreach ($pointerArray as $singlePath) {
            $accessor = $this->getAccessorForNode($node, $pointerArray, $singlePath);
            $node = & $accessor->get($node, $singlePath);
        }

        return $node;
    }
127713
public function dispatch(AbstractNode $node)
    {
        $methodName = sprintf('walk%s', $node->getName());

        if (!method_exists($this, $methodName)) {
            throw new InvalidArgumentException(sprintf(
                'Do not know how to walk node of type "%s"',
                $node->getName()
            ));
        }

        return $this->$methodName($node);
    }
25912
public function convert($value, string $path = '', bool $allowSerializeEmpty = false): AbstractNode
    {
        if (null === $value) {
            return NullNode::create();
        }

        $type = gettype($value);

        if (!isset($this->typeMapping[$type])) {
            throw new \InvalidArgumentException(
                sprintf('Type %s is not supported, at path %s', is_object($value) ? get_class($value) : $type, $path)
            );
        }

        $node = $this->typeMapping[$type];

        return $node::create($value, $allowSerializeEmpty);
    }
1295134
private function createNodesWithUuid(NodeInterface $node)
    {
        $path = $node->getPath();

        if ($this->liveSession->itemExists($path)) {
            return;
        }

        $currentDefaultNode = $node->getSession()->getRootNode();
        $currentLiveNode = $this->liveSession->getRootNode();

        $pathSegments = explode('/', ltrim($path, '/'));
        foreach ($pathSegments as $pathSegment) {
            $currentDefaultNode = $currentDefaultNode->getNode($pathSegment);

            if ($currentLiveNode->hasNode($pathSegment)) {
                $currentLiveNode = $currentLiveNode->getNode($pathSegment);

                continue;
            }

            $currentLiveNode = $currentLiveNode->addNode($pathSegment);
            $currentLiveNode->setMixins(['mix:referenceable']);
            $currentLiveNode->setProperty('jcr:uuid', $currentDefaultNode->getIdentifier());
        }
    }
535509
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Stmt\Class_ || ! $parent instanceof PhpFileModelInterface) {
            throw new Exception('ClassNodeParser is made to parse a class node');
        }
        $class = new ClassModel();
        $class->setParentNode($parent);
        $class->setName(ClassLikeNameHelper::getName($node));
        $class->setIsAbstract($node->isAbstract());
        $class->setIsFinal($node->isFinal());
        $parent->addConcreteUse($parent->getFullNameFor($class->getName()), $class->getName());

        if (($documentation = $node->getDocComment()) !== null) {
            $this->documentationNodeParser->invoke($documentation, $class);
        }

        $this->parseSubNodes($node->stmts, $class);

        $parent->addClass($class);
    }
729026
public function serializeNode(TreeNodeInterface $node, $language, TokenInterface $token)
    {
        $userRights = $this->nodePermissionResolver->resolve($node, $language, $token);
        if ($userRights === null) {
            return null;
        }

        $eid = $node->getTypeId();
        $element = $this->elementService->findElement($eid);
        $elementVersion = $this->elementService->findLatestElementVersion($element);

        //$identifier = new Makeweb_Elements_Element_Identifier($eid);
        $lockQtip = '';
        /*
        #if ($lockInfo = $lockManager->getLockInformation($identifier))
        #{
        #    if ($lockInfo['lock_uid'] == MWF_Env::getUid())
        #    {
        #        $lockQtip = '<hr>Locked by me.';
        #    }
        #    else
        #    {
        #        try
        #        {
        #            $user = MWF_Core_Users_User_Peer::getByUserID($lockInfo['lock_uid']);
        #        }
        #        catch (Exception $e)
        #        {
        #            $user = MWF_Core_Users_User_Peer::getSystemUser();
        #        }
        #
        #        $lockQtip = '<hr>Locked by '.$user->getUsername().'.';
        #    }
        #}
        */

        $elementtype = $this->elementService->findElementtype($element);
        $allowedElementtypeIds = [];
        foreach ($this->elementService->findAllowedChildren($elementtype) as $allowedElementtype) {
            $allowedElementtypeIds[] = $allowedElementtype->getId();
        }

        $qtip = 'TID: '.$node->getId().'<br />'.
            'EID: '.$element->getEid().'<br />'.
            'Version: '.$elementVersion->getVersion().'<br />'.
            '<hr>'.
            'Element Type: '.$elementtype->getTitle().'<br />'.
            'Element Type Version: '.$elementtype->getRevision().
            $lockQtip;

        $data = [
            'id' => $node->getID(),
            'eid' => $element->getEid(),
            'text' => $elementVersion->getBackendTitle($language, $element->getMasterLanguage()),
            'icon' => $this->iconResolver->resolveTreeNode($node, $language),
            'navigation' => $node->getInNavigation(),
            'restricted' => $node->getNeedAuthentication(),
            'element_type' => $elementtype->getTitle(),
            'element_type_id' => $elementtype->getId(),
            'element_type_type' => $elementtype->getType(),
            'alias' => $node->getTree()->isInstance($node),
            'allow_drag' => true,
            'sort_mode' => $node->getSortMode(),
            'areas' => [355],
            'allowed_et' => $allowedElementtypeIds,
            'is_published' => $this->stateManager->isPublished($node, $language),
            'rights' => $userRights,
            'qtip' => $qtip,
            'allow_children' => $elementtype->getHideChildren() ? false : true,
            'default_tab' => $elementtype->getDefaultTab(),
            'default_content_tab' => $elementtype->getDefaultContentTab(),
            'masterlanguage' => $element->getMasterLanguage(),
        ];

        if (count($node->getTree()->getChildren($node)) && !$elementtype->getHideChildren()) {
            $data['leaf'] = false;
            $data['expanded'] = false;
        } else {
            $data['leaf'] = true;
            $data['expanded'] = false;
        }

        if ($node->isRoot()) {
            $data['cls'] = 'siteroot-node';
            $data['expanded'] = true;
        }

        return $data;
    }
522314
protected function processConfigurationNode(NodeInterface $node)
    {

        // load the object manager instance
        /** @var \AppserverIo\Psr\Di\ObjectManagerInterface $objectManager */
        $objectManager = $this->getApplication()->search(ObjectManagerInterface::IDENTIFIER);

        // iterate over all configured descriptors and try to load object description
        /** \AppserverIo\Appserver\Core\Api\Node\DescriptorNode $descriptor */
        foreach ($this->getDescriptors() as $descriptor) {
            try {
                // load the descriptor class
                $descriptorClass = $descriptor->getNodeValue()->getValue();

                // load the object descriptor, initialize the servlet mappings and add it to the object manager
                /** \AppserverIo\Psr\Deployment\DescriptorInterface $objectDescriptor */
                if ($objectDescriptor = $descriptorClass::newDescriptorInstance()->fromConfiguration($node)) {
                    $objectManager->addObjectDescriptor($objectDescriptor, true);
                }

                // proceed with the next descriptor
                continue;

                // if class can not be reflected continue with next class
            } catch (\Exception $e) {
                // log an error message
                $this->getApplication()->getInitialContext()->getSystemLogger()->error($e->__toString());

                // proceed with the next descriptor
                continue;
            }
        }
    }
854137
@Override
    public R visitArrayAccess(ArrayAccessTree node, P p) {
        R r = scan(node.getExpression(), p);
        r = scanAndReduce(node.getIndex(), p, r);
        return r;
    }
679022
public function nodeToDslText(NodeInterface $node)
    {
        switch ($node->getNodeType()) {
            case Node::TYPE_USE_CASE:
                return $this->useCaseNodeToDslText($node);
                break;
            default:
                throw new \InvalidArgumentException('Unknown node type "' . $node->getNodeType() . '"');
                break;
        }
    }
1286216
public function setByPath($path, NodeInterface $node = null)
    {
        $this->nodesByPath[$path] = $node;
        if ($node !== null) {
            $this->nodesByIdentifier[$node->getIdentifier()] = $node;
        }
    }
460986
public function copyNode(NodeInterface $node)
    {
        $this->nodeContextPath = $node->getContextPath();
        $this->mode = self::MODE_COPY;
    }