Passed
Branch develop (905d13)
by Mariano
09:27
created

AbstractConditionsMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 2
cbo 2
dl 0
loc 27
ccs 13
cts 13
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getInputSource() 0 6 1
A getMatcher() 0 6 1
1
<?php
2
namespace Mcustiel\PowerRoute\Common\Conditions;
3
4
use Mcustiel\PowerRoute\Common\Factories\InputSourceFactory;
5
use Mcustiel\PowerRoute\Common\Factories\MatcherFactory;
6
use Mcustiel\PowerRoute\PowerRoute;
7
use Mcustiel\PowerRoute\Common\ConfigOptions;
8
9
abstract class AbstractConditionsMatcher
10
{
11
    private $inputSouceFactory;
12
    private $matcherFactory;
13
14 3
    public function __construct(
15
        InputSourceFactory $inputSouceFactory,
16
        MatcherFactory $matcherFactory
17
    ) {
18 3
        $this->inputSouceFactory = $inputSouceFactory;
19 3
        $this->matcherFactory = $matcherFactory;
20 3
    }
21
22 3
    protected function getInputSource(array $condition)
23 2
    {
24 3
        return $this->inputSouceFactory->createFromConfig(
25 3
            $condition[ConfigOptions::CONFIG_NODE_CONDITION_SOURCE]
26 3
        );
27
    }
28
29 3
    protected function getMatcher(array $condition)
30
    {
31 3
        return $this->matcherFactory->createFromConfig(
32 3
            $condition[ConfigOptions::CONFIG_NODE_CONDITION_MATCHER]
33 3
        );
34
    }
35
}