Total Complexity | 3 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | class FailWith |
||
13 | { |
||
14 | /** |
||
15 | * The default value to use if the right is not enforced. |
||
16 | * |
||
17 | * @var mixed |
||
18 | */ |
||
19 | private $value; |
||
20 | |||
21 | /** |
||
22 | * @param array<string, mixed> $values |
||
23 | * |
||
24 | * @throws \BadMethodCallException |
||
25 | */ |
||
26 | public function __construct(array $values) |
||
27 | { |
||
28 | if (!array_key_exists('value', $values)) { |
||
29 | throw new \BadMethodCallException('The @FailWith annotation must be passed a defaultValue. For instance: "@FailWith(null)"'); |
||
30 | } |
||
31 | $this->value = $values['value']; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Returns the default value to use if the right is not enforced. |
||
36 | * |
||
37 | * @return mixed |
||
38 | */ |
||
39 | public function getValue() |
||
42 | } |
||
43 | } |
||
44 |