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

SubclassesOfMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

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