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

AbstractConditionsMatcher::getMatcher()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 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
}