Passed
Push — master ( ec8827...deea55 )
by Edward
02:26
created

RemoveOperation::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Patch\Operation;
5
6
use Remorhaz\JSON\Data\Value\NodeValueInterface;
7
use Remorhaz\JSON\Pointer\Processor\ProcessorInterface as PointerProcessorInterface;
8
use Remorhaz\JSON\Pointer\Query\QueryInterface as PointerQueryInterface;
9
10
final class RemoveOperation implements OperationInterface
11
{
12
13
    private $index;
14
15
    private $pathPointer;
16
17
    public function __construct(
18
        int $index,
19
        PointerQueryInterface $pathPointer
20
    ) {
21
        $this->index = $index;
22
        $this->pathPointer = $pathPointer;
23
    }
24
25
    public function apply(NodeValueInterface $input, PointerProcessorInterface $pointerProcessor): NodeValueInterface
26
    {
27
        return $pointerProcessor
28
            ->delete($this->pathPointer, $input)
29
            ->get();
30
    }
31
}
32