Conditions | 6 |
Paths | 24 |
Total Lines | 25 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 6 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
16 | 1 | public function addToContainer(Container $c) |
|
17 | { |
||
18 | 1 | if ($c->has('display_errors')) { |
|
19 | 1 | ini_set('display_errors', (string) $c->get('display_errors')); |
|
20 | } |
||
21 | |||
22 | 1 | if ($c->has('error_reporting')) { |
|
23 | 1 | error_reporting($c->get('error_reporting')); |
|
24 | } |
||
25 | |||
26 | 1 | if ($c->has('error_log')) { |
|
27 | 1 | $errorLog = $c->get('error_log'); |
|
28 | 1 | if (!file_exists($errorLog)) { |
|
29 | 1 | file_put_contents($errorLog, ''); |
|
30 | 1 | chmod($errorLog, 0775); |
|
31 | } |
||
32 | 1 | ini_set('error_log', $errorLog); |
|
33 | } |
||
34 | |||
35 | 1 | if ($c->has('log')) { |
|
36 | $c[LoggerInterface::class] = $c->factory(function (Container $c) { |
||
37 | 1 | $config = $c->get('log'); |
|
38 | 1 | $loggerFactory = new LoggerFactory(); |
|
39 | |||
40 | 1 | return $loggerFactory->createLoggers($config); |
|
41 | 1 | }); |
|
45 |