| Conditions | 7 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | private function creating(string $class, ...$args) |
||
| 19 | { |
||
| 20 | $ref = new Reflection($this, $class, $args); |
||
| 21 | |||
| 22 | if ($ref->hasConstructor()) { |
||
| 23 | foreach ($params = $ref->getConstructParams() as $idx => $val) { |
||
| 24 | $val instanceof Dependency && $params[$idx] = $val->object(); |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | $object = new $class(...($params ?? [])); |
||
| 29 | |||
| 30 | if ($ref->hasProperties()) { |
||
| 31 | foreach ($ref->getPropertyInjects() as $name => $target) { |
||
| 32 | $target instanceof Dependency && $ref->setProperty($object, $name, $target->object()); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | return $object; |
||
| 37 | } |
||
| 39 |