PrePushExecuteFactory::setUndefined()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
ccs 5
cts 5
cp 1
cc 1
nc 1
nop 0
crap 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