Completed
Branch module_structure (3116d9)
by Pablo
02:56
created

PrePushExecuteFactory::fromArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
ccs 3
cts 3
cp 1
cc 2
eloc 4
nc 2
nop 1
crap 2
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
        ];
19
20 1
        return new Execute($tools);
21
    }
22
23
    /**
24
     * @return Execute
25
     */
26 1
    public static function setUndefined()
27
    {
28 1
        return new Execute(
29
            [
30 1
                PhpUnitFactory::setUndefined(),
31
            ]
32
        );
33
    }
34
}
35