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

MissingFieldException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 39
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMissingField() 0 3 1
A __construct() 0 10 1
A getOperation() 0 3 1
1
<?php
2
3
namespace Swaggest\JsonDiff;
4
5
use Throwable;
6
7
class MissingFieldException extends Exception
8
{
9
    /** @var string */
10
    private $missingField;
11
    /** @var object */
12
    private $operation;
13
14
    /**
15
     * @param string $missingField
16
     * @param object $operation
17
     * @param int $code
18
     * @param Throwable|null $previous
19
     */
20
    public function __construct(
21
        $missingField,
22
        $operation,
23
        $code = 0,
24
        Throwable $previous = null
25
    )
26
    {
27
        parent::__construct('Missing "' . $missingField . '" in operation data', $code, $previous);
28
        $this->missingField = $missingField;
29
        $this->operation = $operation;
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function getMissingField()
36
    {
37
        return $this->missingField;
38
    }
39
40
    /**
41
     * @return object
42
     */
43
    public function getOperation()
44
    {
45
        return $this->operation;
46
    }
47
}
48