Passed
Pull Request — master (#38)
by Rustam
02:23
created

SubclassOf   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 12
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A match() 0 3 1
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Classifier\Filter;
6
7
use ReflectionClass;
8
9
final class SubclassOf implements FilterInterface
10
{
11
    /**
12
     * @param class-string $class
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
13
     */
14 4
    public function __construct(private string $class)
15
    {
16 4
    }
17
18 6
    public function match(ReflectionClass $reflectionClass): bool
19
    {
20 6
        return $reflectionClass->isSubclassOf($this->class);
21
    }
22
}
23