MemoryPeakUsageProcessorFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 1
cp 0
rs 10

1 Method

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