Conditions | 5 |
Paths | 7 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
22 | 2 | public function analyze( |
|
23 | DefinitionAnalyzer $analyzer, |
||
24 | ClassDefinition $classDefinition, |
||
25 | \ReflectionProperty $reflectionProperty |
||
26 | ) { |
||
27 | 2 | $propertyName = $reflectionProperty->getName(); |
|
28 | // Resolve annotations |
||
29 | 2 | $annotations = $this->reader->getPropertyAnnotations($reflectionProperty); |
|
30 | 2 | if (count($annotations)) { |
|
31 | // Define property if not exists |
||
32 | 2 | if (!$classDefinition->hasProperty($propertyName)) { |
|
33 | 2 | $classDefinition->defineProperty($propertyName); |
|
34 | } |
||
35 | // Exec annotations |
||
36 | 2 | foreach ($annotations as $annotation) { |
|
37 | 2 | if ($annotation instanceof ResolvePropertyInterface) { |
|
38 | 2 | $annotation->resolveProperty($analyzer, $classDefinition, $reflectionProperty); |
|
39 | } |
||
40 | } |
||
41 | } |
||
42 | 2 | } |
|
43 | } |
||
44 |