| Total Complexity | 4 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class Factory implements InstantiatorInterface |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var DoctrineInstantiator |
||
| 20 | */ |
||
| 21 | private $doctrine; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var NamedArgumentsInstantiator |
||
| 25 | */ |
||
| 26 | private $named; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Factory constructor. |
||
| 30 | */ |
||
| 31 | public function __construct() |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param \ReflectionClass $attr |
||
| 39 | * @param array $arguments |
||
| 40 | * @param string $context |
||
| 41 | * @return object |
||
| 42 | */ |
||
| 43 | public function instantiate(\ReflectionClass $attr, array $arguments, string $context): object |
||
| 44 | { |
||
| 45 | if ($this->isNamedArguments($attr)) { |
||
| 46 | return $this->named->instantiate($attr, $arguments, $context); |
||
| 47 | } |
||
| 48 | |||
| 49 | return $this->doctrine->instantiate($attr, $arguments, $context); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param \ReflectionClass $class |
||
| 54 | * @return bool |
||
| 55 | */ |
||
| 56 | private function isNamedArguments(\ReflectionClass $class): bool |
||
| 59 | } |
||
| 60 | } |