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

IsInterfaceMatcher::matchesClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
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