Passed
Pull Request — master (#7)
by Alex
07:26
created

DateTimeFactoryFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 3
c 1
b 0
f 0
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\DateTime\Factory;
6
7
use Arp\DateTime\DateIntervalFactory;
8
use Arp\DateTime\DateTimeFactory;
9
use Arp\Factory\FactoryInterface;
10
11
/**
12
 * @author  Alex Patterson <[email protected]>
13
 * @package Arp\DateTime\Factory
14
 */
15
final class DateTimeFactoryFactory implements FactoryInterface
16
{
17
    /**
18
     * @param array $config
19
     *
20
     * @return DateTimeFactory
21
     */
22
    public function create(array $config = []): DateTimeFactory
23
    {
24
        $intervalFactory = $config['interval_factory'] ?? new DateIntervalFactory();
25
26
        return new DateTimeFactory($intervalFactory);
27
    }
28
}
29