UnknownOperationException::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\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