| Conditions | 2 |
| Paths | 2 |
| Total Lines | 32 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 29 | public function __invoke(ContainerInterface $container) |
||
| 30 | { |
||
| 31 | $config = $container->get('config'); |
||
| 32 | if (!isset($config['cerberus'])) { |
||
| 33 | $storageConfig = [ |
||
| 34 | 'adapter' => [ |
||
| 35 | 'name' => 'filesystem', |
||
| 36 | 'options' => [ |
||
| 37 | 'cache_dir' => 'data/cache', |
||
| 38 | 'namespace' => 'cerberus', |
||
| 39 | ], |
||
| 40 | ], |
||
| 41 | 'plugins' => [ |
||
| 42 | // Don't throw exceptions on cache errors |
||
| 43 | 'exception_handler' => [ |
||
| 44 | 'throw_exceptions' => false, |
||
| 45 | ], |
||
| 46 | 'Serializer', |
||
| 47 | ], |
||
| 48 | ]; |
||
| 49 | $maxFailure = 5; |
||
| 50 | $timeout = 60; |
||
| 51 | } else { |
||
| 52 | $storageConfig = $config['cerberus']['storage']; |
||
| 53 | $maxFailure = (int) $config['cerberus']['max_failure']; |
||
| 54 | $timeout = (int) $config['cerberus']['timeout']; |
||
| 55 | } |
||
| 56 | |||
| 57 | $storage = StorageFactory::factory($storageConfig); |
||
| 58 | |||
| 59 | return new Cerberus($storage, $maxFailure, $timeout); |
||
| 60 | } |
||
| 61 | } |
||
| 62 |