UnknownOperationException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 2
b 0
f 0
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getOperation() 0 3 1
A __construct() 0 9 1
1
<?php
2
3
namespace Swaggest\JsonDiff;
4
5
6
use Swaggest\JsonDiff\JsonPatch\OpPath;
7
use Throwable;
8
9
class UnknownOperationException extends Exception
10
{
11
    /** @var OpPath|object */
12
    private $operation;
13
14
    /**
15
     * @param OpPath|object $operation
16
     * @param int $code
17
     * @param Throwable|null $previous
18
     */
19
    public function __construct(
20
        $operation,
21
        $code = 0,
22
        ?Throwable $previous = null
23
    )
24
    {
25
        // @phpstan-ignore-next-line MissingFieldOperation will be thrown if op is not set
26
        parent::__construct('Unknown "op": ' . $operation->op, $code, $previous);
27
        $this->operation = $operation;
28
    }
29
30
    /**
31
     * @return OpPath|object
32
     */
33
    public function getOperation()
34
    {
35
        return $this->operation;
36
    }
37
}
38