1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SomeWork\Minjust; |
4
|
|
|
|
5
|
|
|
use InvalidArgumentException; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @see \SomeWork\Minjust\Tests\Unit\FindRequestTest |
9
|
|
|
*/ |
10
|
|
|
class FindRequest |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var string |
14
|
|
|
*/ |
15
|
|
|
public const FULL_NAME = 'lawyername'; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
public const REGISTER_NUMBER = 'regnumber'; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
public const CERTIFICATE_NUMBER = 'lawicard'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
public const STATUS = 'lawstatus'; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
public const FORM_OF_LEGAL_PRACTICE = 'formation'; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
public const TERRITORIAL_SUBJECT = 'lawregion'; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
public const MAX = 'max'; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
public const OFFSET = 'offset'; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var int |
54
|
|
|
*/ |
55
|
|
|
public const MAX_VALUE_MAX = 100; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var string |
59
|
|
|
*/ |
60
|
|
|
protected $fullName = ''; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var string |
64
|
|
|
*/ |
65
|
|
|
protected $registerNumber = ''; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var string |
69
|
|
|
*/ |
70
|
|
|
protected $certificateNumber = ''; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var int|null |
74
|
|
|
*/ |
75
|
|
|
protected $status; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @var int|null |
79
|
|
|
*/ |
80
|
|
|
protected $formOfLegalPractice; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @var int|null |
84
|
|
|
*/ |
85
|
|
|
protected $territorialSubject; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @var bool |
89
|
|
|
*/ |
90
|
|
|
protected $fullData = false; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @var int |
94
|
|
|
*/ |
95
|
|
|
protected $max = FindRequest::MAX_VALUE_MAX; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @var int |
99
|
|
|
*/ |
100
|
|
|
protected $offset = 0; |
101
|
|
|
|
102
|
1 |
|
public function getFormData(): array |
103
|
|
|
{ |
104
|
|
|
return [ |
105
|
1 |
|
self::FULL_NAME => $this->getFullName(), |
106
|
1 |
|
self::REGISTER_NUMBER => $this->getRegisterNumber(), |
107
|
1 |
|
self::CERTIFICATE_NUMBER => $this->getCertificateNumber(), |
108
|
1 |
|
self::STATUS => $this->getStatus(), |
109
|
1 |
|
self::FORM_OF_LEGAL_PRACTICE => $this->getFormOfLegalPractice(), |
110
|
1 |
|
self::TERRITORIAL_SUBJECT => $this->getTerritorialSubject(), |
111
|
1 |
|
self::MAX => $this->getMax(), |
112
|
1 |
|
self::OFFSET => $this->getOffset(), |
113
|
|
|
]; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @return string |
118
|
|
|
*/ |
119
|
2 |
|
public function getFullName(): string |
120
|
|
|
{ |
121
|
2 |
|
return $this->fullName; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @param string $fullName |
126
|
|
|
* |
127
|
|
|
* @return FindRequest |
128
|
|
|
*/ |
129
|
1 |
|
public function setFullName(string $fullName): FindRequest |
130
|
|
|
{ |
131
|
1 |
|
$this->fullName = $fullName; |
132
|
|
|
|
133
|
1 |
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @return string |
138
|
|
|
*/ |
139
|
2 |
|
public function getRegisterNumber(): string |
140
|
|
|
{ |
141
|
2 |
|
return $this->registerNumber; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param string $registerNumber |
146
|
|
|
* |
147
|
|
|
* @return FindRequest |
148
|
|
|
*/ |
149
|
1 |
|
public function setRegisterNumber(string $registerNumber): FindRequest |
150
|
|
|
{ |
151
|
1 |
|
$this->registerNumber = $registerNumber; |
152
|
|
|
|
153
|
1 |
|
return $this; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @return string |
158
|
|
|
*/ |
159
|
2 |
|
public function getCertificateNumber(): string |
160
|
|
|
{ |
161
|
2 |
|
return $this->certificateNumber; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @param string $certificateNumber |
166
|
|
|
* |
167
|
|
|
* @return FindRequest |
168
|
|
|
*/ |
169
|
1 |
|
public function setCertificateNumber(string $certificateNumber): FindRequest |
170
|
|
|
{ |
171
|
1 |
|
$this->certificateNumber = $certificateNumber; |
172
|
|
|
|
173
|
1 |
|
return $this; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @return int|null |
178
|
|
|
*/ |
179
|
2 |
|
public function getStatus(): ?int |
180
|
|
|
{ |
181
|
2 |
|
return $this->status; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @param int|null $status |
186
|
|
|
* |
187
|
|
|
* @return FindRequest |
188
|
|
|
*/ |
189
|
1 |
|
public function setStatus(?int $status): FindRequest |
190
|
|
|
{ |
191
|
1 |
|
$this->status = $status; |
192
|
|
|
|
193
|
1 |
|
return $this; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* @return int|null |
198
|
|
|
*/ |
199
|
2 |
|
public function getFormOfLegalPractice(): ?int |
200
|
|
|
{ |
201
|
2 |
|
return $this->formOfLegalPractice; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @param int|null $formOfLegalPractice |
206
|
|
|
* |
207
|
|
|
* @return FindRequest |
208
|
|
|
*/ |
209
|
1 |
|
public function setFormOfLegalPractice(?int $formOfLegalPractice): FindRequest |
210
|
|
|
{ |
211
|
1 |
|
$this->formOfLegalPractice = $formOfLegalPractice; |
212
|
|
|
|
213
|
1 |
|
return $this; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* @return int|null |
218
|
|
|
*/ |
219
|
2 |
|
public function getTerritorialSubject(): ?int |
220
|
|
|
{ |
221
|
2 |
|
return $this->territorialSubject; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* @param int|null $territorialSubject |
226
|
|
|
* |
227
|
|
|
* @return FindRequest |
228
|
|
|
*/ |
229
|
1 |
|
public function setTerritorialSubject(?int $territorialSubject): FindRequest |
230
|
|
|
{ |
231
|
1 |
|
$this->territorialSubject = $territorialSubject; |
232
|
|
|
|
233
|
1 |
|
return $this; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* @return int |
238
|
|
|
*/ |
239
|
2 |
|
public function getMax(): int |
240
|
|
|
{ |
241
|
2 |
|
return $this->max; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* @param int $max |
246
|
|
|
* |
247
|
|
|
* @return FindRequest |
248
|
|
|
*/ |
249
|
3 |
|
public function setMax(int $max): FindRequest |
250
|
|
|
{ |
251
|
3 |
|
if ($max < 1) { |
252
|
1 |
|
throw new InvalidArgumentException( |
253
|
1 |
|
sprintf('Minimum value for "%s" is %s', static::MAX, 1) |
254
|
|
|
); |
255
|
|
|
} |
256
|
2 |
|
if ($max > static::MAX_VALUE_MAX) { |
257
|
1 |
|
throw new InvalidArgumentException( |
258
|
1 |
|
sprintf('Maximum value for "%s" is %s', static::MAX, static::MAX_VALUE_MAX) |
259
|
|
|
); |
260
|
|
|
} |
261
|
1 |
|
$this->max = $max; |
262
|
|
|
|
263
|
1 |
|
return $this; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
/** |
267
|
|
|
* @return int |
268
|
|
|
*/ |
269
|
2 |
|
public function getOffset(): int |
270
|
|
|
{ |
271
|
2 |
|
return $this->offset; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* @param int $offset |
276
|
|
|
* |
277
|
|
|
* @return FindRequest |
278
|
|
|
*/ |
279
|
2 |
|
public function setOffset(int $offset): FindRequest |
280
|
|
|
{ |
281
|
2 |
|
if ($offset < 0) { |
282
|
1 |
|
throw new InvalidArgumentException( |
283
|
1 |
|
sprintf('Minimum value for "%s" is %s', static::OFFSET, 0) |
284
|
|
|
); |
285
|
|
|
} |
286
|
1 |
|
$this->offset = $offset; |
287
|
|
|
|
288
|
1 |
|
return $this; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* @return bool |
293
|
|
|
*/ |
294
|
1 |
|
public function isFullData(): bool |
295
|
|
|
{ |
296
|
1 |
|
return $this->fullData; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* @param bool $fullData |
301
|
|
|
* |
302
|
|
|
* @return FindRequest |
303
|
|
|
*/ |
304
|
1 |
|
public function setFullData(bool $fullData = true): FindRequest |
305
|
|
|
{ |
306
|
1 |
|
$this->fullData = $fullData; |
307
|
|
|
|
308
|
1 |
|
return $this; |
309
|
|
|
} |
310
|
|
|
} |
311
|
|
|
|