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

UnknownOperationException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

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 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