Passed
Pull Request — master (#68)
by
unknown
08:29
created

PathException::getOpIndex()   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 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Swaggest\JsonDiff;
4
5
6
use Swaggest\JsonDiff\JsonPatch\OpPath;
7
use Throwable;
8
9
class PathException extends Exception
10
{
11
    /** @var OpPath */
12
    private $operation;
13
14
    /** @var string */
15
    private $field;
16
17
    /** @var int */
18
    private $opIndex;
19
20
    /**
21
     * @param string $message
22
     * @param OpPath $operation
23
     * @param string $field
24
     * @param int $code
25
     * @param int $opIndex
26
     * @param Throwable|null $previous
27
     */
28
    public function __construct(
29
        $message,
30
        $operation,
31
        $field,
32
        $code = 0,
33
        $opIndex,
34
        Throwable $previous = null
35
    )
36
    {
37
        parent::__construct($message, $code, $previous);
38
        $this->operation = $operation;
39
        $this->field = $field;
40
        $this->opIndex = $opIndex;
41
    }
42
43
    /**
44
     * @return OpPath
45
     */
46
    public function getOperation()
47
    {
48
        return $this->operation;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getField()
55
    {
56
        return $this->field;
57
    }
58
59
    /**
60
     * @return int
61
     */
62
    public function getOpIndex(): int
63
    {
64
        return $this->opIndex;
65
    }
66
}
67