PatchTestOperationFailedException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 40
rs 10
wmc 3

3 Methods

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