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

StrictElementMatcher::match()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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