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

LogicalOrMatcher   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 1
Metric Value
wmc 6
c 4
b 1
f 1
lcom 0
cbo 1
dl 0
loc 34
ccs 14
cts 14
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A matchesClass() 0 12 3
A matchesMethod() 0 12 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