| Conditions | 3 |
| Paths | 3 |
| Total Lines | 27 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 6 | protected function create(ServiceLocatorInterface $serviceLocator, $config) |
|
| 21 | { |
||
| 22 | 6 | $serializer = $this->getServiceOrClassObject($serviceLocator, $config['serializer']); |
|
| 23 | |||
| 24 | 6 | if (!$serializer instanceof SerializerInterface) { |
|
| 25 | 1 | throw $this->getException( |
|
| 26 | 1 | 'serializer', |
|
| 27 | 1 | SerializerInterface::class, |
|
| 28 | 1 | ServiceNotCreatedException::class, |
|
| 29 | $serializer |
||
| 30 | 1 | ); |
|
| 31 | } |
||
| 32 | 5 | $transport = $serviceLocator->get($config['transport']); |
|
| 33 | 5 | $container = $config['container']; |
|
| 34 | 5 | $container = new $container($transport, $serializer); |
|
| 35 | |||
| 36 | 5 | if (!$container instanceof EndpointsInterface) { |
|
| 37 | 1 | throw $this->getException( |
|
| 38 | 1 | 'container', |
|
| 39 | 1 | EndpointsInterface::class, |
|
| 40 | 1 | ServiceNotCreatedException::class, |
|
| 41 | $container |
||
| 42 | 1 | ); |
|
| 43 | } |
||
| 44 | |||
| 45 | 4 | return $container; |
|
| 46 | } |
||
| 47 | |||
| 55 | } |