19 declare(strict_types=1);
26 class Index implements IndexFilePathNodeInterface
35 $this->indexing_from_end_enabled =
false;
38 public function withIndex(
int $index): IndexFilePathNodeInterface
55 $clone->indexing_from_end_enabled = $enabled;
62 if (!isset($this->comparison)) {
63 $indexing = $this->indexing_from_end_enabled
64 ?
'(last)-' . $this->index
67 $indexing =
'position()' . $this->comparison->toString();
69 return '[' . $indexing .
']';
bool $indexing_from_end_enabled
HandlerInterface $comparison
withIndexingFromEndEnabled(bool $enabled)
withComparison(HandlerInterface $comparison)