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