Passed
Branch master (025ebf)
by Edward
03:03
created

OperationNotLoadedException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
c 1
b 0
f 1
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPatch() 0 3 1
A __construct() 0 5 1
A getIndex() 0 3 1
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 6
    public function __construct(int $index, NodeValueInterface $patch, Throwable $previous = null)
18
    {
19 6
        $this->index = $index;
20 6
        $this->patch = $patch;
21 6
        parent::__construct("Failed to load operation #{$this->index} from patch", 0, $previous);
22 6
    }
23
24 1
    public function getIndex(): int
25
    {
26 1
        return $this->index;
27
    }
28
29 1
    public function getPatch(): NodeValueInterface
30
    {
31 1
        return $this->patch;
32
    }
33
}
34