@param ResourceNode $node
@param bool         $throwException

@return ResourceNode|null

@throws \Exception

@deprecated
199189
public function getRealTarget(ResourceNode $node, $throwException = true)
    {
        if ('Claroline\LinkBundle\Entity\Resource\Shortcut' === $node->getClass()) {
            $resource = $this->getResourceFromNode($node);
            if (null === $resource) {
                if ($throwException) {
                    throw new \Exception('The resource was removed.');
                }

                return null;
            }
            $node = $resource->getTarget();
            if (null === $node) {
                if ($throwException) {
                    throw new \Exception('The node target was removed.');
                }

                return null;
            }
        }

        return $node;
    }
1285996
public function transform($node)
    {
        if (null === $node) {
            return;
        }

        if (!$node instanceof NodeInterface) {
            throw new UnexpectedTypeException($node, NodeInterface::class);
        }

        return $node->getPath();
    }
974042
public function getResourceFromShortcut(ResourceNode $node)
    {
        $target = $this->getRealTarget($node);

        return $this->getResourceFromNode($target);
    }
1165412
public function addToObjectNode(string $key, AbstractNode $node): QueryBuilderInterface
    {
        if (!$this->node instanceof ObjectNode) {
            throw new \Exception(sprintf('You cannot call %s on node type: %s', __FUNCTION__, get_class($this->node)));
        }

        $this->node->add($key, $node);
        $this->reassignParent($node);

        return $this;
    }
750618
public function leaveNode(Node $node)
    {
        $filter = $this->filter;

        if (! $node instanceof ClassMethod || null === ($filterResult = $filter($node))) {
            return null;
        }

        if (false === $filterResult) {
            return false;
        }

        $node->stmts = array(
            new Throw_(
                new New_(
                    new FullyQualified('BadMethodCallException'),
                    array(new Arg(new String_('Method is disabled')))
                )
            )
        );

        return $node;
    }
1019073
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Stmt\Namespace_ || ! $parent instanceof PhpFileModelInterface) {
            throw new Exception('NamespaceNodeParser is made to parse a namespace node');
        }

        if ($node->name instanceof Node\Name) {
            $parent->setNamespace($node->name->parts);
        }

        $this->preParseUses($node->stmts, $parent);

        $this->parseSubNodes($node->stmts, $parent);
    }
320525
public function beforeNodeCopy(NodeInterface $sourceNode, NodeInterface $targetParentNode)
    {
        if (!$this->eventEmittingService->isEnabled()) {
            return;
        }

        if ($this->currentlyCopying) {
            throw new \Exception('TODO: already copying...');
        }

        $this->currentlyCopying = true;

        /* @var $nodeEvent NodeEvent */
        $nodeEvent = $this->eventEmittingService->emit(self::NODE_COPY, [
            'copiedInto' => $targetParentNode->getContextPath()
        ], NodeEvent::class);
        $nodeEvent->setNode($sourceNode);
        $this->eventEmittingService->pushContext();
    }
338499
public static Node getNtResourceRecursively(Node node) throws ItemNotFoundException, RepositoryException
   {

      if (node.isNodeType("nt:resource"))
         return node;

      Item pi = node.getPrimaryItem();
      if (pi.isNode())
      {
         return getNtResourceRecursively((Node)pi);
      }
      throw new ItemNotFoundException("No nt:resource node found for " + node.getPath());
   }
1253188
public function getResourceFromNode(ResourceNode $node)
    {
        return $this->om->getRepository($node->getClass())->findOneByResourceNode($node);
    }
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;
            }
        }
    }
1158212
protected function throwResourceException(ResponseInterface $response, string $action, string $exceptionClass)
    {
        $message = 'Unable to '.$action.' resource (type: '.static::resourceType().', ID: '.$this->id().').';

        if (is_null($response)) {
            throw new \InvalidArgumentException($message);
        }

        $message .= ' Server response: "'.((string) $response->getBody()).'".';

        throw new $exceptionClass($message, $response->getStatusCode());
    }
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);
    }
779287
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Expr || ! $parent instanceof VariableLikeInterface) {
            throw new Exception('ValueNodeParser is made to parse a expression node');
        }
    }
487661
protected static function exceptionOnFalse($resource, callable $closure)
    {
        $result = $closure($resource);

        if ($result === false) {
            throw new SocketException($resource);
        }

        return $result;
    }
361247
public function enterNode(Node $node)
    {
        if ($node instanceof Assign && $node->var instanceof Variable && $node->var->name === 'this') {
            throw new FatalErrorException('Cannot re-assign $this', 0, E_ERROR, null, $node->getLine());
        }
    }
100082
static function processNodeTransformationRoot( $useComments, $php, $tpl, &$node, &$resourceData )
    {
        $nodeType = $node[0];
        if ( $nodeType == eZTemplate::NODE_ROOT )
        {
            $children = $node[1];
            $newNode = array( $nodeType,
                              false );
            if ( $children )
            {
                $newChildren = array();
                foreach ( $children as $childNode )
                {
                    $newChildNode = eZTemplateCompiler::processNodeTransformationChild( $useComments, $php, $tpl, $childNode, $resourceData );
                    if ( !$newChildNode )
                        $newChildren[] = $childNode;
                    else
                        $newChildren = array_merge( $newChildren, $newChildNode );
                }
                if ( count( $newChildren ) > 0 )
                    $newNode[1] = $newChildren;
            }
            return $newNode;
        }
        else
            $tpl->error( 'processNodeTransformation', "Unknown root type $nodeType, should be " . eZTemplate::NODE_ROOT );
        return false;
    }
17228
public function findByResourceNodeIds(array $resourceNodeIds, $executeQuery = true)
    {
        $query = $this->createQueryBuilder('blog')
            ->select(array('blog', 'bo', 'post'))
            ->join('blog.options', 'bo')
            ->leftJoin('blog.posts', 'post')
            ->where('blog.resourceNode IN (:resourceNodeIds)')
            ->setParameter('resourceNodeIds', $resourceNodeIds)
            ->getQuery()
        ;

        return $executeQuery ? $query->getResult() : $query;
    }