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