Conditions | 4 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
30 | public function toPropertyMetadata(PropertyMetadata $propertyMetadata) |
||
31 | { |
||
32 | // Check if there is no type hint - we cannot inject without it |
||
33 | if ($this->argumentType === null || $this->argumentType === '') { |
||
34 | throw new TypeHintDoesNotExists('Cannot configure property "' . $propertyMetadata->name . '" injection'); |
||
35 | } |
||
36 | |||
37 | // Check if specified type hint exists |
||
38 | if (!class_exists($this->argumentType)) { |
||
39 | throw new ClassDoesNotExists('Cannot configure property "' . $this->argumentName . '" with "' . $this->argumentType . '"'); |
||
40 | } |
||
41 | |||
42 | // Store property metadata |
||
43 | $propertyMetadata->typeHint = $this->argumentType; |
||
44 | $propertyMetadata->name = $this->argumentName; |
||
45 | } |
||
46 | } |
||
47 |