PathException   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 63
rs 10
c 1
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getField() 0 3 1
A getOpIndex() 0 3 1
A getOperation() 0 3 1
A setOpIndex() 0 4 1
A __construct() 0 11 1
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