| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function addCustomizer(QueryCustomizer $customizer) { |
||
| 18 | if (!$customizer) { |
||
| 19 | throw new InvalidArgumentException('Customizer should not be null.'); |
||
| 20 | } |
||
| 21 | $reader = new AnnotationReader(); |
||
| 22 | $rc = new \ReflectionClass($customizer); |
||
| 23 | $anno = $reader->getClassAnnotation($rc, QueryExtension::class); |
||
| 24 | if (!$anno) { |
||
| 25 | throw new InvalidArgumentException(get_class($customizer).' doesn\'t have any '.QueryExtension::class.' annotation.'); |
||
| 26 | } |
||
| 27 | foreach ($anno->value as $queryKey) { |
||
| 28 | $this->customizers[$queryKey][] = $customizer; |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 42 | } |