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

SubclassesOfMatcher::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 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
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\Matcher;
8
9
use Ray\Aop\AbstractMatcher;
10
use Ray\Aop\Exception\InvalidAnnotationException;
11
12
class SubclassesOfMatcher extends AbstractMatcher
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 1
    public function matchesClass(\ReflectionClass $class, array $arguments)
18
    {
19 1
        list($superClass) = $arguments;
20 1
        $isSubClass = $class->isSubclassOf($superClass) || ($class->name === $superClass);
21
22 1
        return $isSubClass;
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 1
    public function matchesMethod(\ReflectionMethod $method, array $arguments)
29
    {
30 1
        throw new InvalidAnnotationException('subclassesOf is only for class match');
31
    }
32
}
33