Passed
Push — master ( b12585...f9c1cd )
by Edward
02:38
created

ValueWalker::createEventIterator()   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 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Data\Walker;
5
6
use Iterator;
7
use Remorhaz\JSON\Data\Path\PathInterface;
8
use Remorhaz\JSON\Data\Value\NodeValueInterface;
9
10
final class ValueWalker implements ValueWalkerInterface
11
{
12
13
    public function createEventIterator(NodeValueInterface $value, PathInterface $path): Iterator
14
    {
15
        return (new EventGenerator($value, $path))();
16
    }
17
18
    public function createMutableEventIterator(
19
        NodeValueInterface $value,
20
        PathInterface $path,
21
        MutationInterface $modifier
22
    ): Iterator {
23
        foreach ($this->createEventIterator($value, $path) as $event) {
24
            yield from $modifier($event, $this);
25
        }
26
    }
27
}
28