19 declare(strict_types=1);
26 class ilHandler implements ilParserPathHandlerInterface
39 $this->with_start_at_root_enabled =
false;
45 $clone->with_start_at_root_enabled =
$enabled;
49 public function withNode(ilFilePathNodeInterface $node): ilParserPathHandlerInterface
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): ilParserPathHandlerInterface
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(): ilFilePathNodeInterface
126 return 0 <= $this->index && $this->index < $this->
count();
136 return count($this->nodes);
withNode(ilFilePathNodeInterface $node)
bool $with_start_at_root_enabled
withStartAtRoot(bool $enabled)
subPath(int $start, ?int $end=null)