Completed
Push — master ( b9da3c...daa7f0 )
by Viacheslav
26s queued 12s
created

InvalidFieldTypeException::getExpectedType()   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 Swaggest\JsonDiff\JsonPatch\OpPath;
7
use Throwable;
8
9
class InvalidFieldTypeException extends Exception
10
{
11
    /** @var string */
12
    private $field;
13
    /** @var string */
14
    private $expectedType;
15
    /** @var OpPath|object */
16
    private $operation;
17
18
    /**
19
     * @param string $field
20
     * @param string $expectedType
21
     * @param OpPath|object $operation
22
     * @param int $code
23
     * @param Throwable|null $previous
24
     */
25
    public function __construct(
26
        $field,
27
        $expectedType,
28
        $operation,
29
        $code = 0,
30
        Throwable $previous = null
31
    )
32
    {
33
        parent::__construct(
34
            'Invalid field type - "' . $field . '" should be of type: ' . $expectedType,
35
            $code,
36
            $previous
37
        );
38
        $this->field = $field;
39
        $this->expectedType = $expectedType;
40
        $this->operation = $operation;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getField()
47
    {
48
        return $this->field;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getExpectedType()
55
    {
56
        return $this->expectedType;
57
    }
58
59
    /**
60
     * @return OpPath|object
61
     */
62
    public function getOperation()
63
    {
64
        return $this->operation;
65
    }
66
}
67