PrePushExecuteFactory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 4
dl 0
loc 36
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 14 4
A setUndefined() 0 10 1
1
<?php
2
3
namespace PhpGitHooks\Module\Configuration\Service;
4
5
use PhpGitHooks\Module\Configuration\Domain\Execute;
6
7
class PrePushExecuteFactory
8
{
9
    /**
10
     * @param array $data
11
     *
12
     * @return Execute
13
     */
14 1
    public static function fromArray(array $data)
15
    {
16
        $tools = [
17 1
            isset($data['phpunit']) ? PhpUnitFactory::fromArray($data['phpunit']) : PhpUnitFactory::setUndefined(),
18 1
            isset($data['phpunit']['strict-coverage']) ? PhpUnitStrictCoverageFactory::fromArray(
19 1
                $data['phpunit']['strict-coverage']
20 1
            ) : PhpUnitStrictCoverageFactory::setUndefined(),
21 1
            isset($data['phpunit']['guard-coverage']) ? PhpUnitGuardCoverageFactory::build(
22 1
                $data['phpunit']['guard-coverage']
23 1
            ) : PhpUnitGuardCoverageFactory::setUndefined(),
24
        ];
25
26 1
        return new Execute($tools);
27
    }
28
29
    /**
30
     * @return Execute
31
     */
32 1
    public static function setUndefined()
33
    {
34 1
        return new Execute(
35
            [
36 1
                PhpUnitFactory::setUndefined(),
37 1
                PhpUnitStrictCoverageFactory::setUndefined(),
38 1
                PhpUnitGuardCoverageFactory::setUndefined(),
39
            ]
40
        );
41
    }
42
}
43