Checks if the given node path can be used for the given node.

@param string $nodePath
@param NodeInterface $node
@return boolean
967292
public function nodePathAvailableForNode($nodePath, NodeInterface $node)
    {
        /** @var NodeData $existingNodeData */
        $existingNodeDataObjects = $this->nodeDataRepository->findByPathWithoutReduce($nodePath, $node->getWorkspace(), true);
        foreach ($existingNodeDataObjects as $existingNodeData) {
            if ($existingNodeData->getMovedTo() !== null && $existingNodeData->getMovedTo() === $node->getNodeData()) {
                return true;
            }
        }
        return !$this->nodePathExistsInAnyContext($nodePath);
    }
1001561
public function except(NodeInterface $node)
    {
        return $this->filter(function (NodeInterface $eachNode) use ($node) {
            return !$eachNode->is($node);
        });
    }
230560
protected function removeNodeAndChildNodesInWorkspaceByPath($nodePath, $workspaceName)
    {
        /** @var QueryBuilder $queryBuilder */
        $queryBuilder = $this->entityManager->createQueryBuilder();

        $queryBuilder
            ->resetDQLParts()
            ->delete(NodeData::class, 'n')
            ->where('n.path LIKE :path')
            ->orWhere('n.path LIKE :subpath')
            ->andWhere('n.workspace = :workspace')
            ->setParameters(['path' => $nodePath, 'subpath' => $nodePath . '/%', 'workspace' => $workspaceName])
            ->getQuery()
            ->execute();
    }
455709
protected function useRelationInterfaceInEntityInterface(string $classPath, string $interfacePath): void
    {
        $entityFqn           = PhpClass::fromFile($classPath)->getQualifiedName();
        $entityInterfaceFqn  = $this->namespaceHelper->getEntityInterfaceFromEntityFqn($entityFqn);
        $entityInterfacePath = (new \ts\Reflection\ReflectionClass($entityInterfaceFqn))->getFileName();
        $entityInterface     = PhpInterface::fromFile($entityInterfacePath);
        $relationInterface   = PhpInterface::fromFile($interfacePath);
        $entityInterface->addInterface($relationInterface);
        $this->codeHelper->generate($entityInterface, $entityInterfacePath);
    }
429179
protected function interruptNode(NodeInterface $node)
    {
        // if we have an interruptNodeId, bubble up until we match a node
        // else stop propagation
        return $this->interruptNodeId ? $this->interruptNodeId !== $node->getId() : false;
    }
278106
public function setChildNodesByPathAndNodeTypeFilter($path, $nodeTypeFilter, array $nodes)
    {
        if (!isset($this->childNodesByPathAndNodeTypeFilter[$path])) {
            $this->childNodesByPathAndNodeTypeFilter[$path] = [];
        }

        foreach ($nodes as $node) {
            /** @var NodeInterface $node */
            $this->nodesByPath[$node->getPath()] = $node;
            $this->nodesByIdentifier[$node->getIdentifier()] = $node;
        }

        $this->childNodesByPathAndNodeTypeFilter[$path][$nodeTypeFilter] = $nodes;
    }
68163
public function isAllowed($modulePath)
    {
        $modulePathSegments = explode('/', $modulePath);
        $moduleConfiguration = Arrays::getValueByPath($this->modules, implode('.submodules.', $modulePathSegments));

        if (!$this->privilegeManager->isGranted(ModulePrivilege::class, new ModulePrivilegeSubject($modulePath))) {
            return false;
        }

        // @deprecated since Neos 3.2, use the ModulePrivilegeTarget instead!
        if (isset($moduleConfiguration['privilegeTarget']) && !$this->privilegeManager->isPrivilegeTargetGranted($moduleConfiguration['privilegeTarget'])) {
            return false;
        }

        return true;
    }
