ConfigFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 19
rs 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 11 4
1
<?php
2
3
namespace PhpGitHooks\Module\Configuration\Service;
4
5
use PhpGitHooks\Module\Configuration\Domain\Config;
6
7
class ConfigFactory
8
{
9
    /**
10
     * @param array $data
11
     *
12
     * @return Config
13
     */
14 2
    public static function fromArray(array $data)
15
    {
16 2
        $preCommit = false === array_key_exists('pre-commit', $data) ?
17 2
            PreCommitFactory::setUndefined() : PreCommitFactory::fromArray($data['pre-commit']);
18 2
        $commitMsg = false === array_key_exists('commit-msg', $data) ?
19 2
            CommitMsgFactory::setUndefined() : CommitMsgFactory::fromArray($data['commit-msg']);
20 2
        $prePush = false === array_key_exists('pre-push', $data) ?
21 2
            PrePushFactory::setUndefined() : PrePushFactory::fromArray($data['pre-push']);
22
23 2
        return new Config($preCommit, $commitMsg, $prePush);
24
    }
25
}
26