NullHandlerFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 1
f 0
dl 0
loc 13
ccs 0
cts 0
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasMonolog\Factory\Handler;
6
7
use Arp\LaminasFactory\AbstractFactory;
8
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
9
use Monolog\Handler\NullHandler;
10
use Monolog\Logger;
11
use Psr\Container\ContainerExceptionInterface;
12
use Psr\Container\ContainerInterface;
13
14
final class NullHandlerFactory extends AbstractFactory
15
{
16
    /**
17
     * @throws ServiceNotCreatedException
18
     * @throws ContainerExceptionInterface
19
     */
20
    public function __invoke(ContainerInterface $container, string $requestedName, array $options = null): NullHandler
21
    {
22
        $options = $options ?? $this->getServiceOptions($container, $requestedName);
23
24
        $level = $options['level'] ?? Logger::DEBUG;
25
26
        return new NullHandler($level);
27
    }
28
}
29