19 declare(strict_types=1);
26 class Handler implements ParserPathHandlerInterface
39 $this->with_start_at_root_enabled =
false;
45 $clone->with_start_at_root_enabled = $enabled;
49 public function withNode(FilePathNodeInterface $node): ParserPathHandlerInterface
52 $clone->nodes[] = $node;
58 $first_separator =
true;
60 for ($i = 0; $i <
count($this->nodes); $i++) {
61 $node = $this->nodes[$i];
64 ($node->requiresPathSeparator() && !$first_separator)
67 $first_separator =
false;
71 $first_separator =
false;
73 $path_str .= $node->toString();
78 public function subPath(
int $start, ?
int $end =
null): ParserPathHandlerInterface
81 $clone->nodes = is_null($end)
82 ? array_slice($this->nodes, $start)
83 : array_slice($this->nodes, $start, $end - $start);
89 return $this->
count() > 0
96 return $this->
count() > 0
97 ? $this->nodes[$this->
count() - 1]
109 public function current(): FilePathNodeInterface
126 return isset($this->nodes[$this->index]);
136 return count($this->nodes);
withStartAtRoot(bool $enabled)
withNode(FilePathNodeInterface $node)
subPath(int $start, ?int $end=null)
bool $with_start_at_root_enabled
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null