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