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

OneConditionMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

1 Method

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