Passed
Pull Request — master (#7)
by Alex
01:51
created

DateTimeImmutableFactoryFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\DateTime\Factory;
6
7
use Arp\DateTime\DateTimeFactory;
8
use Arp\Factory\Exception\FactoryException;
9
use Arp\Factory\FactoryInterface;
10
11
/**
12
 * @author  Alex Patterson <[email protected]>
13
 * @package Arp\DateTime\Factory
14
 */
15
final class DateTimeImmutableFactoryFactory implements FactoryInterface
16
{
17
    /**
18
     * @param array $config
19
     *
20
     * @return DateTimeFactory
21
     *
22
     * @throws FactoryException
23
     */
24
    public function create(array $config = []): DateTimeFactory
25
    {
26
        $config = array_replace_recursive(
27
            $config,
28
            ['date_time_class_name' => \DateTimeImmutable::class]
29
        );
30
31
        return (new DateTimeFactoryFactory())->create($config);
32
    }
33
}
34