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