1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Prozorov\DataVerification\Models; |
||
6 | |||
7 | use Prozorov\DataVerification\Contracts\VerificationDataInterface; |
||
0 ignored issues
–
show
|
|||
8 | use Prozorov\DataVerification\App\Configuration; |
||
0 ignored issues
–
show
The type
Prozorov\DataVerification\App\Configuration was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
9 | use Prozorov\DataVerification\Types\Address; |
||
10 | use Datetime; |
||
11 | |||
12 | class Code |
||
13 | { |
||
14 | /** |
||
15 | * @var integer $id |
||
16 | */ |
||
17 | protected $id = 0; |
||
18 | |||
19 | /** |
||
20 | * @var string|null $verificationCode |
||
21 | */ |
||
22 | protected $verificationCode; |
||
23 | |||
24 | /** |
||
25 | * @var string|null $pass |
||
26 | */ |
||
27 | protected $pass; |
||
28 | |||
29 | /** |
||
30 | * @var Address $address |
||
31 | */ |
||
32 | protected $address; |
||
33 | |||
34 | /** |
||
35 | * @var array $verificationData |
||
36 | */ |
||
37 | protected $verificationData = []; |
||
38 | |||
39 | /** |
||
40 | * @var integer $attempts |
||
41 | */ |
||
42 | protected $attempts = 0; |
||
43 | |||
44 | /** |
||
45 | * @var bool $validated |
||
46 | */ |
||
47 | protected $validated = false; |
||
48 | |||
49 | /** |
||
50 | * @var DateTime $createdAt |
||
51 | */ |
||
52 | protected $createdAt; |
||
53 | |||
54 | /** |
||
55 | * @var string $addressType |
||
56 | */ |
||
57 | protected $addressType; |
||
58 | |||
59 | 14 | public function __construct(array $data = []) |
|
60 | { |
||
61 | 14 | if (empty($data)) { |
|
62 | 11 | return; |
|
63 | } |
||
64 | |||
65 | 3 | $this->id = $data['ID'] ?? 0; |
|
66 | 3 | $this->createdAt = $data['CREATED_AT'] ?? new DateTime(); |
|
67 | 3 | $this->verificationCode = (string) ($data['VERIFICATION_CODE'] ?? null); |
|
68 | 3 | $this->pass = (string) ($data['PASS'] ?? null); |
|
69 | 3 | $this->attempts = $data['ATTEMPTS'] ?? 0; |
|
70 | 3 | $this->validated = (isset($data['VALIDATED']) && $data['VALIDATED'] === 'Y') ? true : false; |
|
71 | 3 | $this->verificationData = $data['DATA'] ?? []; |
|
72 | |||
73 | 3 | $this->addressType = $data['ADDRESS_TYPE'] ?? Address::class; |
|
74 | |||
75 | 3 | $address = (string) ($data['ADDRESS'] ?? ''); |
|
76 | |||
77 | 3 | $this->address = new $this->addressType($address); |
|
78 | 3 | } |
|
79 | |||
80 | /** |
||
81 | * Get the value of id |
||
82 | * |
||
83 | * @access public |
||
84 | * @return int |
||
85 | */ |
||
86 | 1 | public function getId(): int |
|
87 | { |
||
88 | 1 | return $this->id; |
|
89 | } |
||
90 | |||
91 | /** |
||
92 | * Set the value of id |
||
93 | * |
||
94 | * @access public |
||
95 | * @param int $id |
||
96 | * @return Code |
||
97 | */ |
||
98 | public function setId(int $id): Code |
||
99 | { |
||
100 | $this->id = $id; |
||
101 | |||
102 | return $this; |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * getCreatedAt. |
||
107 | * |
||
108 | * @access public |
||
109 | * @return Datetime |
||
110 | */ |
||
111 | public function getCreatedAt(): Datetime |
||
112 | { |
||
113 | if (empty($this->createdAt)) { |
||
114 | $this->createdAt = new Datetime(); |
||
115 | } |
||
116 | |||
117 | return $this->createdAt; |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * setCreatedAt. |
||
122 | * |
||
123 | * @access public |
||
124 | * @param Datetime $datetime |
||
125 | * @return Code |
||
126 | */ |
||
127 | public function setCreatedAt(Datetime $datetime): Code |
||
128 | { |
||
129 | $this->createdAt = $datetime; |
||
130 | |||
131 | return $this; |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * isNew. |
||
136 | * |
||
137 | * @access public |
||
138 | * @return bool |
||
139 | */ |
||
140 | 1 | public function isNew(): bool |
|
141 | { |
||
142 | 1 | return $this->id <= 0; |
|
143 | } |
||
144 | |||
145 | /** |
||
146 | * getVerificationCode. |
||
147 | * |
||
148 | * @access public |
||
149 | * @return string |
||
150 | */ |
||
151 | 2 | public function getVerificationCode(): string |
|
152 | { |
||
153 | 2 | return $this->verificationCode; |
|
0 ignored issues
–
show
|
|||
154 | } |
||
155 | |||
156 | /** |
||
157 | * setVerificationCode. |
||
158 | * |
||
159 | * @access public |
||
160 | * @param string $code |
||
161 | * @return Code |
||
162 | */ |
||
163 | 5 | public function setVerificationCode(string $code): Code |
|
164 | { |
||
165 | 5 | $this->verificationCode = $code; |
|
166 | |||
167 | 5 | return $this; |
|
168 | } |
||
169 | |||
170 | /** |
||
171 | * getOneTimePass. |
||
172 | * |
||
173 | * @access public |
||
174 | * @return string |
||
175 | */ |
||
176 | 10 | public function getOneTimePass(): string |
|
177 | { |
||
178 | 10 | return $this->pass; |
|
0 ignored issues
–
show
|
|||
179 | } |
||
180 | |||
181 | /** |
||
182 | * setOneTimePass. |
||
183 | * |
||
184 | * @access public |
||
185 | * @param string $pass |
||
186 | * @return Code |
||
187 | */ |
||
188 | 9 | public function setOneTimePass(string $pass): Code |
|
189 | { |
||
190 | 9 | $this->pass = $pass; |
|
191 | |||
192 | 9 | return $this; |
|
193 | } |
||
194 | |||
195 | /** |
||
196 | * getAddress. |
||
197 | * |
||
198 | * @access public |
||
199 | * @return Address |
||
200 | */ |
||
201 | 1 | public function getAddress(): Address |
|
202 | { |
||
203 | 1 | if (empty($this->address)) { |
|
204 | throw new \InvalidArgumentException('Адрес не установлен'); |
||
205 | } |
||
206 | |||
207 | 1 | return $this->address; |
|
208 | } |
||
209 | |||
210 | /** |
||
211 | * setAddress. |
||
212 | * |
||
213 | * @access public |
||
214 | * @param Address $address |
||
215 | * @return Code |
||
216 | */ |
||
217 | 5 | public function setAddress(Address $address): Code |
|
218 | { |
||
219 | 5 | $this->address = $address; |
|
220 | 5 | $this->addressType = get_class($address); |
|
221 | |||
222 | 5 | return $this; |
|
223 | } |
||
224 | |||
225 | /** |
||
226 | * getVerificationData. |
||
227 | * |
||
228 | * @access public |
||
229 | * @return array |
||
230 | */ |
||
231 | 5 | public function getVerificationData(): array |
|
232 | { |
||
233 | 5 | return $this->verificationData; |
|
234 | } |
||
235 | |||
236 | /** |
||
237 | * setVerificationData. |
||
238 | * |
||
239 | * @access public |
||
240 | * @param array $data |
||
241 | * @return Code |
||
242 | */ |
||
243 | 5 | public function setVerificationData(array $data): Code |
|
244 | { |
||
245 | 5 | $this->verificationData = $data; |
|
246 | |||
247 | 5 | return $this; |
|
248 | } |
||
249 | |||
250 | /** |
||
251 | * getAttempts. |
||
252 | * |
||
253 | * @access public |
||
254 | * @return int |
||
255 | */ |
||
256 | 5 | public function getAttempts(): int |
|
257 | { |
||
258 | 5 | return $this->attempts; |
|
259 | } |
||
260 | |||
261 | /** |
||
262 | * setAttempts. |
||
263 | * |
||
264 | * @access public |
||
265 | * @param int $attempts |
||
266 | * @return Code |
||
267 | */ |
||
268 | 1 | public function setAttempts(int $attempts): Code |
|
269 | { |
||
270 | 1 | $this->attempts = $attempts; |
|
271 | |||
272 | 1 | return $this; |
|
273 | } |
||
274 | |||
275 | /** |
||
276 | * incrementAttempts. |
||
277 | * |
||
278 | * @access public |
||
279 | * @return Code |
||
280 | */ |
||
281 | 2 | public function incrementAttempts(): Code |
|
282 | { |
||
283 | 2 | $this->attempts++; |
|
284 | |||
285 | 2 | return $this; |
|
286 | } |
||
287 | |||
288 | /** |
||
289 | * isValidated. |
||
290 | * |
||
291 | * @access public |
||
292 | * @return bool |
||
293 | */ |
||
294 | 2 | public function isValidated(): bool |
|
295 | { |
||
296 | 2 | return $this->validated; |
|
297 | } |
||
298 | |||
299 | /** |
||
300 | * setValidated. |
||
301 | * |
||
302 | * @access public |
||
303 | * @return Code |
||
304 | */ |
||
305 | 2 | public function setValidated(): Code |
|
306 | { |
||
307 | 2 | $this->validated = true; |
|
308 | |||
309 | 2 | return $this; |
|
310 | } |
||
311 | |||
312 | /** |
||
313 | * Get $addressType |
||
314 | * |
||
315 | * @return string |
||
316 | */ |
||
317 | public function getAddressType() |
||
318 | { |
||
319 | return $this->addressType; |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * Set $addressType |
||
324 | * |
||
325 | * @param string $addressType $addressType |
||
326 | * |
||
327 | * @return self |
||
328 | */ |
||
329 | public function setAddressType(string $addressType) |
||
330 | { |
||
331 | $this->addressType = $addressType; |
||
332 | |||
333 | return $this; |
||
334 | } |
||
335 | } |
||
336 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths