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

PhpNativeClassesMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPattern() 0 3 1
A __construct() 0 3 1
A isMatch() 0 3 1
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