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

StartsWithMatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A matchesClass() 0 6 1
A matchesMethod() 0 6 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
11
class StartsWithMatcher extends AbstractMatcher
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 5
    public function matchesClass(\ReflectionClass $class, array $arguments)
17
    {
18 5
        list($startsWith) = $arguments;
19
20 5
        return (strpos($class->name, $startsWith) === 0);
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26 31
    public function matchesMethod(\ReflectionMethod $method, array $arguments)
27
    {
28 31
        list($startsWith) = $arguments;
29
30 31
        return (strpos($method->name, $startsWith) === 0);
31
    }
32
}
33