Passed
Push — master ( bff9c8...c1feec )
by Nils
02:07
created

FormatFactory::from()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Leankoala\HealthFoundation\Config;
4
5
use Leankoala\HealthFoundation\Result\Format\Ietf\IetfFormat;
6
use PhmLabs\Components\Init\Init;
7
8
class FormatFactory
9
{
10
    /**
11
     * @param $configArray
12
     * @return IetfFormat
13
     */
14
    public static function from($configArray)
15
    {
16
        if (array_key_exists('format', $configArray)) {
17
            $format = Init::initialize($configArray['format']);
18
        } else {
19
            $format = new IetfFormat();
20
        }
21
22
        return $format;
23
    }
24
}
25