|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* Part of the Saudi Address API PHP package. |
|
5
|
|
|
* |
|
6
|
|
|
* NOTICE OF LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* Licensed under the MIT. |
|
9
|
|
|
* |
|
10
|
|
|
* This source file is subject to the MIT License that is |
|
11
|
|
|
* bundled with this package in the LICENSE file. |
|
12
|
|
|
* |
|
13
|
|
|
* @package Saudi Address |
|
14
|
|
|
* @version 1.3 |
|
15
|
|
|
* @author Ali Alharthi |
|
16
|
|
|
* @license MIT |
|
17
|
|
|
* @copyright (c) 2020, Ali Alharthi |
|
18
|
|
|
* @link https://aalharthi.sa |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace AliAlharthi\SaudiAddress\Exception; |
|
22
|
|
|
|
|
23
|
|
|
class SaudiAddressException extends \Exception |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* The response headers sent by Saudi National Address. |
|
27
|
|
|
* |
|
28
|
|
|
* @var array |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $headers = []; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* The error code returned by Saudi National Address. |
|
34
|
|
|
* |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $errorCode; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* The error type returned by Saudi National Address. |
|
41
|
|
|
* |
|
42
|
|
|
* @var string |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $errorType; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* The missing parameter returned by Saudi National Address with the error. |
|
48
|
|
|
* |
|
49
|
|
|
* @var string |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $missingParameter; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* The raw output returned by Saudi National Address in case of exception. |
|
55
|
|
|
* |
|
56
|
|
|
* @var string |
|
57
|
|
|
*/ |
|
58
|
|
|
protected $rawOutput; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Returns the response headers sent by Saudi National Address. |
|
62
|
|
|
* |
|
63
|
|
|
* @return array |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getHeaders() |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->headers; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Sets the response headers sent by Saudi National Address. |
|
72
|
|
|
* |
|
73
|
|
|
* @param array $headers |
|
74
|
|
|
* @return $this |
|
75
|
|
|
*/ |
|
76
|
|
|
public function setHeaders(array $headers) |
|
77
|
|
|
{ |
|
78
|
|
|
$this->headers = $headers; |
|
79
|
|
|
|
|
80
|
|
|
return $this; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Returns the error type returned by Saudi National Address. |
|
85
|
|
|
* |
|
86
|
|
|
* @return string |
|
87
|
|
|
*/ |
|
88
|
|
|
public function getErrorCode() |
|
89
|
|
|
{ |
|
90
|
|
|
return $this->errorCode; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Sets the error type returned by Saudi National Address. |
|
95
|
|
|
* |
|
96
|
|
|
* @param string $errorCode |
|
97
|
|
|
* @return $this |
|
98
|
|
|
*/ |
|
99
|
|
|
public function setErrorCode($errorCode) |
|
100
|
|
|
{ |
|
101
|
|
|
$this->errorCode = $errorCode; |
|
102
|
|
|
|
|
103
|
|
|
return $this; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* Returns the error type returned by Saudi National Address. |
|
108
|
|
|
* |
|
109
|
|
|
* @return string |
|
110
|
|
|
*/ |
|
111
|
|
|
public function getErrorType() |
|
112
|
|
|
{ |
|
113
|
|
|
return $this->errorType; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* Sets the error type returned by Saudi National Address. |
|
118
|
|
|
* |
|
119
|
|
|
* @param string $errorType |
|
120
|
|
|
* @return $this |
|
121
|
|
|
*/ |
|
122
|
|
|
public function setErrorType($errorType) |
|
123
|
|
|
{ |
|
124
|
|
|
$this->errorType = $errorType; |
|
125
|
|
|
|
|
126
|
|
|
return $this; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* Returns missing parameter returned by Saudi National Address with the error. |
|
131
|
|
|
* |
|
132
|
|
|
* @return string |
|
133
|
|
|
*/ |
|
134
|
|
|
public function getMissingParameter() |
|
135
|
|
|
{ |
|
136
|
|
|
return $this->missingParameter; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* Sets the missing parameter returned by Saudi National Address with the error. |
|
141
|
|
|
* |
|
142
|
|
|
* @param string $missingParameter |
|
143
|
|
|
* @return $this |
|
144
|
|
|
*/ |
|
145
|
|
|
public function setMissingParameter($missingParameter) |
|
146
|
|
|
{ |
|
147
|
|
|
$this->missingParameter = $missingParameter; |
|
148
|
|
|
|
|
149
|
|
|
return $this; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* Returns raw output returned by Saudi National Address in case of exception. |
|
154
|
|
|
* |
|
155
|
|
|
* @return string |
|
156
|
|
|
*/ |
|
157
|
|
|
public function getRawOutput() |
|
158
|
|
|
{ |
|
159
|
|
|
return $this->rawOutput; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* Sets the raw output parameter returned by Saudi National Address in case of exception. |
|
164
|
|
|
* |
|
165
|
|
|
* @param string $rawOutput |
|
166
|
|
|
* @return $this |
|
167
|
|
|
*/ |
|
168
|
|
|
public function setRawOutput($rawOutput) |
|
169
|
|
|
{ |
|
170
|
|
|
$this->rawOutput = $rawOutput; |
|
171
|
|
|
|
|
172
|
|
|
return $this; |
|
173
|
|
|
} |
|
174
|
|
|
} |
|
175
|
|
|
|