| Total Complexity | 5 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | final class Slug |
||
| 19 | { |
||
| 20 | /** @var array */ |
||
| 21 | private $slug; |
||
| 22 | |||
| 23 | public function __construct(array $slug) |
||
| 24 | { |
||
| 25 | Assertion::notEmpty($slug, 'No slug elements defined'); |
||
| 26 | |||
| 27 | $this->slug = $slug; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function toArray(): array |
||
| 31 | { |
||
| 32 | return $this->slug; |
||
| 33 | } |
||
| 34 | |||
| 35 | public function __toString(): string |
||
| 36 | { |
||
| 37 | return implode('-', $this->slug); |
||
| 38 | } |
||
| 39 | |||
| 40 | public static function create(array $slug): self |
||
| 43 | } |
||
| 44 | |||
| 45 | public static function fromString(string $slug): self |
||
| 46 | { |
||
| 50 |