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

BuiltinMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A matchesClass() 0 4 1
A matchesMethod() 0 4 1
A __construct() 0 7 1
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;
8
9
class BuiltinMatcher extends AbstractMatcher
10
{
11
    /**
12
     * @var array
13
     */
14
    protected $arguments;
15
16
    /**
17
     * @var string
18
     */
19
    private $matcherName;
20
21
    /**
22
     * @var AbstractMatcher
23
     */
24
    private $matcher;
25
26
    /**
27
     * @param string $matcherName
28
     * @param array  $arguments
29
     */
30 34
    public function __construct($matcherName, array $arguments)
31
    {
32 34
        $this->matcherName = $matcherName;
33 34
        $this->arguments = $arguments;
34 34
        $matcher = 'Ray\Aop\Matcher\\' . ucwords($this->matcherName) . 'Matcher';
35 34
        $this->matcher = (new \ReflectionClass($matcher))->newInstance();
36 34
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41 29
    public function matchesClass(\ReflectionClass $class, array $arguments)
42
    {
43 29
        return $this->matcher->matchesClass($class, $arguments);
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49 31
    public function matchesMethod(\ReflectionMethod $method, array $arguments)
50
    {
51 31
        return $this->matcher->matchesMethod($method, $arguments);
52
    }
53
}
54