Passed
Push — master ( 16734b...025ebf )
by Edward
03:18 queued 18s
created

OperationNotLoadedException::getIndex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Patch\Query\Exception;
5
6
use Remorhaz\JSON\Data\Value\NodeValueInterface;
7
use RuntimeException;
8
use Throwable;
9
10
final class OperationNotLoadedException extends RuntimeException implements ExceptionInterface
11
{
12
13
    private $index;
14
15
    private $patch;
16
17
    public function __construct(int $index, NodeValueInterface $patch, Throwable $previous = null)
18
    {
19
        $this->index = $index;
20
        $this->patch = $patch;
21
        parent::__construct("Failed to load operation #{$this->index} from patch", 0, $previous);
22
    }
23
24
    public function getIndex(): int
25
    {
26
        return $this->index;
27
    }
28
29
    public function getPatch(): NodeValueInterface
30
    {
31
        return $this->patch;
32
    }
33
}
34