Total Complexity | 7 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
14 | final class AnnotationParsedInterface implements ParsedAnnotationInterface, \JsonSerializable |
||
15 | { |
||
16 | /** @var array */ |
||
17 | private array $properties = []; |
||
18 | |||
19 | /** |
||
20 | * Magic method. |
||
21 | * |
||
22 | * @param string $name |
||
23 | * @return bool |
||
24 | */ |
||
25 | 1 | public function __isset(string $name) : bool |
|
26 | { |
||
27 | 1 | return isset($this->properties[$name]); |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * Magic method. |
||
32 | * |
||
33 | * @param string $name |
||
34 | * @param $value |
||
35 | */ |
||
36 | 25 | public function __set(string $name, $value) |
|
37 | { |
||
38 | 25 | if (!isset($this->properties[$name])) { |
|
39 | 25 | $this->properties[$name] = $value; |
|
40 | } else { |
||
41 | 7 | if (is_array($this->properties[$name])) { |
|
42 | 7 | $this->properties[$name][] = $value; |
|
43 | } else { |
||
44 | 7 | $this->properties[$name] = [$this->properties[$name], $value]; |
|
45 | } |
||
46 | } |
||
47 | 25 | } |
|
48 | |||
49 | /** |
||
50 | * Magic method. |
||
51 | * |
||
52 | * @param string $name |
||
53 | * @return mixed |
||
54 | */ |
||
55 | 9 | public function __get(string $name) |
|
58 | } |
||
59 | |||
60 | /** |
||
61 | * Stub method of \JsonSerializable. |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | 5 | public function jsonSerialize() |
|
68 | } |
||
69 | |||
70 | 5 | public function isEmpty(): bool |
|
73 | } |
||
74 | } |
||
75 |