Passed
Pull Request — 1.x (#2)
by Akihito
11:09 queued 09:15
created

IsInterfaceMatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A matchesMethod() 0 3 1
A matchesClass() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\TestDouble;
6
7
use Ray\Aop\AbstractMatcher;
8
use ReflectionClass;
9
use ReflectionMethod;
10
11
use function in_array;
12
13
class IsInterfaceMatcher extends AbstractMatcher
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function matchesClass(ReflectionClass $class, array $arguments): bool
19
    {
20
        [$interface] = $arguments;
21
        $interfaces = $class->getInterfaceNames();
22
23
        return in_array($interface, $interfaces);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function matchesMethod(ReflectionMethod $method, array $arguments): bool
30
    {
31
        return true;
32
    }
33
}
34