Completed
Branch 2.x (867c01)
by Akihito
09:30
created

LogicalOrMatcher::matchesMethod()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 9.4285
cc 3
eloc 6
nc 3
nop 2
crap 3
1
<?php
2
/**
3
 * This file is part of the Ray.Aop package
4
 *
5
 * @license http://opensource.org/licenses/bsd-license.php BSD
6
 */
7
namespace Ray\Aop\Matcher;
8
9
use Ray\Aop\AbstractMatcher;
10
11
class LogicalOrMatcher extends AbstractMatcher
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 4
    public function matchesClass(\ReflectionClass $class, array $arguments)
17
    {
18 4
        foreach ($arguments as $matcher) {
19
            /* @var $matcher AbstractMatcher */
20 4
            $isMatch =  $matcher->matchesClass($class, $matcher->getArguments());
21 4
            if ($isMatch === true) {
22 3
                return true;
23
            }
24 2
        }
25
26 1
        return false;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 3
    public function matchesMethod(\ReflectionMethod $method, array $arguments)
33
    {
34 3
        foreach ($arguments as $matcher) {
35
            /* @var $matcher AbstractMatcher */
36 3
            $isMatch = $matcher->matchesMethod($method, $matcher->getArguments());
37 3
            if ($isMatch === true) {
38 2
                return true;
39
            }
40 2
        }
41
42 1
        return false;
43
    }
44
}
45