Conditions | 3 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function __invoke( |
||
21 | ContainerInterface $container, |
||
22 | string $requestedName, |
||
23 | array $options = null |
||
24 | ): SyslogHandler { |
||
25 | $options = $options ?? $this->getServiceOptions($container, $requestedName); |
||
26 | |||
27 | $ident = $options['ident'] ?? ''; |
||
28 | if (empty($ident)) { |
||
29 | throw new ServiceNotCreatedException( |
||
30 | sprintf('The required \'ident\' configuration option is missing for service \'%s\'', $requestedName) |
||
31 | ); |
||
32 | } |
||
33 | |||
34 | return new SyslogHandler( |
||
35 | $ident, |
||
36 | $options['facility'] ?? LOG_USER, |
||
37 | $options['level'] ?? Logger::DEBUG, |
||
38 | !isset($options['bubble']) || (bool)$options['bubble'], |
||
39 | $options['logopts'] ?? LOG_PID |
||
40 | ); |
||
43 |