MissingFieldException   A
last analyzed

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