Passed
Push — master ( ccfc71...4eb344 )
by Viacheslav
15:41 queued 05:46
created

UnknownOperationException::getOperation()   A

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 Throwable;
7
8
class UnknownOperationException extends Exception
9
{
10
    /** @var object */
11
    private $operation;
12
13
    /**
14
     * @param object $operation
15
     * @param int $code
16
     * @param Throwable|null $previous
17
     */
18
    public function __construct(
19
        $operation,
20
        $code = 0,
21
        Throwable $previous = null
22
    )
23
    {
24
        // @phpstan-ignore-next-line MissingFieldOperation will be thrown if op is not set
25
        parent::__construct('Unknown "op": ' . $operation->op, $code, $previous);
26
        $this->operation = $operation;
27
    }
28
29
    /**
30
     * @return object
31
     */
32
    public function getOperation()
33
    {
34
        return $this->operation;
35
    }
36
}
37