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