Completed
Push — master ( 74ffa0...ed410a )
by Mariano
10:21
created

AllConditionsMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A matches() 0 17 3
1
<?php
2
namespace Mcustiel\PowerRoute\Common\Conditions;
3
4
use Psr\Http\Message\ServerRequestInterface;
5
6
class AllConditionsMatcher extends AbstractConditionsMatcher implements ConditionsMatcherInterface
7
{
8
    /**
9
     *
10
     * {@inheritDoc}
11
     *
12
     * @see \Mcustiel\PowerRoute\Common\Conditions\ConditionsMatcherInterface::conditionsMatches()
13
     */
14 3
    public function matches(array $conditions, ServerRequestInterface $request)
15
    {
16 3
        foreach ($conditions as $condition) {
17 3
            $inputSourceData = $this->getInputSource($condition);
18 3
            $matcherData = $this->getMatcher($condition);
19
20 3
            $inputValue = $inputSourceData->getInstance()->getValue(
21 3
                $request,
22 3
                $inputSourceData->getArgument()
23 3
            );
24
25 3
            if (!$matcherData->getInstance()->match($inputValue, $matcherData->getArgument())) {
26 2
                return false;
27
            }
28 1
        }
29 1
        return true;
30
    }
31
}
32