Completed
Push — master ( 17bfc6...c55d38 )
by Viacheslav
28s queued 14s
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 Throwable|null $previous
26
     */
27
    public function __construct(
28
        $message,
29
        $operation,
30
        $field,
31
        $code = 0,
32
        Throwable $previous = null
33
    )
34
    {
35
        parent::__construct($message, $code, $previous);
36
        $this->operation = $operation;
37
        $this->field = $field;
38
    }
39
40
    /**
41
     * @return OpPath
42
     */
43
    public function getOperation()
44
    {
45
        return $this->operation;
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getField()
52
    {
53
        return $this->field;
54
    }
55
56
    /**
57
     * @param int $opIndex
58
     * @return $this
59
     */
60
    public function setOpIndex($opIndex)
61
    {
62
        $this->opIndex = $opIndex;
63
        return $this;
64
    }
65
66
    /**
67
     * @return int
68
     */
69
    public function getOpIndex()
70
    {
71
        return $this->opIndex;
72
    }
73
}
74