| Conditions | 4 |
| Paths | 8 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 34 | public function __invoke(ContainerInterface $container) |
|
| 21 | { |
||
| 22 | 34 | $config = $container->has('config') ? $container->get('config') : []; |
|
| 23 | 34 | $loggerConfig = $config['logger'] ?? []; |
|
| 24 | |||
| 25 | 34 | $logger = new Logger('app'); |
|
| 26 | |||
| 27 | 34 | if (!empty($loggerConfig)) { |
|
| 28 | 34 | $this->addHandlers($logger, $loggerConfig, $container); |
|
| 29 | } |
||
| 30 | |||
| 31 | 34 | if (!$logger->getHandlers()) { |
|
| 32 | // add default handler |
||
| 33 | 1 | $baseHandler = new StreamHandler('data/log/app.log'); |
|
| 34 | 1 | $logger->pushHandler($baseHandler); |
|
| 35 | } |
||
| 36 | |||
| 37 | 34 | return $logger; |
|
| 38 | } |
||
| 39 | |||
| 54 |