Complex classes like CorpIndustryJob 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 CorpIndustryJob, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
12 | class CorpIndustryJob |
||
13 | { |
||
14 | /** |
||
15 | * @var integer |
||
16 | * |
||
17 | * @ORM\Id |
||
18 | * @ORM\GeneratedValue |
||
19 | * @ORM\Column(name="ID", type="bigint", options={"unsigned"=true}) |
||
20 | */ |
||
21 | private $id; |
||
22 | |||
23 | /** |
||
24 | * @ORM\Column(name="ownerID", type="bigint", options={"unsigned"=true}) |
||
25 | */ |
||
26 | private $ownerId; |
||
27 | |||
28 | /** |
||
29 | * @ORM\Column(name="jobID", type="bigint", options={"unsigned"=true}) |
||
30 | */ |
||
31 | private $jobId; |
||
32 | |||
33 | /** |
||
34 | * @ORM\Column(name="installerID", type="bigint", options={"unsigned"=true}) |
||
35 | */ |
||
36 | private $installerId; |
||
37 | |||
38 | /** |
||
39 | * @ORM\Column(name="installerName", type="string", length=255) |
||
40 | */ |
||
41 | private $installerName; |
||
42 | |||
43 | /** |
||
44 | * @ORM\Column(name="facilityID", type="bigint", options={"unsigned"=true}) |
||
45 | */ |
||
46 | private $facilityId; |
||
47 | |||
48 | /** |
||
49 | * @ORM\Column(name="solarSystemID", type="bigint", options={"unsigned"=true}) |
||
50 | */ |
||
51 | private $solarSystemId; |
||
52 | |||
53 | /** |
||
54 | * @ORM\Column(name="solarSystemName", type="string", length=255) |
||
55 | */ |
||
56 | private $solarSystemName; |
||
57 | |||
58 | /** |
||
59 | * @ORM\Column(name="stationID", type="bigint", options={"unsigned"=true}) |
||
60 | */ |
||
61 | private $stationId; |
||
62 | |||
63 | /** |
||
64 | * @ORM\Column(name="activityID", type="smallint", options={"unsigned"=true}) |
||
65 | */ |
||
66 | private $activityId; |
||
67 | |||
68 | /** |
||
69 | * @ORM\Column(name="blueprintID", type="bigint", options={"unsigned"=true}) |
||
70 | */ |
||
71 | private $blueprintId; |
||
72 | |||
73 | /** |
||
74 | * @ORM\Column(name="blueprintTypeID", type="bigint", options={"unsigned"=true}) |
||
75 | */ |
||
76 | private $blueprintTypeId; |
||
77 | |||
78 | /** |
||
79 | * @ORM\Column(name="blueprintTypeName", type="string", length=255) |
||
80 | */ |
||
81 | private $blueprintTypeName; |
||
82 | |||
83 | /** |
||
84 | * @ORM\Column(name="blueprintLocationID", type="bigint", options={"unsigned"=true}) |
||
85 | */ |
||
86 | private $blueprintLocationId; |
||
87 | |||
88 | /** |
||
89 | * @ORM\Column(name="outputLocationID", type="bigint", options={"unsigned"=true}) |
||
90 | */ |
||
91 | private $outputLocationId; |
||
92 | |||
93 | /** |
||
94 | * @ORM\Column(name="runs", type="bigint", options={"unsigned"=true}) |
||
95 | */ |
||
96 | private $runs; |
||
97 | |||
98 | /** |
||
99 | * @ORM\Column(name="cost", type="bigint", options={"unsigned"=true}) |
||
100 | */ |
||
101 | private $cost; |
||
102 | |||
103 | /** |
||
104 | * @ORM\Column(name="teamID", type="bigint", options={"unsigned"=true}) |
||
105 | */ |
||
106 | private $teamId; |
||
107 | |||
108 | /** |
||
109 | * @ORM\Column(name="licensedRuns", type="bigint", options={"unsigned"=true}) |
||
110 | */ |
||
111 | private $licensedRuns; |
||
112 | |||
113 | /** |
||
114 | * @ORM\Column(name="probability", type="bigint", options={"unsigned"=true}) |
||
115 | */ |
||
116 | private $probability; |
||
117 | |||
118 | /** |
||
119 | * @ORM\Column(name="productTypeID", type="bigint", options={"unsigned"=true}) |
||
120 | */ |
||
121 | private $productTypeId; |
||
122 | |||
123 | /** |
||
124 | * @ORM\Column(name="productTypeName", type="string", length=255) |
||
125 | */ |
||
126 | private $productTypeName; |
||
127 | |||
128 | /** |
||
129 | * @ORM\Column(name="status", type="smallint", options={"unsigned"=true}) |
||
130 | */ |
||
131 | private $status; |
||
132 | |||
133 | /** |
||
134 | * @ORM\Column(name="timeInSeconds", type="bigint", options={"unsigned"=true}) |
||
135 | */ |
||
136 | private $timeInSeconds; |
||
137 | |||
138 | /** |
||
139 | * @ORM\Column(name="startDate", type="datetime") |
||
140 | */ |
||
141 | private $startDate; |
||
142 | |||
143 | /** |
||
144 | * @ORM\Column(name="endDate", type="datetime") |
||
145 | */ |
||
146 | private $endDate; |
||
147 | |||
148 | /** |
||
149 | * @ORM\Column(name="pauseDate", type="datetime") |
||
150 | */ |
||
151 | private $pauseDate; |
||
152 | |||
153 | /** |
||
154 | * @ORM\Column(name="completedDate", type="datetime") |
||
155 | */ |
||
156 | private $completedDate; |
||
157 | |||
158 | /** |
||
159 | * @ORM\Column(name="completedCharacterID", type="bigint", options={"unsigned"=true}) |
||
160 | */ |
||
161 | private $completedCharacterId; |
||
162 | |||
163 | /** |
||
164 | * @ORM\Column(name="successfulRuns", type="bigint", options={"unsigned"=true}) |
||
165 | */ |
||
166 | private $successfulRuns; |
||
167 | |||
168 | public function __construct($jobId, $ownerId) |
||
169 | { |
||
170 | $this->jobId = $jobId; |
||
171 | $this->ownerId = $ownerId; |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * Get id |
||
176 | * |
||
177 | * @return integer |
||
178 | */ |
||
179 | public function getId() |
||
183 | |||
184 | /** |
||
185 | * Set jobId |
||
186 | * |
||
187 | * @param integer $jobId |
||
188 | * @return CorpIndustryJob |
||
189 | */ |
||
190 | public function setJobId($jobId) |
||
191 | { |
||
192 | $this->jobId = $jobId; |
||
193 | |||
194 | return $this; |
||
195 | } |
||
196 | |||
197 | /** |
||
198 | * Get jobId |
||
199 | * |
||
200 | * @return integer |
||
201 | */ |
||
202 | public function getJobId() |
||
206 | |||
207 | /** |
||
208 | * Get ownerId |
||
209 | * |
||
210 | * @return integer |
||
211 | */ |
||
212 | public function getOwnerId() |
||
216 | |||
217 | /** |
||
218 | * Set installerId |
||
219 | * |
||
220 | * @param integer $installerId |
||
221 | * @return CorpIndustryJob |
||
222 | */ |
||
223 | public function setInstallerId($installerId) |
||
224 | { |
||
225 | $this->installerId = $installerId; |
||
226 | |||
227 | return $this; |
||
228 | } |
||
229 | |||
230 | /** |
||
231 | * Get installerId |
||
232 | * |
||
233 | * @return integer |
||
234 | */ |
||
235 | public function getInstallerId() |
||
239 | |||
240 | /** |
||
241 | * Set installerName |
||
242 | * |
||
243 | * @param string $installerName |
||
244 | * @return CorpIndustryJob |
||
245 | */ |
||
246 | public function setInstallerName($installerName) |
||
247 | { |
||
248 | $this->installerName = $installerName; |
||
249 | |||
250 | return $this; |
||
251 | } |
||
252 | |||
253 | /** |
||
254 | * Get installerName |
||
255 | * |
||
256 | * @return string |
||
257 | */ |
||
258 | public function getInstallerName() |
||
262 | |||
263 | /** |
||
264 | * Set facilityId |
||
265 | * |
||
266 | * @param integer $facilityId |
||
267 | * @return CorpIndustryJob |
||
268 | */ |
||
269 | public function setFacilityId($facilityId) |
||
270 | { |
||
271 | $this->facilityId = $facilityId; |
||
272 | |||
273 | return $this; |
||
274 | } |
||
275 | |||
276 | /** |
||
277 | * Get facilityId |
||
278 | * |
||
279 | * @return integer |
||
280 | */ |
||
281 | public function getFacilityId() |
||
285 | |||
286 | /** |
||
287 | * Set solarSystemId |
||
288 | * |
||
289 | * @param integer $solarSystemId |
||
290 | * @return CorpIndustryJob |
||
291 | */ |
||
292 | public function setSolarSystemId($solarSystemId) |
||
293 | { |
||
294 | $this->solarSystemId = $solarSystemId; |
||
295 | |||
296 | return $this; |
||
297 | } |
||
298 | |||
299 | /** |
||
300 | * Get solarSystemId |
||
301 | * |
||
302 | * @return integer |
||
303 | */ |
||
304 | public function getSolarSystemId() |
||
308 | |||
309 | /** |
||
310 | * Set solarSystemName |
||
311 | * |
||
312 | * @param string $solarSystemName |
||
313 | * @return CorpIndustryJob |
||
314 | */ |
||
315 | public function setSolarSystemName($solarSystemName) |
||
316 | { |
||
317 | $this->solarSystemName = $solarSystemName; |
||
318 | |||
319 | return $this; |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * Get solarSystemName |
||
324 | * |
||
325 | * @return string |
||
326 | */ |
||
327 | public function getSolarSystemName() |
||
331 | |||
332 | /** |
||
333 | * Set stationId |
||
334 | * |
||
335 | * @param integer $stationId |
||
336 | * @return CorpIndustryJob |
||
337 | */ |
||
338 | public function setStationId($stationId) |
||
339 | { |
||
340 | $this->stationId = $stationId; |
||
341 | |||
342 | return $this; |
||
343 | } |
||
344 | |||
345 | /** |
||
346 | * Get stationId |
||
347 | * |
||
348 | * @return integer |
||
349 | */ |
||
350 | public function getStationId() |
||
354 | |||
355 | /** |
||
356 | * Set activityId |
||
357 | * |
||
358 | * @param integer $activityId |
||
359 | * @return CorpIndustryJob |
||
360 | */ |
||
361 | public function setActivityId($activityId) |
||
362 | { |
||
363 | $this->activityId = $activityId; |
||
364 | |||
365 | return $this; |
||
366 | } |
||
367 | |||
368 | /** |
||
369 | * Get activityId |
||
370 | * |
||
371 | * @return integer |
||
372 | */ |
||
373 | public function getActivityId() |
||
377 | |||
378 | /** |
||
379 | * Set blueprintId |
||
380 | * |
||
381 | * @param integer $blueprintId |
||
382 | * @return CorpIndustryJob |
||
383 | */ |
||
384 | public function setBlueprintId($blueprintId) |
||
385 | { |
||
386 | $this->blueprintId = $blueprintId; |
||
387 | |||
388 | return $this; |
||
389 | } |
||
390 | |||
391 | /** |
||
392 | * Get blueprintId |
||
393 | * |
||
394 | * @return integer |
||
395 | */ |
||
396 | public function getBlueprintId() |
||
400 | |||
401 | /** |
||
402 | * Set blueprintTypeId |
||
403 | * |
||
404 | * @param integer $blueprintTypeId |
||
405 | * @return CorpIndustryJob |
||
406 | */ |
||
407 | public function setBlueprintTypeId($blueprintTypeId) |
||
408 | { |
||
409 | $this->blueprintTypeId = $blueprintTypeId; |
||
410 | |||
411 | return $this; |
||
412 | } |
||
413 | |||
414 | /** |
||
415 | * Get blueprintTypeId |
||
416 | * |
||
417 | * @return integer |
||
418 | */ |
||
419 | public function getBlueprintTypeId() |
||
423 | |||
424 | /** |
||
425 | * Set blueprintTypeName |
||
426 | * |
||
427 | * @param string $blueprintTypeName |
||
428 | * @return CorpIndustryJob |
||
429 | */ |
||
430 | public function setBlueprintTypeName($blueprintTypeName) |
||
431 | { |
||
432 | $this->blueprintTypeName = $blueprintTypeName; |
||
433 | |||
434 | return $this; |
||
435 | } |
||
436 | |||
437 | /** |
||
438 | * Get blueprintTypeName |
||
439 | * |
||
440 | * @return string |
||
441 | */ |
||
442 | public function getBlueprintTypeName() |
||
446 | |||
447 | /** |
||
448 | * Set blueprintLocationId |
||
449 | * |
||
450 | * @param integer $blueprintLocationId |
||
451 | * @return CorpIndustryJob |
||
452 | */ |
||
453 | public function setBlueprintLocationId($blueprintLocationId) |
||
454 | { |
||
455 | $this->blueprintLocationId = $blueprintLocationId; |
||
456 | |||
457 | return $this; |
||
458 | } |
||
459 | |||
460 | /** |
||
461 | * Get blueprintLocationId |
||
462 | * |
||
463 | * @return integer |
||
464 | */ |
||
465 | public function getBlueprintLocationId() |
||
469 | |||
470 | /** |
||
471 | * Set outputLocationId |
||
472 | * |
||
473 | * @param integer $outputLocationId |
||
474 | * @return CorpIndustryJob |
||
475 | */ |
||
476 | public function setOutputLocationId($outputLocationId) |
||
477 | { |
||
478 | $this->outputLocationId = $outputLocationId; |
||
479 | |||
480 | return $this; |
||
481 | } |
||
482 | |||
483 | /** |
||
484 | * Get outputLocationId |
||
485 | * |
||
486 | * @return integer |
||
487 | */ |
||
488 | public function getOutputLocationId() |
||
492 | |||
493 | /** |
||
494 | * Set runs |
||
495 | * |
||
496 | * @param integer $runs |
||
497 | * @return CorpIndustryJob |
||
498 | */ |
||
499 | public function setRuns($runs) |
||
500 | { |
||
501 | $this->runs = $runs; |
||
502 | |||
503 | return $this; |
||
504 | } |
||
505 | |||
506 | /** |
||
507 | * Get runs |
||
508 | * |
||
509 | * @return integer |
||
510 | */ |
||
511 | public function getRuns() |
||
515 | |||
516 | /** |
||
517 | * Set cost |
||
518 | * |
||
519 | * @param integer $cost |
||
520 | * @return CorpIndustryJob |
||
521 | */ |
||
522 | public function setCost($cost) |
||
523 | { |
||
524 | $this->cost = $cost; |
||
525 | |||
526 | return $this; |
||
527 | } |
||
528 | |||
529 | /** |
||
530 | * Get cost |
||
531 | * |
||
532 | * @return integer |
||
533 | */ |
||
534 | public function getCost() |
||
538 | |||
539 | /** |
||
540 | * Set teamId |
||
541 | * |
||
542 | * @param integer $teamId |
||
543 | * @return CorpIndustryJob |
||
544 | */ |
||
545 | public function setTeamId($teamId) |
||
546 | { |
||
547 | $this->teamId = $teamId; |
||
548 | |||
549 | return $this; |
||
550 | } |
||
551 | |||
552 | /** |
||
553 | * Get teamId |
||
554 | * |
||
555 | * @return integer |
||
556 | */ |
||
557 | public function getTeamId() |
||
561 | |||
562 | /** |
||
563 | * Set licensedRuns |
||
564 | * |
||
565 | * @param integer $licensedRuns |
||
566 | * @return CorpIndustryJob |
||
567 | */ |
||
568 | public function setLicensedRuns($licensedRuns) |
||
569 | { |
||
570 | $this->licensedRuns = $licensedRuns; |
||
571 | |||
572 | return $this; |
||
573 | } |
||
574 | |||
575 | /** |
||
576 | * Get licensedRuns |
||
577 | * |
||
578 | * @return integer |
||
579 | */ |
||
580 | public function getLicensedRuns() |
||
584 | |||
585 | /** |
||
586 | * Set probability |
||
587 | * |
||
588 | * @param integer $probability |
||
589 | * @return CorpIndustryJob |
||
590 | */ |
||
591 | public function setProbability($probability) |
||
592 | { |
||
593 | $this->probability = $probability; |
||
594 | |||
595 | return $this; |
||
596 | } |
||
597 | |||
598 | /** |
||
599 | * Get probability |
||
600 | * |
||
601 | * @return integer |
||
602 | */ |
||
603 | public function getProbability() |
||
607 | |||
608 | /** |
||
609 | * Set productTypeId |
||
610 | * |
||
611 | * @param integer $productTypeId |
||
612 | * @return CorpIndustryJob |
||
613 | */ |
||
614 | public function setProductTypeId($productTypeId) |
||
615 | { |
||
616 | $this->productTypeId = $productTypeId; |
||
617 | |||
618 | return $this; |
||
619 | } |
||
620 | |||
621 | /** |
||
622 | * Get productTypeId |
||
623 | * |
||
624 | * @return integer |
||
625 | */ |
||
626 | public function getProductTypeId() |
||
630 | |||
631 | /** |
||
632 | * Set productTypeName |
||
633 | * |
||
634 | * @param string $productTypeName |
||
635 | * @return CorpIndustryJob |
||
636 | */ |
||
637 | public function setProductTypeName($productTypeName) |
||
638 | { |
||
639 | $this->productTypeName = $productTypeName; |
||
640 | |||
641 | return $this; |
||
642 | } |
||
643 | |||
644 | /** |
||
645 | * Get productTypeName |
||
646 | * |
||
647 | * @return string |
||
648 | */ |
||
649 | public function getProductTypeName() |
||
653 | |||
654 | /** |
||
655 | * Set status |
||
656 | * |
||
657 | * @param integer $status |
||
658 | * @return CorpIndustryJob |
||
659 | */ |
||
660 | public function setStatus($status) |
||
661 | { |
||
662 | $this->status = $status; |
||
663 | |||
664 | return $this; |
||
665 | } |
||
666 | |||
667 | /** |
||
668 | * Get status |
||
669 | * |
||
670 | * @return integer |
||
671 | */ |
||
672 | public function getStatus() |
||
676 | |||
677 | /** |
||
678 | * Set timeInSeconds |
||
679 | * |
||
680 | * @param integer $timeInSeconds |
||
681 | * @return CorpIndustryJob |
||
682 | */ |
||
683 | public function setTimeInSeconds($timeInSeconds) |
||
684 | { |
||
685 | $this->timeInSeconds = $timeInSeconds; |
||
686 | |||
687 | return $this; |
||
688 | } |
||
689 | |||
690 | /** |
||
691 | * Get timeInSeconds |
||
692 | * |
||
693 | * @return integer |
||
694 | */ |
||
695 | public function getTimeInSeconds() |
||
699 | |||
700 | /** |
||
701 | * Set startDate |
||
702 | * |
||
703 | * @param \DateTime $startDate |
||
704 | * @return CorpIndustryJob |
||
705 | */ |
||
706 | public function setStartDate($startDate) |
||
707 | { |
||
708 | $this->startDate = $startDate; |
||
709 | |||
710 | return $this; |
||
711 | } |
||
712 | |||
713 | /** |
||
714 | * Get startDate |
||
715 | * |
||
716 | * @return \DateTime |
||
717 | */ |
||
718 | public function getStartDate() |
||
722 | |||
723 | /** |
||
724 | * Set endDate |
||
725 | * |
||
726 | * @param \DateTime $endDate |
||
727 | * @return CorpIndustryJob |
||
728 | */ |
||
729 | public function setEndDate($endDate) |
||
730 | { |
||
731 | $this->endDate = $endDate; |
||
732 | |||
733 | return $this; |
||
734 | } |
||
735 | |||
736 | /** |
||
737 | * Get endDate |
||
738 | * |
||
739 | * @return \DateTime |
||
740 | */ |
||
741 | public function getEndDate() |
||
745 | |||
746 | /** |
||
747 | * Set pauseDate |
||
748 | * |
||
749 | * @param \DateTime $pauseDate |
||
750 | * @return CorpIndustryJob |
||
751 | */ |
||
752 | public function setPauseDate($pauseDate) |
||
753 | { |
||
754 | $this->pauseDate = $pauseDate; |
||
755 | |||
756 | return $this; |
||
757 | } |
||
758 | |||
759 | /** |
||
760 | * Get pauseDate |
||
761 | * |
||
762 | * @return \DateTime |
||
763 | */ |
||
764 | public function getPauseDate() |
||
768 | |||
769 | /** |
||
770 | * Set completedDate |
||
771 | * |
||
772 | * @param \DateTime $completedDate |
||
773 | * @return CorpIndustryJob |
||
774 | */ |
||
775 | public function setCompletedDate($completedDate) |
||
776 | { |
||
777 | $this->completedDate = $completedDate; |
||
778 | |||
779 | return $this; |
||
780 | } |
||
781 | |||
782 | /** |
||
783 | * Get completedDate |
||
784 | * |
||
785 | * @return \DateTime |
||
786 | */ |
||
787 | public function getCompletedDate() |
||
791 | |||
792 | /** |
||
793 | * Set completedCharacterId |
||
794 | * |
||
795 | * @param integer $completedCharacterId |
||
796 | * @return CorpIndustryJob |
||
797 | */ |
||
798 | public function setCompletedCharacterId($completedCharacterId) |
||
799 | { |
||
800 | $this->completedCharacterId = $completedCharacterId; |
||
801 | |||
802 | return $this; |
||
803 | } |
||
804 | |||
805 | /** |
||
806 | * Get completedCharacterId |
||
807 | * |
||
808 | * @return integer |
||
809 | */ |
||
810 | public function getCompletedCharacterId() |
||
814 | |||
815 | /** |
||
816 | * Set successfulRuns |
||
817 | * |
||
818 | * @param integer $successfulRuns |
||
819 | * @return CorpIndustryJob |
||
820 | */ |
||
821 | public function setSuccessfulRuns($successfulRuns) |
||
822 | { |
||
823 | $this->successfulRuns = $successfulRuns; |
||
824 | |||
825 | return $this; |
||
826 | } |
||
827 | |||
828 | /** |
||
829 | * Get successfulRuns |
||
830 | * |
||
831 | * @return integer |
||
832 | */ |
||
833 | public function getSuccessfulRuns() |
||
837 | } |
||
838 |