Total Complexity | 6 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 72.72% |
Changes | 0 |
1 | <?php |
||
10 | trait AnnotationsTrait |
||
11 | { |
||
12 | public $annotations; |
||
13 | |||
14 | public function getAnnotations(): array |
||
15 | { |
||
16 | return $this->annotations; |
||
17 | } |
||
18 | |||
19 | 65 | public function setAnnotations(array $annotations) |
|
20 | { |
||
21 | 65 | $this->annotations = $annotations; |
|
22 | |||
23 | 65 | return $this; |
|
24 | } |
||
25 | |||
26 | 61 | public function getAnnotation(string $annotationName, $throwException = false) |
|
27 | { |
||
28 | 61 | if (!isset($this->annotations[$annotationName]) && $throwException) { |
|
29 | throw new \InvalidArgumentException("no annotation with name $annotationName"); |
||
30 | } |
||
31 | |||
32 | 61 | return $this->annotations[$annotationName] ?? null; |
|
33 | } |
||
34 | |||
35 | 59 | public function hasAnnotation(string $annotationName) |
|
38 | } |
||
39 | } |
||
40 |