DateTimeHelperFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasDateTime\Factory\View\Helper;
6
7
use Arp\LaminasDateTime\View\Helper\DateTimeHelper;
8
use Arp\LaminasFactory\AbstractFactory;
9
use Psr\Container\ContainerExceptionInterface;
10
use Psr\Container\ContainerInterface;
11
12
final class DateTimeHelperFactory extends AbstractFactory
13
{
14
    /**
15
     * @throws ContainerExceptionInterface
16
     */
17
    public function __invoke(
18
        ContainerInterface $container,
19
        string $requestedName,
20
        array $options = null
21
    ): DateTimeHelper {
22
        $options = $options ?? $this->getServiceOptions($container, $requestedName, 'view_helpers');
23
24
        return new DateTimeHelper(
25
            $options['format'] ?? \DateTimeInterface::ATOM
26
        );
27
    }
28
}
29