Neos\ContentRepository\Domain\Utility\NodePaths::isSubPathOf PHP Method

isSubPathOf() public static method

Does $possibleSubPath begin with $path and so is a subpath or not.
public static isSubPathOf ( string $path, string $possibleSubPath ) : boolean
$path string
$possibleSubPath string
return boolean
    public static function isSubPathOf($path, $possibleSubPath)
    {
        return strpos($possibleSubPath, $path) === 0;
    }

Usage Example

 /**
  * Find all node data in a path matching the given workspace hierarchy
  *
  * Internal method, used by Node::setPath
  *
  * @param string $path
  * @param Workspace $workspace
  * @param boolean $includeRemovedNodes Should removed nodes be included in the result (defaults to FALSE)
  * @param boolean $recursive
  * @return array<NodeData> Node data reduced by workspace but with all existing content dimension variants, includes removed nodes
  */
 public function findByPathWithoutReduce($path, Workspace $workspace, $includeRemovedNodes = false, $recursive = false)
 {
     $path = strtolower($path);
     $workspaces = $this->collectWorkspaceAndAllBaseWorkspaces($workspace);
     $queryBuilder = $this->createQueryBuilder($workspaces);
     $this->addPathConstraintToQueryBuilder($queryBuilder, $path, $recursive);
     $query = $queryBuilder->getQuery();
     $foundNodes = $query->getResult();
     // Consider materialized, but not yet persisted nodes
     foreach ($this->addedNodes as $addedNode) {
         if (($addedNode->getPath() === $path || $recursive && NodePaths::isSubPathOf($path, $addedNode->getPath())) && in_array($addedNode->getWorkspace(), $workspaces)) {
             $foundNodes[] = $addedNode;
         }
     }
     $foundNodes = $this->reduceNodeVariantsByWorkspaces($foundNodes, $workspaces);
     if ($includeRemovedNodes === false) {
         $foundNodes = $this->filterRemovedNodes($foundNodes, false);
     }
     return $foundNodes;
 }
All Usage Examples Of Neos\ContentRepository\Domain\Utility\NodePaths::isSubPathOf