Total Complexity | 4 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | class Right |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $name; |
||
19 | |||
20 | /** |
||
21 | * @param array<string, mixed> $values |
||
22 | * |
||
23 | * @throws \BadMethodCallException |
||
24 | */ |
||
25 | public function __construct(array $values) |
||
26 | { |
||
27 | if (!isset($values['value']) && !isset($values['name'])) { |
||
28 | throw new \BadMethodCallException('The @Right annotation must be passed a right name. For instance: "@Right(\'my_right\')"'); |
||
29 | } |
||
30 | $this->name = $values['value'] ?? $values['name']; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return string |
||
35 | */ |
||
36 | public function getName(): string |
||
39 | } |
||
40 | } |
||
41 |