484829
static function createNodesConditionSQLStringFromPath( $nodePath, $includingLastNodeInThePath, $limit = false )
    {
        $pathString = false;
        $pathArray  = explode( '/', trim( $nodePath, '/' ) );

        $pathArrayCount = count( $pathArray );

        if ( $limit && $includingLastNodeInThePath == false )
        {
            $limit++;
        }

        $sliceOffset = $limit && $pathArrayCount > $limit ? $pathArrayCount - $limit : 0;
        $sliceLength = $includingLastNodeInThePath ? $pathArrayCount - $sliceOffset : $pathArrayCount - ( $sliceOffset + 1 );

        // only take a slice when necessary
        if ( ( $sliceOffset + $sliceLength ) < $pathArrayCount )
        {
            $pathArray = array_slice( $pathArray, $sliceOffset, $sliceLength );
        }

        if ( $sliceLength == 1 )
        {
            $pathString = ' node_id = ' . implode( '', $pathArray ) . ' and ';
        }
        else if ( $sliceLength > 0 )
        {
            $db = eZDB::instance();
            $pathString = ' ' . $db->generateSQLINStatement( $pathArray, 'node_id' ) . ' and ';
        }

        return $pathString;
    }
585356
public static function addNodePathSegment($nodePath, $nodePathSegment)
    {
        $nodePath = rtrim($nodePath, '/');
        if ($nodePathSegment !== '' || $nodePath === '') {
            $nodePath .= '/' . trim($nodePathSegment, '/');
        }

        return $nodePath;
    }
217400
protected function isNodePathAvailable(string $path): bool
    {
        $existingNodeDataArray = $this->nodeDataRepository->findByPathWithoutReduce($path, $this->context->getWorkspace());

        $nonMatchingNodeData = array_filter($existingNodeDataArray, function (NodeData $nodeData) {
            return ($nodeData->getIdentifier() !== $this->getIdentifier());
        });

        return ($nonMatchingNodeData === []);
    }
1253812
public boolean matches(LinkedList<Node> nodePath) {
        if(simplePattern) {
            // simple pattern
            return items.get(0).matches(nodePath.getLast());
        }
        // match the full pattern
        if(items.size() != nodePath.size()) {
            // different size
            return false;
        }
        for(int i=0; i<items.size(); i++) {
            if (! items.get(i).matches(nodePath.get(i))) {
                // failed a comparison
                return false;
            }
        }
        // pass all comparisons
        return true;
    }
1128396
protected function moveNodeToDestinationPath(NodeInterface $node, $destinationPath)
    {
        $nodeData = $node->getNodeData();
        $possibleShadowedNodeData = $nodeData->move($destinationPath, $this->context->getWorkspace());
        if ($node instanceof Node) {
            $node->setNodeData($possibleShadowedNodeData);
        }
    }
1315945
public function move($fromPath, $toPath)
    {
        $fromNode = $this->nodeAt($fromPath);

        try {
            $nodeToOverride = $this->nodeAt($toPath);

            if (!is_a($nodeToOverride, get_class($fromNode))) {
                //nodes of a different type
                throw new \RuntimeException('Can\'t move.');
            }

            if ($nodeToOverride instanceof Directory) {
                if ($nodeToOverride->size()) {
                    //nodes of a different type
                    throw new \RuntimeException('Can\'t override non empty directory.');
                }
            }

            $this->remove($toPath, true);

        } catch (NotFoundException $e) {
            //nothing at destination, we're good
        }

        $toParent = $this->directoryAt(dirname($toPath));

        $fromNode->setBasename(basename($toPath));

        $toParent->addNode($fromNode);

        $this->remove($fromPath, true);

    }
234911
private function matchSuffixPath(NodeInterface $node, string $path, int $i): int
    {
        $match_result = -1;
        if (!$node instanceof RootNode) {
            $match_result = $this->walkEdge($path, $i, $node->getStart(), $node->getEnd());
            if ($match_result !== 0) {
                return $match_result;
            }
        }

        $i = $i + $node->getEdgeSize();
        $children = $node->getChildren();
        if (isset($children[$path[$i]])) {
            return $this->matchSuffixPath($children[$path[$i]], $path, $i);
        } else {
            return -1;
        }
    }
42209
public function add(Node\NodeInterface $node)
	{
		$node->setRepository($this);
		parent::add($node);
		$this->array[] = $node;
	}
443663
public function canHandle(\DOMNode $node, NodeInterface $target)
    {
        return strtolower($node->nodeName) == 'enclosure' && $target Instanceof ItemInterface;
    }
1104727
public function add(NodeInterface $node)
	{
		$max = $this->getMax();
		$node->setLeftValue($max + 1);
		$node->setRightValue($max + 2);
		$node->setLevel(0);
	}