Conditions | 4 |
Paths | 3 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
35 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
||
36 | { |
||
37 | /** @var array $config */ |
||
38 | $config = $container->get('zf2_rollout_config'); |
||
39 | |||
40 | if (!isset($config[self::$storage_service]) || $config[self::$storage_service] === '') { |
||
41 | throw new \RuntimeException('No "' . self::$storage_service . '" defined in the rollout configuration!"'); |
||
42 | } |
||
43 | |||
44 | $storage = $container->get($config[self::$storage_service]); |
||
45 | |||
46 | if (!$storage instanceof StorageInterface) { |
||
47 | throw new \RuntimeException(sprintf('The "' . self::$storage_service . '" should be an instance of StorageInterface but was %s', |
||
48 | get_class($storage))); |
||
49 | } |
||
50 | |||
51 | return $storage; |
||
52 | } |
||
53 | } |