| Conditions | 4 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | private function addPromiseFactory(ORM $orm, ContainerInterface $container): ORM |
||
| 39 | { |
||
| 40 | if ($this->promiseFactory === null) { |
||
| 41 | return $orm; |
||
| 42 | } |
||
| 43 | $promiseFactory = is_string($this->promiseFactory) |
||
| 44 | ? $container->get($this->promiseFactory) |
||
| 45 | : $this->promiseFactory; |
||
| 46 | |||
| 47 | |||
| 48 | if (!$promiseFactory instanceof PromiseFactoryInterface) { |
||
| 49 | throw new BadDeclarationException('Promise factory', PromiseFactoryInterface::class, $promiseFactory); |
||
| 50 | } |
||
| 51 | return $orm->withPromiseFactory($promiseFactory); |
||
| 52 | } |
||
| 54 |