Total Complexity | 55 |
Total Lines | 567 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like AccountVData 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 AccountVData, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
33 | class AccountVData extends DataModelBase |
||
34 | { |
||
35 | /** |
||
36 | * @var int Id de la cuenta. |
||
37 | */ |
||
38 | public $id = 0; |
||
39 | /** |
||
40 | * @var int Id del usuario principal de la cuenta. |
||
41 | */ |
||
42 | public $userId = 0; |
||
43 | /** |
||
44 | * @var int Id del grupo principal de la cuenta. |
||
45 | */ |
||
46 | public $userGroupId = 0; |
||
47 | /** |
||
48 | * @var int Id del usuario que editó la cuenta. |
||
49 | */ |
||
50 | public $userEditId = 0; |
||
51 | /** |
||
52 | * @var string El nombre de la cuenta. |
||
53 | */ |
||
54 | public $name = ''; |
||
55 | /** |
||
56 | * @var int Id del cliente de la cuenta. |
||
57 | */ |
||
58 | public $clientId = 0; |
||
59 | /** |
||
60 | * @var int Id de la categoría de la cuenta. |
||
61 | */ |
||
62 | public $categoryId = 0; |
||
63 | /** |
||
64 | * @var string El nombre de usuario de la cuenta. |
||
65 | */ |
||
66 | public $login = ''; |
||
67 | /** |
||
68 | * @var string La URL de la cuenta. |
||
69 | */ |
||
70 | public $url = ''; |
||
71 | /** |
||
72 | * @var string La clave de la cuenta. |
||
73 | */ |
||
74 | public $pass = ''; |
||
75 | /** |
||
76 | * @var string La clave de encriptación de la cuenta |
||
77 | */ |
||
78 | public $key = ''; |
||
79 | /** |
||
80 | * @var string Las nosta de la cuenta. |
||
81 | */ |
||
82 | public $notes = ''; |
||
83 | /** |
||
84 | * @var int |
||
85 | */ |
||
86 | public $otherUserEdit = 0; |
||
87 | /** |
||
88 | * @var int |
||
89 | */ |
||
90 | public $otherUserGroupEdit = 0; |
||
91 | /** |
||
92 | * @var int |
||
93 | */ |
||
94 | public $dateAdd = 0; |
||
95 | /** |
||
96 | * @var int |
||
97 | */ |
||
98 | public $dateEdit = 0; |
||
99 | /** |
||
100 | * @var int |
||
101 | */ |
||
102 | public $countView = 0; |
||
103 | /** |
||
104 | * @var int |
||
105 | */ |
||
106 | public $countDecrypt = 0; |
||
107 | /** |
||
108 | * @var int |
||
109 | */ |
||
110 | public $isPrivate = 0; |
||
111 | /** |
||
112 | * @var int |
||
113 | */ |
||
114 | public $isPrivateGroup = 0; |
||
115 | /** |
||
116 | * @var int |
||
117 | */ |
||
118 | public $passDate = 0; |
||
119 | /** |
||
120 | * @var int |
||
121 | */ |
||
122 | public $passDateChange = 0; |
||
123 | /** |
||
124 | * @var int |
||
125 | */ |
||
126 | public $parentId = 0; |
||
127 | /** |
||
128 | * @var string |
||
129 | */ |
||
130 | public $categoryName = ''; |
||
131 | /** |
||
132 | * @var string |
||
133 | */ |
||
134 | public $clientName = ''; |
||
135 | /** |
||
136 | * @var string |
||
137 | */ |
||
138 | public $userGroupName = ''; |
||
139 | /** |
||
140 | * @var string |
||
141 | */ |
||
142 | public $userName = ''; |
||
143 | /** |
||
144 | * @var string |
||
145 | */ |
||
146 | public $userLogin = ''; |
||
147 | /** |
||
148 | * @var string |
||
149 | */ |
||
150 | public $userEditName = ''; |
||
151 | /** |
||
152 | * @var string |
||
153 | */ |
||
154 | public $userEditLogin = ''; |
||
155 | /** |
||
156 | * @var string |
||
157 | */ |
||
158 | public $publicLinkHash = ''; |
||
159 | |||
160 | /** |
||
161 | * AccountData constructor. |
||
162 | * |
||
163 | * @param int $accountId |
||
164 | */ |
||
165 | public function __construct($accountId = 0) |
||
166 | { |
||
167 | $this->id = (int)$accountId; |
||
168 | } |
||
169 | |||
170 | /** |
||
171 | * @return int |
||
172 | */ |
||
173 | public function getDateAdd() |
||
174 | { |
||
175 | return $this->dateAdd; |
||
176 | } |
||
177 | |||
178 | /** |
||
179 | * @param int $dateAdd |
||
180 | */ |
||
181 | public function setDateAdd($dateAdd) |
||
182 | { |
||
183 | $this->dateAdd = $dateAdd; |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * @return int |
||
188 | */ |
||
189 | public function getDateEdit() |
||
190 | { |
||
191 | return $this->dateEdit; |
||
192 | } |
||
193 | |||
194 | /** |
||
195 | * @param int $dateEdit |
||
196 | */ |
||
197 | public function setDateEdit($dateEdit) |
||
198 | { |
||
199 | $this->dateEdit = $dateEdit; |
||
200 | } |
||
201 | |||
202 | /** |
||
203 | * @return int |
||
204 | */ |
||
205 | public function getUserEditId() |
||
206 | { |
||
207 | return (int)$this->userEditId; |
||
208 | } |
||
209 | |||
210 | /** |
||
211 | * @param int $userEditId |
||
212 | */ |
||
213 | public function setUserEditId($userEditId) |
||
214 | { |
||
215 | $this->userEditId = (int)$userEditId; |
||
216 | } |
||
217 | |||
218 | /** |
||
219 | * @return string |
||
220 | */ |
||
221 | public function getPass() |
||
222 | { |
||
223 | return $this->pass; |
||
224 | } |
||
225 | |||
226 | /** |
||
227 | * @param string $pass |
||
228 | */ |
||
229 | public function setPass($pass) |
||
230 | { |
||
231 | $this->pass = $pass; |
||
232 | } |
||
233 | |||
234 | /** |
||
235 | * @return string |
||
236 | */ |
||
237 | public function getKey() |
||
238 | { |
||
239 | return $this->key; |
||
240 | } |
||
241 | |||
242 | /** |
||
243 | * @param string $key |
||
244 | */ |
||
245 | public function setKey($key) |
||
246 | { |
||
247 | $this->key = $key; |
||
248 | } |
||
249 | |||
250 | /** |
||
251 | * @return int|null |
||
252 | */ |
||
253 | public function getId() |
||
254 | { |
||
255 | return (int)$this->id; |
||
256 | } |
||
257 | |||
258 | /** |
||
259 | * @param int $id |
||
260 | */ |
||
261 | public function setId($id) |
||
262 | { |
||
263 | $this->id = (int)$id; |
||
264 | } |
||
265 | |||
266 | /** |
||
267 | * @return int |
||
268 | */ |
||
269 | public function getUserId() |
||
270 | { |
||
271 | return (int)$this->userId; |
||
272 | } |
||
273 | |||
274 | /** |
||
275 | * @param int $userId |
||
276 | */ |
||
277 | public function setUserId($userId) |
||
278 | { |
||
279 | $this->userId = (int)$userId; |
||
280 | } |
||
281 | |||
282 | /** |
||
283 | * @return int |
||
284 | */ |
||
285 | public function getUserGroupId() |
||
286 | { |
||
287 | return (int)$this->userGroupId; |
||
288 | } |
||
289 | |||
290 | /** |
||
291 | * @param int $userGroupId |
||
292 | */ |
||
293 | public function setUserGroupId($userGroupId) |
||
296 | } |
||
297 | |||
298 | /** |
||
299 | * @return int |
||
300 | */ |
||
301 | public function getOtherUserEdit() |
||
302 | { |
||
303 | return (int)$this->otherUserEdit; |
||
304 | } |
||
305 | |||
306 | /** |
||
307 | * @param bool $otherUserEdit |
||
308 | */ |
||
309 | public function setOtherUserEdit($otherUserEdit) |
||
310 | { |
||
311 | $this->otherUserEdit = (int)$otherUserEdit; |
||
312 | } |
||
313 | |||
314 | /** |
||
315 | * @return int |
||
316 | */ |
||
317 | public function getOtherUserGroupEdit() |
||
318 | { |
||
319 | return (int)$this->otherUserGroupEdit; |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * @param bool $otherUserGroupEdit |
||
324 | */ |
||
325 | public function setOtherUserGroupEdit($otherUserGroupEdit) |
||
326 | { |
||
327 | $this->otherUserGroupEdit = (int)$otherUserGroupEdit; |
||
328 | } |
||
329 | |||
330 | /** |
||
331 | * @return string |
||
332 | */ |
||
333 | public function getName() |
||
334 | { |
||
335 | return $this->name; |
||
336 | } |
||
337 | |||
338 | /** |
||
339 | * @param string $name |
||
340 | */ |
||
341 | public function setName($name) |
||
342 | { |
||
343 | $this->name = $name; |
||
344 | } |
||
345 | |||
346 | /** |
||
347 | * @return int |
||
348 | */ |
||
349 | public function getCategoryId() |
||
350 | { |
||
351 | return (int)$this->categoryId; |
||
352 | } |
||
353 | |||
354 | /** |
||
355 | * @param int $categoryId |
||
356 | */ |
||
357 | public function setCategoryId($categoryId) |
||
358 | { |
||
359 | $this->categoryId = (int)$categoryId; |
||
360 | } |
||
361 | |||
362 | /** |
||
363 | * @return int |
||
364 | */ |
||
365 | public function getClientId() |
||
366 | { |
||
367 | return (int)$this->clientId; |
||
368 | } |
||
369 | |||
370 | /** |
||
371 | * @param int $clientId |
||
372 | */ |
||
373 | public function setClientId($clientId) |
||
374 | { |
||
375 | $this->clientId = (int)$clientId; |
||
376 | } |
||
377 | |||
378 | /** |
||
379 | * @return string |
||
380 | */ |
||
381 | public function getLogin() |
||
382 | { |
||
383 | return $this->login; |
||
384 | } |
||
385 | |||
386 | /** |
||
387 | * @param string $login |
||
388 | */ |
||
389 | public function setLogin($login) |
||
390 | { |
||
391 | $this->login = $login; |
||
392 | } |
||
393 | |||
394 | /** |
||
395 | * @return string |
||
396 | */ |
||
397 | public function getUrl() |
||
398 | { |
||
399 | return $this->url; |
||
400 | } |
||
401 | |||
402 | /** |
||
403 | * @param string $url |
||
404 | */ |
||
405 | public function setUrl($url) |
||
406 | { |
||
407 | $this->url = $url; |
||
408 | } |
||
409 | |||
410 | /** |
||
411 | * @return string |
||
412 | */ |
||
413 | public function getNotes() |
||
414 | { |
||
415 | return $this->notes; |
||
416 | } |
||
417 | |||
418 | /** |
||
419 | * @param string $notes |
||
420 | */ |
||
421 | public function setNotes($notes) |
||
422 | { |
||
423 | $this->notes = $notes; |
||
424 | } |
||
425 | |||
426 | /** |
||
427 | * @return int |
||
428 | */ |
||
429 | public function getCountView() |
||
430 | { |
||
431 | return (int)$this->countView; |
||
432 | } |
||
433 | |||
434 | /** |
||
435 | * @param int $countView |
||
436 | */ |
||
437 | public function setCountView($countView) |
||
438 | { |
||
439 | $this->countView = (int)$countView; |
||
440 | } |
||
441 | |||
442 | /** |
||
443 | * @return int |
||
444 | */ |
||
445 | public function getCountDecrypt() |
||
446 | { |
||
447 | return (int)$this->countDecrypt; |
||
448 | } |
||
449 | |||
450 | /** |
||
451 | * @param int $countDecrypt |
||
452 | */ |
||
453 | public function setCountDecrypt($countDecrypt) |
||
454 | { |
||
455 | $this->countDecrypt = (int)$countDecrypt; |
||
456 | } |
||
457 | |||
458 | /** |
||
459 | * @return int |
||
460 | */ |
||
461 | public function getIsPrivate() |
||
462 | { |
||
463 | return (int)$this->isPrivate; |
||
464 | } |
||
465 | |||
466 | /** |
||
467 | * @param int $isPrivate |
||
468 | */ |
||
469 | public function setIsPrivate($isPrivate) |
||
470 | { |
||
471 | $this->isPrivate = (int)$isPrivate; |
||
472 | } |
||
473 | |||
474 | /** |
||
475 | * @return int |
||
476 | */ |
||
477 | public function getPassDate() |
||
478 | { |
||
479 | return (int)$this->passDate; |
||
480 | } |
||
481 | |||
482 | /** |
||
483 | * @param int $passDate |
||
484 | */ |
||
485 | public function setPassDate($passDate) |
||
486 | { |
||
487 | $this->passDate = (int)$passDate; |
||
488 | } |
||
489 | |||
490 | /** |
||
491 | * @return int |
||
492 | */ |
||
493 | public function getPassDateChange() |
||
494 | { |
||
495 | return (int)$this->passDateChange; |
||
496 | } |
||
497 | |||
498 | /** |
||
499 | * @param int $passDateChange |
||
500 | */ |
||
501 | public function setPassDateChange($passDateChange) |
||
502 | { |
||
503 | $this->passDateChange = (int)$passDateChange; |
||
504 | } |
||
505 | |||
506 | /** |
||
507 | * @return int |
||
508 | */ |
||
509 | public function getParentId() |
||
510 | { |
||
511 | return (int)$this->parentId; |
||
512 | } |
||
513 | |||
514 | /** |
||
515 | * @param int $parentId |
||
516 | */ |
||
517 | public function setParentId($parentId) |
||
518 | { |
||
519 | $this->parentId = (int)$parentId; |
||
520 | } |
||
521 | |||
522 | /** |
||
523 | * @return int |
||
524 | */ |
||
525 | public function getIsPrivateGroup() |
||
526 | { |
||
527 | return (int)$this->isPrivateGroup; |
||
528 | } |
||
529 | |||
530 | /** |
||
531 | * @param int $isPrivateGroup |
||
532 | */ |
||
533 | public function setIsPrivateGroup($isPrivateGroup) |
||
534 | { |
||
535 | $this->isPrivateGroup = (int)$isPrivateGroup; |
||
536 | } |
||
537 | |||
538 | /** |
||
539 | * @return string |
||
540 | */ |
||
541 | public function getUserEditName() |
||
542 | { |
||
543 | return $this->userEditName; |
||
544 | } |
||
545 | |||
546 | /** |
||
547 | * @return string |
||
548 | */ |
||
549 | public function getUserEditLogin() |
||
552 | } |
||
553 | |||
554 | /** |
||
555 | * @return string |
||
556 | */ |
||
557 | public function getPublicLinkHash() |
||
558 | { |
||
559 | return $this->publicLinkHash; |
||
560 | } |
||
561 | |||
562 | /** |
||
563 | * @return string |
||
564 | */ |
||
565 | public function getCategoryName() |
||
566 | { |
||
567 | return $this->categoryName; |
||
568 | } |
||
569 | |||
570 | /** |
||
571 | * @return string |
||
572 | */ |
||
573 | public function getClientName() |
||
574 | { |
||
575 | return $this->clientName; |
||
576 | } |
||
577 | |||
578 | /** |
||
579 | * @return string |
||
580 | */ |
||
581 | public function getUserGroupName() |
||
582 | { |
||
583 | return $this->userGroupName; |
||
584 | } |
||
585 | |||
586 | /** |
||
587 | * @return string |
||
588 | */ |
||
589 | public function getUserName() |
||
592 | } |
||
593 | |||
594 | /** |
||
595 | * @return string |
||
596 | */ |
||
597 | public function getUserLogin() |
||
600 | } |
||
601 | } |