| Total Complexity | 8 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class Path implements PathInterface |
||
| 11 | { |
||
| 12 | |||
| 13 | private $elements; |
||
| 14 | |||
| 15 | public function __construct(...$elements) |
||
| 16 | { |
||
| 17 | $this->elements = $elements; |
||
| 18 | } |
||
| 19 | |||
| 20 | public function copyWithElement(int $index): PathInterface |
||
| 21 | { |
||
| 22 | return new self(...$this->elements, ...[$index]); |
||
| 23 | } |
||
| 24 | |||
| 25 | public function copyWithProperty(string $name): PathInterface |
||
| 28 | } |
||
| 29 | |||
| 30 | public function copyParent(): PathInterface |
||
| 31 | { |
||
| 32 | if (empty($this->elements)) { |
||
| 33 | throw new Exception\ParentNotFoundException($this); |
||
| 34 | } |
||
| 35 | |||
| 36 | return new self(...array_slice($this->elements, 0, -1)); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getElements(): array |
||
| 40 | { |
||
| 41 | return $this->elements; |
||
| 42 | } |
||
| 43 | |||
| 44 | public function equals(PathInterface $path): bool |
||
| 45 | { |
||
| 46 | return $path->getElements() === $this->elements; |
||
| 47 | } |
||
| 48 | |||
| 49 | public function contains(PathInterface $path): bool |
||
| 54 | } |
||
| 55 | } |
||
| 56 |