Total Complexity | 5 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | final class TagReference |
||
14 | { |
||
15 | private const PREFIX = 'tag@'; |
||
16 | |||
17 | 1 | private function __construct() |
|
18 | { |
||
19 | 1 | } |
|
20 | |||
21 | 1 | public static function to(string $tag): Reference |
|
22 | { |
||
23 | 1 | return Reference::to(self::PREFIX . $tag); |
|
24 | } |
||
25 | |||
26 | 13 | public static function extractTagFromAlias(string $alias): string |
|
27 | { |
||
28 | 13 | if (!str_starts_with($alias, self::PREFIX)) { |
|
29 | 2 | throw new \InvalidArgumentException(sprintf('Alias "%s" is not a tag alias.', $alias)); |
|
30 | } |
||
31 | 11 | return substr($alias, 4); |
|
32 | } |
||
33 | |||
34 | 132 | public static function isTagAlias(string $id): bool |
|
37 | } |
||
38 | } |
||
39 |