Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
26 | 28 | public function construct(AnnotationMetadata $annotationMetadata, Scope $scope, iterable $parameters) : object |
|
27 | { |
||
28 | 28 | (new TargetValidator())->validate($annotationMetadata, $scope); |
|
29 | |||
30 | 28 | foreach ($parameters as $propertyName => $propertyValue) { |
|
31 | 27 | if ($propertyName === '') { |
|
32 | 20 | if ($annotationMetadata->hasConstructor()) { |
|
33 | 20 | continue; |
|
34 | } |
||
35 | |||
36 | 6 | $propertyName = $annotationMetadata->getDefaultProperty()->getName(); |
|
37 | } |
||
38 | |||
39 | 18 | (new ValueValidator())->validate( |
|
40 | 18 | $annotationMetadata, |
|
41 | 18 | $annotationMetadata->getProperties()[$propertyName], |
|
42 | 18 | $propertyValue |
|
43 | ); |
||
44 | } |
||
45 | |||
46 | 28 | return $this->instantiator->instantiate($annotationMetadata, $parameters); |
|
47 | } |
||
49 |