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

BuiltinMatcher::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1
Metric Value
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
crap 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