PhpCsFixerFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 5
dl 0
loc 30
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 9 2
A setUndefined() 0 9 1
1
<?php
2
3
namespace PhpGitHooks\Module\Configuration\Service;
4
5
use PhpGitHooks\Module\Configuration\Domain\Enabled;
6
use PhpGitHooks\Module\Configuration\Domain\PhpCsFixer;
7
use PhpGitHooks\Module\Configuration\Domain\PhpCsFixerOptions;
8
use PhpGitHooks\Module\Configuration\Domain\Undefined;
9
10
class PhpCsFixerFactory
11
{
12
    /**
13
     * @param array $data
14
     *
15
     * @return PhpCsFixer
16
     */
17 1
    public static function fromArray(array $data)
18
    {
19 1
        return new PhpCsFixer(
20 1
            new Undefined(false),
21 1
            new Enabled($data['enabled']),
22 1
            PhpCsFixerLevelsFactory::fromArray($data['levels']),
23 1
            new PhpCsFixerOptions(isset($data['options']) ? $data['options'] : null)
24
        );
25
    }
26
27
    /**
28
     * @return PhpCsFixer
29
     */
30 3
    public static function setUndefined()
31
    {
32 3
        return new PhpCsFixer(
33 3
            new Undefined(true),
34 3
            new Enabled(false),
35 3
            PhpCsFixerLevelsFactory::setUndefined(),
36 3
            new PhpCsFixerOptions(null)
37
        );
38
    }
39
}
40