Passed
Push — master ( 531553...9683f3 )
by Edward
04:25
created

DeletePropertyMutation::reset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Pointer\Processor\Mutator;
5
6
use Iterator;
7
use Remorhaz\JSON\Data\Event\EventInterface;
8
use Remorhaz\JSON\Data\Path\PathInterface;
9
use Remorhaz\JSON\Data\Walker\MutationInterface;
10
use Remorhaz\JSON\Data\Walker\ValueWalkerInterface;
11
12
final class DeletePropertyMutation implements MutationInterface
13
{
14
15
    private $path;
16
17
    public function __construct(PathInterface $path)
18
    {
19
        $this->path = $path;
20
    }
21
22
    public function __invoke(EventInterface $event, ValueWalkerInterface $valueWalker): Iterator
23
    {
24
        if ($this->path->contains($event->getPath())) {
25
            return;
26
        }
27
        yield $event;
28
    }
29
30
    public function reset(): void
31
    {
32
    }
33
}
34