Total Complexity | 10 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | class ExcludeAnnotation extends AbstractAnnotation |
||
28 | { |
||
29 | /** |
||
30 | * @var bool |
||
31 | */ |
||
32 | protected $bValue; |
||
33 | |||
34 | /** |
||
35 | * @inheritDoc |
||
36 | */ |
||
37 | public static function parseAnnotation($value) |
||
38 | { |
||
39 | if($value === 'true') |
||
40 | { |
||
41 | return [true]; |
||
42 | } |
||
43 | if($value === 'false') |
||
44 | { |
||
45 | return [false]; |
||
46 | } |
||
47 | return [$value]; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @inheritDoc |
||
52 | * @throws AnnotationException |
||
53 | */ |
||
54 | public function initAnnotation(array $properties) |
||
55 | { |
||
56 | if(count($properties) !== 0 && |
||
57 | (count($properties) !== 1 || !isset($properties[0]) || !is_bool($properties[0]))) |
||
58 | { |
||
59 | throw new AnnotationException('the @exclude annotation requires a single boolean or no property'); |
||
60 | } |
||
61 | $this->bValue = $properties[0] ?? true; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @inheritDoc |
||
66 | */ |
||
67 | public function getName(): string |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @inheritDoc |
||
74 | */ |
||
75 | public function getValue() |
||
78 | } |
||
79 | } |
||
80 |