Passed
Push — master ( 056350...65484c )
by Satoshi
05:02
created

PhpNativeClassesMatcher::isMatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace DependencyAnalyzer\DependencyGraph\StructuralElementPatternMatcher;
5
6
use DependencyAnalyzer\DependencyGraph\FullyQualifiedStructuralElementName\Base as FQSEN;
7
use DependencyAnalyzer\DependencyGraph\StructuralElementPatternMatcher;
8
use DependencyAnalyzer\DependencyGraph\StructuralElementPatternMatcher\Matchable;
9
10
class PhpNativeClassesMatcher implements Matchable
11
{
12
    /**
13
     * @var string[]
14
     */
15
    private $phpNativeClassNames;
16
17
    public function __construct(array $phpNativeClassNames)
18
    {
19
        $this->phpNativeClassNames = $phpNativeClassNames;
20
    }
21
22
    public function isMatch(FQSEN $target): bool
23
    {
24
        return in_array($target->toString(), $this->phpNativeClassNames);
25
    }
26
27
    public function getPattern(): string
28
    {
29
        return StructuralElementPatternMatcher::PHP_NATIVE_CLASSES;
30
    }
31
}
32