HtmlFormatterFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasMonolog\Factory\Formatter;
6
7
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
8
use Monolog\Formatter\HtmlFormatter;
9
use Psr\Container\ContainerExceptionInterface;
10
use Psr\Container\ContainerInterface;
11
12
final class HtmlFormatterFactory extends AbstractNormalizerFormatterFactory
13
{
14
    /**
15
     * @throws ServiceNotCreatedException
16
     * @throws ContainerExceptionInterface
17
     */
18
    public function __invoke(ContainerInterface $container, string $requestedName, array $options = null): HtmlFormatter
19
    {
20
        $options = $options ?? $this->getServiceOptions($container, $requestedName);
21
22
        $formatter = new HtmlFormatter(
23
            $options['date_format'] ?? null
24
        );
25
26
        $this->configureNormalizerFormatter($formatter, $options);
27
        return $formatter;
28 2
    }
29
}
30