Total Complexity | 12 |
Total Lines | 69 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | class AliasService |
||
6 | { |
||
7 | /** |
||
8 | * @var array |
||
9 | */ |
||
10 | protected $aliases; |
||
11 | |||
12 | /** |
||
13 | * @param array|null $aliases |
||
14 | * |
||
15 | * @throws AliasException |
||
16 | */ |
||
17 | public function __construct(array $aliases = null) |
||
22 | } |
||
23 | } |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @param string $alias |
||
28 | * @param string $value |
||
29 | * |
||
30 | * @throws AliasException |
||
31 | */ |
||
32 | public function setAlias(string $alias, string $value) |
||
33 | { |
||
34 | if (0 !== \strpos($alias, '@')) { |
||
35 | throw new AliasException('Alias should starts with @'); |
||
36 | } |
||
37 | $this->aliases[$alias] = $value; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @return array |
||
42 | */ |
||
43 | public function getAliases(): array |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param string $alias |
||
50 | * @param bool $throwException |
||
51 | * |
||
52 | * @return string|null |
||
53 | * @throws AliasException |
||
54 | */ |
||
55 | public function get(string $alias, $throwException = true) |
||
74 | } |
||
75 | } |
||
76 |