Total Complexity | 42 |
Total Lines | 336 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like SkybillInformationResult often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SkybillInformationResult, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
17 | class SkybillInformationResult extends AbstractStructBase |
||
18 | { |
||
19 | /** |
||
20 | * The errorCode |
||
21 | * @var int|null |
||
22 | */ |
||
23 | protected ?int $errorCode = null; |
||
24 | /** |
||
25 | * The errorMessage |
||
26 | * Meta information extracted from the WSDL |
||
27 | * - minOccurs: 0 |
||
28 | * @var string|null |
||
29 | */ |
||
30 | protected ?string $errorMessage = null; |
||
31 | /** |
||
32 | * The eventCode |
||
33 | * Meta information extracted from the WSDL |
||
34 | * - minOccurs: 0 |
||
35 | * @var string|null |
||
36 | */ |
||
37 | protected ?string $eventCode = null; |
||
38 | /** |
||
39 | * The eventDate |
||
40 | * Meta information extracted from the WSDL |
||
41 | * - minOccurs: 0 |
||
42 | * @var string|null |
||
43 | */ |
||
44 | protected ?string $eventDate = null; |
||
45 | /** |
||
46 | * The eventLibelle |
||
47 | * Meta information extracted from the WSDL |
||
48 | * - minOccurs: 0 |
||
49 | * @var string|null |
||
50 | */ |
||
51 | protected ?string $eventLibelle = null; |
||
52 | /** |
||
53 | * The eventSite |
||
54 | * Meta information extracted from the WSDL |
||
55 | * - minOccurs: 0 |
||
56 | * @var string|null |
||
57 | */ |
||
58 | protected ?string $eventSite = null; |
||
59 | /** |
||
60 | * The recipientCity |
||
61 | * Meta information extracted from the WSDL |
||
62 | * - minOccurs: 0 |
||
63 | * @var string|null |
||
64 | */ |
||
65 | protected ?string $recipientCity = null; |
||
66 | /** |
||
67 | * The recipientCountryCode |
||
68 | * Meta information extracted from the WSDL |
||
69 | * - minOccurs: 0 |
||
70 | * @var string|null |
||
71 | */ |
||
72 | protected ?string $recipientCountryCode = null; |
||
73 | /** |
||
74 | * The recipientZipCode |
||
75 | * Meta information extracted from the WSDL |
||
76 | * - minOccurs: 0 |
||
77 | * @var string|null |
||
78 | */ |
||
79 | protected ?string $recipientZipCode = null; |
||
80 | /** |
||
81 | * The skybillNumber |
||
82 | * Meta information extracted from the WSDL |
||
83 | * - minOccurs: 0 |
||
84 | * @var string|null |
||
85 | */ |
||
86 | protected ?string $skybillNumber = null; |
||
87 | /** |
||
88 | * Constructor method for skybillInformationResult |
||
89 | * @uses SkybillInformationResult::setErrorCode() |
||
90 | * @uses SkybillInformationResult::setErrorMessage() |
||
91 | * @uses SkybillInformationResult::setEventCode() |
||
92 | * @uses SkybillInformationResult::setEventDate() |
||
93 | * @uses SkybillInformationResult::setEventLibelle() |
||
94 | * @uses SkybillInformationResult::setEventSite() |
||
95 | * @uses SkybillInformationResult::setRecipientCity() |
||
96 | * @uses SkybillInformationResult::setRecipientCountryCode() |
||
97 | * @uses SkybillInformationResult::setRecipientZipCode() |
||
98 | * @uses SkybillInformationResult::setSkybillNumber() |
||
99 | * @param int $errorCode |
||
100 | * @param string $errorMessage |
||
101 | * @param string $eventCode |
||
102 | * @param string $eventDate |
||
103 | * @param string $eventLibelle |
||
104 | * @param string $eventSite |
||
105 | * @param string $recipientCity |
||
106 | * @param string $recipientCountryCode |
||
107 | * @param string $recipientZipCode |
||
108 | * @param string $skybillNumber |
||
109 | */ |
||
110 | public function __construct(?int $errorCode = null, ?string $errorMessage = null, ?string $eventCode = null, ?string $eventDate = null, ?string $eventLibelle = null, ?string $eventSite = null, ?string $recipientCity = null, ?string $recipientCountryCode = null, ?string $recipientZipCode = null, ?string $skybillNumber = null) |
||
111 | { |
||
112 | $this |
||
113 | ->setErrorCode($errorCode) |
||
114 | ->setErrorMessage($errorMessage) |
||
115 | ->setEventCode($eventCode) |
||
116 | ->setEventDate($eventDate) |
||
117 | ->setEventLibelle($eventLibelle) |
||
118 | ->setEventSite($eventSite) |
||
119 | ->setRecipientCity($recipientCity) |
||
120 | ->setRecipientCountryCode($recipientCountryCode) |
||
121 | ->setRecipientZipCode($recipientZipCode) |
||
122 | ->setSkybillNumber($skybillNumber); |
||
123 | } |
||
124 | /** |
||
125 | * Get errorCode value |
||
126 | * @return int|null |
||
127 | */ |
||
128 | public function getErrorCode(): ?int |
||
129 | { |
||
130 | return $this->errorCode; |
||
131 | } |
||
132 | /** |
||
133 | * Set errorCode value |
||
134 | * @param int $errorCode |
||
135 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
136 | */ |
||
137 | public function setErrorCode(?int $errorCode = null): self |
||
138 | { |
||
139 | // validation for constraint: int |
||
140 | if (!is_null($errorCode) && !(is_int($errorCode) || ctype_digit($errorCode))) { |
||
|
|||
141 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($errorCode, true), gettype($errorCode)), __LINE__); |
||
142 | } |
||
143 | $this->errorCode = $errorCode; |
||
144 | |||
145 | return $this; |
||
146 | } |
||
147 | /** |
||
148 | * Get errorMessage value |
||
149 | * @return string|null |
||
150 | */ |
||
151 | public function getErrorMessage(): ?string |
||
152 | { |
||
153 | return $this->errorMessage; |
||
154 | } |
||
155 | /** |
||
156 | * Set errorMessage value |
||
157 | * @param string $errorMessage |
||
158 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
159 | */ |
||
160 | public function setErrorMessage(?string $errorMessage = null): self |
||
161 | { |
||
162 | // validation for constraint: string |
||
163 | if (!is_null($errorMessage) && !is_string($errorMessage)) { |
||
164 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($errorMessage, true), gettype($errorMessage)), __LINE__); |
||
165 | } |
||
166 | $this->errorMessage = $errorMessage; |
||
167 | |||
168 | return $this; |
||
169 | } |
||
170 | /** |
||
171 | * Get eventCode value |
||
172 | * @return string|null |
||
173 | */ |
||
174 | public function getEventCode(): ?string |
||
177 | } |
||
178 | /** |
||
179 | * Set eventCode value |
||
180 | * @param string $eventCode |
||
181 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
182 | */ |
||
183 | public function setEventCode(?string $eventCode = null): self |
||
184 | { |
||
185 | // validation for constraint: string |
||
186 | if (!is_null($eventCode) && !is_string($eventCode)) { |
||
187 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($eventCode, true), gettype($eventCode)), __LINE__); |
||
188 | } |
||
189 | $this->eventCode = $eventCode; |
||
190 | |||
191 | return $this; |
||
192 | } |
||
193 | /** |
||
194 | * Get eventDate value |
||
195 | * @return string|null |
||
196 | */ |
||
197 | public function getEventDate(): ?string |
||
200 | } |
||
201 | /** |
||
202 | * Set eventDate value |
||
203 | * @param string $eventDate |
||
204 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
205 | */ |
||
206 | public function setEventDate(?string $eventDate = null): self |
||
207 | { |
||
208 | // validation for constraint: string |
||
209 | if (!is_null($eventDate) && !is_string($eventDate)) { |
||
210 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($eventDate, true), gettype($eventDate)), __LINE__); |
||
211 | } |
||
212 | $this->eventDate = $eventDate; |
||
213 | |||
214 | return $this; |
||
215 | } |
||
216 | /** |
||
217 | * Get eventLibelle value |
||
218 | * @return string|null |
||
219 | */ |
||
220 | public function getEventLibelle(): ?string |
||
221 | { |
||
222 | return $this->eventLibelle; |
||
223 | } |
||
224 | /** |
||
225 | * Set eventLibelle value |
||
226 | * @param string $eventLibelle |
||
227 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
228 | */ |
||
229 | public function setEventLibelle(?string $eventLibelle = null): self |
||
230 | { |
||
231 | // validation for constraint: string |
||
232 | if (!is_null($eventLibelle) && !is_string($eventLibelle)) { |
||
233 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($eventLibelle, true), gettype($eventLibelle)), __LINE__); |
||
234 | } |
||
235 | $this->eventLibelle = $eventLibelle; |
||
236 | |||
237 | return $this; |
||
238 | } |
||
239 | /** |
||
240 | * Get eventSite value |
||
241 | * @return string|null |
||
242 | */ |
||
243 | public function getEventSite(): ?string |
||
244 | { |
||
245 | return $this->eventSite; |
||
246 | } |
||
247 | /** |
||
248 | * Set eventSite value |
||
249 | * @param string $eventSite |
||
250 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
251 | */ |
||
252 | public function setEventSite(?string $eventSite = null): self |
||
253 | { |
||
254 | // validation for constraint: string |
||
255 | if (!is_null($eventSite) && !is_string($eventSite)) { |
||
256 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($eventSite, true), gettype($eventSite)), __LINE__); |
||
257 | } |
||
258 | $this->eventSite = $eventSite; |
||
259 | |||
260 | return $this; |
||
261 | } |
||
262 | /** |
||
263 | * Get recipientCity value |
||
264 | * @return string|null |
||
265 | */ |
||
266 | public function getRecipientCity(): ?string |
||
269 | } |
||
270 | /** |
||
271 | * Set recipientCity value |
||
272 | * @param string $recipientCity |
||
273 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
274 | */ |
||
275 | public function setRecipientCity(?string $recipientCity = null): self |
||
276 | { |
||
277 | // validation for constraint: string |
||
278 | if (!is_null($recipientCity) && !is_string($recipientCity)) { |
||
279 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($recipientCity, true), gettype($recipientCity)), __LINE__); |
||
280 | } |
||
281 | $this->recipientCity = $recipientCity; |
||
282 | |||
283 | return $this; |
||
284 | } |
||
285 | /** |
||
286 | * Get recipientCountryCode value |
||
287 | * @return string|null |
||
288 | */ |
||
289 | public function getRecipientCountryCode(): ?string |
||
290 | { |
||
291 | return $this->recipientCountryCode; |
||
292 | } |
||
293 | /** |
||
294 | * Set recipientCountryCode value |
||
295 | * @param string $recipientCountryCode |
||
296 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
297 | */ |
||
298 | public function setRecipientCountryCode(?string $recipientCountryCode = null): self |
||
299 | { |
||
300 | // validation for constraint: string |
||
301 | if (!is_null($recipientCountryCode) && !is_string($recipientCountryCode)) { |
||
302 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($recipientCountryCode, true), gettype($recipientCountryCode)), __LINE__); |
||
303 | } |
||
304 | $this->recipientCountryCode = $recipientCountryCode; |
||
305 | |||
306 | return $this; |
||
307 | } |
||
308 | /** |
||
309 | * Get recipientZipCode value |
||
310 | * @return string|null |
||
311 | */ |
||
312 | public function getRecipientZipCode(): ?string |
||
315 | } |
||
316 | /** |
||
317 | * Set recipientZipCode value |
||
318 | * @param string $recipientZipCode |
||
319 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
320 | */ |
||
321 | public function setRecipientZipCode(?string $recipientZipCode = null): self |
||
322 | { |
||
323 | // validation for constraint: string |
||
324 | if (!is_null($recipientZipCode) && !is_string($recipientZipCode)) { |
||
325 | throw new InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($recipientZipCode, true), gettype($recipientZipCode)), __LINE__); |
||
326 | } |
||
327 | $this->recipientZipCode = $recipientZipCode; |
||
328 | |||
329 | return $this; |
||
330 | } |
||
331 | /** |
||
332 | * Get skybillNumber value |
||
333 | * @return string|null |
||
334 | */ |
||
335 | public function getSkybillNumber(): ?string |
||
338 | } |
||
339 | /** |
||
340 | * Set skybillNumber value |
||
341 | * @param string $skybillNumber |
||
342 | * @return \ColissimoTracking\StructType\SkybillInformationResult |
||
343 | */ |
||
344 | public function setSkybillNumber(?string $skybillNumber = null): self |
||
353 | } |
||
354 | } |
||
355 |