Passed
Push — master ( 2051c8...8e4f12 )
by Edward
05:16
created

StrictElementMatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 13
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A match() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Path\Runtime\Matcher;
5
6
use function in_array;
7
use Remorhaz\JSON\Data\Value\NodeValueInterface;
8
9
final class StrictElementMatcher implements ChildMatcherInterface
10
{
11
12
    private $indexes;
13
14 3
    public function __construct(int ...$indexes)
15
    {
16 3
        $this->indexes = $indexes;
17 3
    }
18
19 3
    public function match($address, NodeValueInterface $value, NodeValueInterface $container): bool
20
    {
21 3
        return in_array($address, $this->indexes, true);
22
    }
23
}
24