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

BuiltinMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A matchesClass() 0 4 1
A matchesMethod() 0 4 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