Completed
Push — 2.x ( f4d395...7b2fb1 )
by Akihito
9s
created

BuiltinMatcher::matchesMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
nc 1
cc 1
eloc 2
nop 2
crap 1
1
<?php
2
/**
3
 * This file is part of the Ray.Aop package
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace Ray\Aop;
8
9
class BuiltinMatcher extends AbstractMatcher
10
{
11
    /**
12
     * @var string
13
     */
14
    private $matcherName;
15
16
    /**
17
     * @var AbstractMatcher
18
     */
19
    private $matcher;
20
21
    /**
22
     * @param string $matcherName
23
     * @param array  $arguments
24
     */
25 34
    public function __construct($matcherName, array $arguments)
26
    {
27 34
        parent::__construct();
28 34
        $this->matcherName = $matcherName;
29 34
        $this->arguments = $arguments;
30 34
        $matcher = 'Ray\Aop\Matcher\\' . ucwords($this->matcherName) . 'Matcher';
31 34
        $this->matcher = (new \ReflectionClass($matcher))->newInstance();
32 34
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 29
    public function matchesClass(\ReflectionClass $class, array $arguments)
38
    {
39 29
        return $this->matcher->matchesClass($class, $arguments);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 31
    public function matchesMethod(\ReflectionMethod $method, array $arguments)
46
    {
47 31
        return $this->matcher->matchesMethod($method, $arguments);
48
    }
49
}
50