ReflectionSpecificationTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A isSatisfiedBy() 0 9 2
1
<?php
2
declare(strict_types=1);
3
4
namespace FlexFqcnFinder\Filter;
5
6
use ReflectionClass;
7
use Throwable;
8
9
trait ReflectionSpecificationTrait
10
{
11
    public function isSatisfiedBy(string $class): bool
12
    {
13
        try {
14
            $reflectionClass = new ReflectionClass($class);
15
        } catch (Throwable $exception) {
16
            return false;
17
        }
18
19
        return $this->isSatisfiedByReflection($class, $reflectionClass);
20
    }
21
22
    abstract protected function isSatisfiedByReflection(string $fqcn, ReflectionClass $reflectionClass): bool;
23
}
24