| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 5 | final class Link |
||
| 6 | { |
||
| 7 | /** @var string */ |
||
| 8 | private $path; |
||
| 9 | /** @var RelationshipType */ |
||
| 10 | private $type; |
||
| 11 | |||
| 12 | private function __construct(string $path, RelationshipType $type) |
||
| 13 | { |
||
| 14 | $this->path = $path; |
||
| 15 | $this->type = $type; |
||
| 16 | } |
||
| 17 | |||
| 18 | public static function to(string $path, RelationshipType $type): self |
||
| 19 | { |
||
| 20 | return new self($path, $type); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Retrieves the path this links to. |
||
| 25 | * |
||
| 26 | * @return string The path this link points to. |
||
| 27 | */ |
||
| 28 | public function path(): string |
||
| 29 | { |
||
| 30 | return $this->path; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Retrieves the type of relationship this link represents. |
||
| 35 | * |
||
| 36 | * @return RelationshipType The relationship type. |
||
| 37 | */ |
||
| 38 | public function type(): RelationshipType |
||
| 41 | } |
||
| 42 | } |
||
| 43 |