Passed
Push — main ( 8bdffa...c425e9 )
by Vasil
04:29
created

Error::getCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

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
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy;
6
7
use JMS\Serializer\Annotation as Serializer;
8
9
/**
10
 * Class Error
11
 *
12
 * @Serializer\AccessType("public_method")
13
 * @author Vasil Dakov <[email protected]>
14
 * @copyright 2009-2022 Neutrino.bg
15
 * @version 1.0
16
 */
17
class Error
18
{
19
    /**
20
     * System generated unique error id to be used as this error reference.
21
     *
22
     * @var string
23
     * @Serializer\Type("string")
24
     */
25
    private string $id;
26
27
    /**
28
     * Message context, if associated. This refers to an item that is wrong and should be corrected.
29
     *
30
     * @var string|null
31
     * @Serializer\Type("string")
32
     */
33
    private ?string $context = null;
34
35
    /**
36
     * Error message in language specified in the request.
37
     *
38
     * @var string
39
     * @Serializer\Type("string")
40
     */
41
    private string $message;
42
43
    /**
44
     * Error code. See Appendix 3 - Error Codes for more details.
45
     *
46
     * @var int
47
     * @Serializer\Type("integer")
48
     */
49
    private int $code;
50
51
    /**
52
     * The request component, if applicable, relevant to this error in JSONPath format with dot notation.
53
     *
54
     * @var string|null
55
     * @Serializer\Type("string")
56
     */
57
    private ?string $component;
58
59
    /**
60
     * @return string
61
     */
62 1
    public function getId(): string
63
    {
64 1
        return $this->id;
65
    }
66
67
    /**
68
     * @param string $id
69
     */
70 1
    public function setId(string $id): void
71
    {
72 1
        $this->id = $id;
73
    }
74
75
    /**
76
     * @return string|null
77
     */
78 1
    public function getContext(): ?string
79
    {
80 1
        return $this->context;
81
    }
82
83
    /**
84
     * @param string|null $context
85
     */
86 1
    public function setContext(?string $context): void
87
    {
88 1
        $this->context = $context;
89
    }
90
91
    /**
92
     * @return string
93
     */
94 1
    public function getMessage(): string
95
    {
96 1
        return $this->message;
97
    }
98
99
    /**
100
     * @param string $message
101
     */
102 1
    public function setMessage(string $message): void
103
    {
104 1
        $this->message = $message;
105
    }
106
107
    /**
108
     * @return int
109
     */
110 1
    public function getCode(): int
111
    {
112 1
        return $this->code;
113
    }
114
115
    /**
116
     * @param int $code
117
     */
118 1
    public function setCode(int $code): void
119
    {
120 1
        $this->code = $code;
121
    }
122
123
    /**
124
     * @return string|null
125
     */
126 1
    public function getComponent(): ?string
127
    {
128 1
        return $this->component;
129
    }
130
131
    /**
132
     * @param string|null $component
133
     */
134 1
    public function setComponent(?string $component): void
135
    {
136 1
        $this->component = $component;
137
    }
138
}
139