Passed
Pull Request — master (#1)
by Alex
08:35
created

UidProcessorFactory::__invoke()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 4
cp 0
rs 10
cc 2
nc 1
nop 3
crap 6
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\UidProcessor;
10
use Psr\Container\ContainerInterface;
11
12
/**
13
 * @author  Alex Patterson <[email protected]>
14
 * @package Arp\LaminasMonolog\Factory\Processor
15
 */
16
final class UidProcessorFactory extends AbstractFactory
17
{
18
    /**
19
     * @param ContainerInterface $container
20
     * @param string             $requestedName
21
     * @param array<mixed>|null  $options
22
     *
23
     * @return UidProcessor
24
     *
25
     * @throws ServiceNotCreatedException
26
     */
27
    public function __invoke(ContainerInterface $container, string $requestedName, array $options = null): UidProcessor
28
    {
29
        $options = $options ?? $this->getServiceOptions($container, $requestedName);
30
31
        return new UidProcessor(
32
            isset($options['length']) ? (int)$options['length'] : 7
33
        );
34
    }
35
}
36