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

AllConditionsMatcher   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 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
            $inputSource = $this->getInputSource($condition);
18 3
            $matcher = $this->getMatcher($condition);
19 3
            if (! $matcher->match($inputSource->getValue($request))) {
20 2
                return false;
21
            }
22 1
        }
23 1
        return true;
24
    }
25
}
26