Passed
Pull Request — 1.x (#2)
by Akihito
01:49
created

IsInterfaceMatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A matchesClass() 0 6 1
A matchesMethod() 0 3 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
     * @codeCoverageIgnore
30
     */
31
    public function matchesMethod(ReflectionMethod $method, array $arguments): bool
32
    {
33
        return true;
34
    }
35
}
36