PatchTestOperationFailedException::getOperation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Swaggest\JsonDiff;
4
5
6
use Swaggest\JsonDiff\JsonPatch\Test;
7
use Throwable;
8
9
class PatchTestOperationFailedException extends Exception
10
{
11
    /** @var Test */
12
    private $operation;
13
    /** @var mixed */
14
    private $actualValue;
15
16
    /**
17
     * @param Test $operation
18
     * @param mixed $actualValue
19
     * @param int $code
20
     * @param Throwable|null $previous
21
     */
22
    public function __construct(
23
        $operation,
24
        $actualValue,
25
        $code = 0,
26
        ?Throwable $previous = null
27
    )
28
    {
29
        parent::__construct('Test operation ' . json_encode($operation, JSON_UNESCAPED_SLASHES)
30
            . ' failed: ' . json_encode($actualValue), $code, $previous);
31
        $this->operation = $operation;
32
        $this->actualValue = $actualValue;
33
    }
34
35
    /**
36
     * @return Test
37
     */
38
    public function getOperation()
39
    {
40
        return $this->operation;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46
    public function getActualValue()
47
    {
48
        return $this->actualValue;
49
    }
50
}
51