Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Lead 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 Lead, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
81 | class Lead extends ExtendLead implements |
||
82 | FullNameInterface, |
||
83 | EmailHolderInterface, |
||
84 | ChannelAwareInterface |
||
85 | { |
||
86 | use ChannelEntityTrait; |
||
87 | |||
88 | const INTERNAL_STATUS_CODE = 'lead_status'; |
||
89 | |||
90 | /** |
||
91 | * @var integer |
||
92 | * |
||
93 | * @ORM\Column(name="id", type="integer") |
||
94 | * @ORM\Id |
||
95 | * @ORM\GeneratedValue(strategy="AUTO") |
||
96 | * @ConfigField( |
||
97 | * defaultValues={ |
||
98 | * "importexport"={ |
||
99 | * "order"=0 |
||
100 | * } |
||
101 | * } |
||
102 | * ) |
||
103 | */ |
||
104 | protected $id; |
||
105 | |||
106 | /** |
||
107 | * @var Contact |
||
108 | * |
||
109 | * @ORM\ManyToOne(targetEntity="Oro\Bundle\ContactBundle\Entity\Contact") |
||
110 | * @ORM\JoinColumn(name="contact_id", referencedColumnName="id", onDelete="SET NULL") |
||
111 | * @ConfigField( |
||
112 | * defaultValues={ |
||
113 | * "dataaudit"={"auditable"=true}, |
||
114 | * "importexport"={ |
||
115 | * "order"=150, |
||
116 | * "short"=true |
||
117 | * } |
||
118 | * } |
||
119 | * ) |
||
120 | */ |
||
121 | protected $contact; |
||
122 | |||
123 | /** |
||
124 | * @var string |
||
125 | * |
||
126 | * @ORM\Column(name="name", type="string", length=255) |
||
127 | * @ConfigField( |
||
128 | * defaultValues={ |
||
129 | * "dataaudit"={"auditable"=true}, |
||
130 | * "importexport"={ |
||
131 | * "order"=20, |
||
132 | * "identity"=true |
||
133 | * } |
||
134 | * } |
||
135 | * ) |
||
136 | */ |
||
137 | protected $name; |
||
138 | |||
139 | /** |
||
140 | * @var string |
||
141 | * |
||
142 | * @ORM\Column(name="name_prefix", type="string", length=255, nullable=true) |
||
143 | * @ConfigField( |
||
144 | * defaultValues={ |
||
145 | * "dataaudit"={"auditable"=true}, |
||
146 | * "importexport"={ |
||
147 | * "order"=30 |
||
148 | * } |
||
149 | * } |
||
150 | * ) |
||
151 | */ |
||
152 | protected $namePrefix; |
||
153 | |||
154 | /** |
||
155 | * @var string |
||
156 | * |
||
157 | * @ORM\Column(name="first_name", type="string", length=255, nullable=true) |
||
158 | * @ConfigField( |
||
159 | * defaultValues={ |
||
160 | * "dataaudit"={"auditable"=true}, |
||
161 | * "importexport"={ |
||
162 | * "order"=40 |
||
163 | * } |
||
164 | * } |
||
165 | * ) |
||
166 | */ |
||
167 | protected $firstName; |
||
168 | |||
169 | /** |
||
170 | * @var string |
||
171 | * |
||
172 | * @ORM\Column(name="middle_name", type="string", length=255, nullable=true) |
||
173 | * @ConfigField( |
||
174 | * defaultValues={ |
||
175 | * "dataaudit"={"auditable"=true}, |
||
176 | * "importexport"={ |
||
177 | * "order"=50 |
||
178 | * } |
||
179 | * } |
||
180 | * ) |
||
181 | */ |
||
182 | protected $middleName; |
||
183 | |||
184 | /** |
||
185 | * @var string |
||
186 | * |
||
187 | * @ORM\Column(name="last_name", type="string", length=255, nullable=true) |
||
188 | * @ConfigField( |
||
189 | * defaultValues={ |
||
190 | * "dataaudit"={"auditable"=true}, |
||
191 | * "importexport"={ |
||
192 | * "order"=60 |
||
193 | * } |
||
194 | * } |
||
195 | * ) |
||
196 | */ |
||
197 | protected $lastName; |
||
198 | |||
199 | /** |
||
200 | * @var string |
||
201 | * |
||
202 | * @ORM\Column(name="name_suffix", type="string", length=255, nullable=true) |
||
203 | * @ConfigField( |
||
204 | * defaultValues={ |
||
205 | * "dataaudit"={"auditable"=true}, |
||
206 | * "importexport"={ |
||
207 | * "order"=70 |
||
208 | * } |
||
209 | * } |
||
210 | * ) |
||
211 | */ |
||
212 | protected $nameSuffix; |
||
213 | |||
214 | /** |
||
215 | * @var string |
||
216 | * |
||
217 | * @ORM\Column(name="job_title", type="string", length=255, nullable=true) |
||
218 | * @ConfigField( |
||
219 | * defaultValues={ |
||
220 | * "dataaudit"={"auditable"=true}, |
||
221 | * "importexport"={ |
||
222 | * "order"=80 |
||
223 | * } |
||
224 | * } |
||
225 | * ) |
||
226 | */ |
||
227 | protected $jobTitle; |
||
228 | |||
229 | /** |
||
230 | * @var Collection |
||
231 | * |
||
232 | * @ORM\OneToMany(targetEntity="Oro\Bundle\SalesBundle\Entity\LeadPhone", mappedBy="owner", |
||
233 | * mappedBy="owner", cascade={"all"}, orphanRemoval=true |
||
234 | * )) |
||
235 | * @ORM\OrderBy({"primary" = "DESC"}) |
||
236 | * @ConfigField( |
||
237 | * defaultValues={ |
||
238 | * "importexport"={ |
||
239 | * "order"=220 |
||
240 | * }, |
||
241 | * "dataaudit"={ |
||
242 | * "auditable"=true |
||
243 | * } |
||
244 | * } |
||
245 | * ) |
||
246 | */ |
||
247 | protected $phones; |
||
248 | |||
249 | /** |
||
250 | * @var Collection |
||
251 | * |
||
252 | * @ORM\OneToMany(targetEntity="Oro\Bundle\SalesBundle\Entity\LeadEmail", |
||
253 | * mappedBy="owner", cascade={"all"}, orphanRemoval=true |
||
254 | * ) |
||
255 | * @ORM\OrderBy({"primary" = "DESC"}) |
||
256 | * @ConfigField( |
||
257 | * defaultValues={ |
||
258 | * "importexport"={ |
||
259 | * "order"=210 |
||
260 | * }, |
||
261 | * "dataaudit"={ |
||
262 | * "auditable"=true |
||
263 | * } |
||
264 | * } |
||
265 | * ) |
||
266 | */ |
||
267 | protected $emails; |
||
268 | |||
269 | /** |
||
270 | * @var string |
||
271 | * |
||
272 | * @ORM\Column(name="company_name", type="string", length=255, nullable=true) |
||
273 | * @ConfigField( |
||
274 | * defaultValues={ |
||
275 | * "dataaudit"={"auditable"=true}, |
||
276 | * "importexport"={ |
||
277 | * "order"=110 |
||
278 | * } |
||
279 | * } |
||
280 | * ) |
||
281 | */ |
||
282 | protected $companyName; |
||
283 | |||
284 | /** |
||
285 | * @var string |
||
286 | * |
||
287 | * @ORM\Column(name="website", type="string", length=255, nullable=true) |
||
288 | * @ConfigField( |
||
289 | * defaultValues={ |
||
290 | * "dataaudit"={"auditable"=true}, |
||
291 | * "importexport"={ |
||
292 | * "order"=120 |
||
293 | * } |
||
294 | * } |
||
295 | * ) |
||
296 | */ |
||
297 | protected $website; |
||
298 | |||
299 | /** |
||
300 | * @var integer |
||
301 | * |
||
302 | * @ORM\Column(name="number_of_employees", type="integer", nullable=true) |
||
303 | * @ConfigField( |
||
304 | * defaultValues={ |
||
305 | * "dataaudit"={"auditable"=true}, |
||
306 | * "importexport"={ |
||
307 | * "order"=130 |
||
308 | * } |
||
309 | * } |
||
310 | * ) |
||
311 | */ |
||
312 | protected $numberOfEmployees; |
||
313 | |||
314 | /** |
||
315 | * @var string |
||
316 | * |
||
317 | * @ORM\Column(name="industry", type="string", length=255, nullable=true) |
||
318 | * @ConfigField( |
||
319 | * defaultValues={ |
||
320 | * "dataaudit"={"auditable"=true}, |
||
321 | * "importexport"={ |
||
322 | * "order"=140 |
||
323 | * } |
||
324 | * } |
||
325 | * ) |
||
326 | */ |
||
327 | protected $industry; |
||
328 | |||
329 | /** |
||
330 | * @deprecated since 1.10. Use $addresses collection field instead |
||
331 | * @ORM\ManyToOne(targetEntity="Oro\Bundle\AddressBundle\Entity\Address", cascade={"persist", "remove"}) |
||
332 | * @ORM\JoinColumn(name="address_id", referencedColumnName="id", onDelete="SET NULL", nullable=true) |
||
333 | * @ConfigField( |
||
334 | * defaultValues={ |
||
335 | * "importexport"={ |
||
336 | * "excluded"=true |
||
337 | * } |
||
338 | * } |
||
339 | * ) |
||
340 | */ |
||
341 | protected $address; |
||
342 | |||
343 | /** |
||
344 | * @var Collection |
||
345 | * |
||
346 | * @ORM\OneToMany(targetEntity="Oro\Bundle\SalesBundle\Entity\LeadAddress", |
||
347 | * mappedBy="owner", cascade={"all"}, orphanRemoval=true |
||
348 | * ) |
||
349 | * @ORM\OrderBy({"primary" = "DESC"}) |
||
350 | * @ConfigField( |
||
351 | * defaultValues={ |
||
352 | * "importexport"={ |
||
353 | * "full"=true, |
||
354 | * "order"=170 |
||
355 | * }, |
||
356 | * "dataaudit"={ |
||
357 | * "auditable"=true |
||
358 | * } |
||
359 | * } |
||
360 | * ) |
||
361 | */ |
||
362 | protected $addresses; |
||
363 | |||
364 | /** |
||
365 | * @var \DateTime |
||
366 | * |
||
367 | * @ORM\Column(type="datetime") |
||
368 | * @ConfigField( |
||
369 | * defaultValues={ |
||
370 | * "entity"={ |
||
371 | * "label"="oro.ui.created_at" |
||
372 | * }, |
||
373 | * "importexport"={ |
||
374 | * "excluded"=true |
||
375 | * } |
||
376 | * } |
||
377 | * ) |
||
378 | */ |
||
379 | protected $createdAt; |
||
380 | |||
381 | /** |
||
382 | * @var \DateTime |
||
383 | * |
||
384 | * @ORM\Column(type="datetime", nullable=true) |
||
385 | * @ConfigField( |
||
386 | * defaultValues={ |
||
387 | * "entity"={ |
||
388 | * "label"="oro.ui.updated_at" |
||
389 | * }, |
||
390 | * "importexport"={ |
||
391 | * "excluded"=true |
||
392 | * } |
||
393 | * } |
||
394 | * ) |
||
395 | */ |
||
396 | protected $updatedAt; |
||
397 | |||
398 | /** |
||
399 | * @var User |
||
400 | * |
||
401 | * @ORM\ManyToOne(targetEntity="Oro\Bundle\UserBundle\Entity\User") |
||
402 | * @ORM\JoinColumn(name="user_owner_id", referencedColumnName="id", onDelete="SET NULL") |
||
403 | * @ConfigField( |
||
404 | * defaultValues={ |
||
405 | * "dataaudit"={"auditable"=true}, |
||
406 | * "importexport"={ |
||
407 | * "order"=180, |
||
408 | * "short"=true |
||
409 | * } |
||
410 | * } |
||
411 | * ) |
||
412 | */ |
||
413 | protected $owner; |
||
414 | |||
415 | /** |
||
416 | * @var ArrayCollection |
||
417 | * |
||
418 | * @ORM\OneToMany(targetEntity="Oro\Bundle\SalesBundle\Entity\Opportunity", mappedBy="lead") |
||
419 | * @ConfigField( |
||
420 | * defaultValues={ |
||
421 | * "importexport"={ |
||
422 | * "order"=190, |
||
423 | * "short"=true |
||
424 | * } |
||
425 | * } |
||
426 | * ) |
||
427 | */ |
||
428 | protected $opportunities; |
||
429 | |||
430 | /** |
||
431 | * @var string |
||
432 | * |
||
433 | * @ORM\Column(name="notes", type="text", nullable=true) |
||
434 | * @ConfigField( |
||
435 | * defaultValues={ |
||
436 | * "dataaudit"={"auditable"=true}, |
||
437 | * "importexport"={ |
||
438 | * "order"=140 |
||
439 | * } |
||
440 | * } |
||
441 | * ) |
||
442 | */ |
||
443 | protected $notes; |
||
444 | |||
445 | /** |
||
446 | * @var Organization |
||
447 | * |
||
448 | * @ORM\ManyToOne(targetEntity="Oro\Bundle\OrganizationBundle\Entity\Organization") |
||
449 | * @ORM\JoinColumn(name="organization_id", referencedColumnName="id", onDelete="SET NULL") |
||
450 | */ |
||
451 | protected $organization; |
||
452 | |||
453 | /** |
||
454 | * @var B2bCustomer |
||
455 | * |
||
456 | * @ORM\ManyToOne(targetEntity="Oro\Bundle\SalesBundle\Entity\B2bCustomer", inversedBy="leads") |
||
457 | * @ORM\JoinColumn(name="customer_id", referencedColumnName="id", onDelete="SET NULL") |
||
458 | * @ConfigField( |
||
459 | * defaultValues={ |
||
460 | * "dataaudit"={"auditable"=true}, |
||
461 | * "importexport"={ |
||
462 | * "order"=160, |
||
463 | * "short"=true |
||
464 | * } |
||
465 | * } |
||
466 | * ) |
||
467 | */ |
||
468 | protected $customer; |
||
469 | |||
470 | /** |
||
471 | * @var string |
||
472 | * |
||
473 | * @ORM\Column(name="twitter", type="string", length=255, nullable=true) |
||
474 | * @ConfigField( |
||
475 | * defaultValues={ |
||
476 | * "dataaudit"={"auditable"=true}, |
||
477 | * "importexport"={ |
||
478 | * "order"=175 |
||
479 | * } |
||
480 | * } |
||
481 | * ) |
||
482 | */ |
||
483 | protected $twitter; |
||
484 | |||
485 | /** |
||
486 | * @var string |
||
487 | * |
||
488 | * @ORM\Column(name="linkedin", type="string", length=255, nullable=true) |
||
489 | * @ConfigField( |
||
490 | * defaultValues={ |
||
491 | * "dataaudit"={"auditable"=true}, |
||
492 | * "importexport"={ |
||
493 | * "order"=180 |
||
494 | * } |
||
495 | * } |
||
496 | * ) |
||
497 | */ |
||
498 | protected $linkedIn; |
||
499 | |||
500 | /** |
||
501 | * Constructor |
||
502 | */ |
||
503 | View Code Duplication | public function __construct() |
|
512 | |||
513 | /** |
||
514 | * Get id |
||
515 | * |
||
516 | * @return integer |
||
517 | */ |
||
518 | public function getId() |
||
522 | |||
523 | /** |
||
524 | * Set topic |
||
525 | * |
||
526 | * @param string $name |
||
527 | * |
||
528 | * @return Lead |
||
529 | */ |
||
530 | public function setName($name) |
||
536 | |||
537 | /** |
||
538 | * Get topic |
||
539 | * |
||
540 | * @return string |
||
541 | */ |
||
542 | public function getName() |
||
546 | |||
547 | /** |
||
548 | * @param string $namePrefix |
||
549 | * |
||
550 | * @return Lead |
||
551 | */ |
||
552 | public function setNamePrefix($namePrefix) |
||
558 | |||
559 | /** |
||
560 | * @return string |
||
561 | */ |
||
562 | public function getNamePrefix() |
||
566 | |||
567 | /** |
||
568 | * Set first name |
||
569 | * |
||
570 | * @param string $firstName |
||
571 | * |
||
572 | * @return Lead |
||
573 | */ |
||
574 | public function setFirstName($firstName) |
||
580 | |||
581 | /** |
||
582 | * Get first name |
||
583 | * |
||
584 | * @return string |
||
585 | */ |
||
586 | public function getFirstName() |
||
590 | |||
591 | /** |
||
592 | * @return string |
||
593 | */ |
||
594 | public function getMiddleName() |
||
598 | |||
599 | /** |
||
600 | * @param string $middleName |
||
601 | * |
||
602 | * @return Lead |
||
603 | */ |
||
604 | public function setMiddleName($middleName) |
||
610 | |||
611 | /** |
||
612 | * Set last name |
||
613 | * |
||
614 | * @param string $lastName |
||
615 | * |
||
616 | * @return Lead |
||
617 | */ |
||
618 | public function setLastName($lastName) |
||
624 | |||
625 | /** |
||
626 | * Get lastName |
||
627 | * |
||
628 | * @return string |
||
629 | */ |
||
630 | public function getLastName() |
||
634 | |||
635 | /** |
||
636 | * @param string $nameSuffix |
||
637 | * |
||
638 | * @return Lead |
||
639 | */ |
||
640 | public function setNameSuffix($nameSuffix) |
||
646 | |||
647 | /** |
||
648 | * @return string |
||
649 | */ |
||
650 | public function getNameSuffix() |
||
654 | |||
655 | /** |
||
656 | * Set job title |
||
657 | * |
||
658 | * @param string $jobTitle |
||
659 | * |
||
660 | * @return Lead |
||
661 | */ |
||
662 | public function setJobTitle($jobTitle) |
||
668 | |||
669 | /** |
||
670 | * Get job title |
||
671 | * |
||
672 | * @return string |
||
673 | */ |
||
674 | public function getJobTitle() |
||
678 | |||
679 | /** |
||
680 | * Set company name |
||
681 | * |
||
682 | * @param string $companyName |
||
683 | * |
||
684 | * @return Lead |
||
685 | */ |
||
686 | public function setCompanyName($companyName) |
||
692 | |||
693 | /** |
||
694 | * Get company name |
||
695 | * |
||
696 | * @return string |
||
697 | */ |
||
698 | public function getCompanyName() |
||
702 | |||
703 | /** |
||
704 | * Set website |
||
705 | * |
||
706 | * @param string $website |
||
707 | * |
||
708 | * @return Lead |
||
709 | */ |
||
710 | public function setWebsite($website) |
||
716 | |||
717 | /** |
||
718 | * Get website |
||
719 | * |
||
720 | * @return string |
||
721 | */ |
||
722 | public function getWebsite() |
||
726 | |||
727 | /** |
||
728 | * Set number of employees |
||
729 | * |
||
730 | * @param integer $numberOfEmployees |
||
731 | * |
||
732 | * @return Lead |
||
733 | */ |
||
734 | public function setNumberOfEmployees($numberOfEmployees) |
||
740 | |||
741 | /** |
||
742 | * Get number of employees |
||
743 | * |
||
744 | * @return integer |
||
745 | */ |
||
746 | public function getNumberOfEmployees() |
||
750 | |||
751 | /** |
||
752 | * Set industry |
||
753 | * |
||
754 | * @param string $industry |
||
755 | * |
||
756 | * @return Lead |
||
757 | */ |
||
758 | public function setIndustry($industry) |
||
764 | |||
765 | /** |
||
766 | * Get industry |
||
767 | * |
||
768 | * @return string |
||
769 | */ |
||
770 | public function getIndustry() |
||
774 | |||
775 | /** |
||
776 | * Add address |
||
777 | * |
||
778 | * @param AbstractAddress $address |
||
779 | * |
||
780 | * @return Lead |
||
781 | */ |
||
782 | View Code Duplication | public function addAddress(AbstractAddress $address) |
|
792 | |||
793 | /** |
||
794 | * Gets primary address if it's available. |
||
795 | * |
||
796 | * @return LeadAddress|null |
||
797 | */ |
||
798 | View Code Duplication | public function getPrimaryAddress() |
|
812 | |||
813 | /** |
||
814 | * @param LeadAddress $address |
||
815 | * |
||
816 | * @return Lead |
||
817 | */ |
||
818 | View Code Duplication | public function setPrimaryAddress(LeadAddress $address) |
|
832 | |||
833 | /** |
||
834 | * Get addresses |
||
835 | * |
||
836 | * @return Collection|AbstractAddress[] |
||
837 | */ |
||
838 | public function getAddresses() |
||
842 | |||
843 | /** |
||
844 | * @param AbstractAddress $address |
||
845 | * @return bool |
||
846 | */ |
||
847 | public function containsAddress(AbstractAddress $address) |
||
851 | |||
852 | /** |
||
853 | * Remove address |
||
854 | * |
||
855 | * @param AbstractAddress $address |
||
856 | * @return Lead |
||
857 | */ |
||
858 | public function removeAddress(AbstractAddress $address) |
||
866 | |||
867 | /** |
||
868 | * @deprecated since 1.10 |
||
869 | * |
||
870 | * @return bool |
||
871 | */ |
||
872 | public function hasAddress() |
||
876 | |||
877 | /** |
||
878 | * @deprecated since 1.10 |
||
879 | * |
||
880 | * @param $address |
||
881 | * @return $this |
||
882 | */ |
||
883 | public function setAddress($address) |
||
887 | |||
888 | /** |
||
889 | * @param Contact $contact |
||
890 | * |
||
891 | * @return Lead |
||
892 | */ |
||
893 | public function setContact($contact) |
||
899 | |||
900 | /** |
||
901 | * @return Contact |
||
902 | */ |
||
903 | public function getContact() |
||
907 | |||
908 | /** |
||
909 | * Get contact created date/time |
||
910 | * |
||
911 | * @return \DateTime |
||
912 | */ |
||
913 | public function getCreatedAt() |
||
917 | |||
918 | /** |
||
919 | * @param \DateTime $created |
||
920 | * |
||
921 | * @return Lead |
||
922 | */ |
||
923 | public function setCreatedAt($created) |
||
929 | |||
930 | /** |
||
931 | * Get lead last update date/time |
||
932 | * |
||
933 | * @return \DateTime |
||
934 | */ |
||
935 | public function getUpdatedAt() |
||
939 | |||
940 | /** |
||
941 | * @param \DateTime $updated |
||
942 | * |
||
943 | * @return Lead |
||
944 | */ |
||
945 | public function setUpdatedAt($updated) |
||
951 | |||
952 | /** |
||
953 | * @return string |
||
954 | */ |
||
955 | public function __toString() |
||
959 | |||
960 | /** |
||
961 | * Pre persist event listener |
||
962 | * |
||
963 | * @ORM\PrePersist |
||
964 | */ |
||
965 | public function beforeSave() |
||
969 | |||
970 | /** |
||
971 | * Pre update event handler |
||
972 | * @ORM\PreUpdate |
||
973 | */ |
||
974 | public function beforeUpdate() |
||
978 | |||
979 | /** |
||
980 | * @return User |
||
981 | */ |
||
982 | public function getOwner() |
||
986 | |||
987 | /** |
||
988 | * @param User $owningUser |
||
989 | * |
||
990 | * @return Lead |
||
991 | */ |
||
992 | public function setOwner($owningUser) |
||
998 | |||
999 | /** |
||
1000 | * Get opportunities |
||
1001 | * |
||
1002 | * @return ArrayCollection |
||
1003 | */ |
||
1004 | public function getOpportunities() |
||
1008 | |||
1009 | /** |
||
1010 | * Add opportunity |
||
1011 | * |
||
1012 | * @param Opportunity $opportunity |
||
1013 | * |
||
1014 | * @return Lead |
||
1015 | */ |
||
1016 | View Code Duplication | public function addOpportunity(Opportunity $opportunity) |
|
1025 | |||
1026 | /** |
||
1027 | * @param Opportunity $opportunity |
||
1028 | * |
||
1029 | * @return Lead |
||
1030 | */ |
||
1031 | View Code Duplication | public function removeOpportunity(Opportunity $opportunity) |
|
1040 | |||
1041 | /** |
||
1042 | * @return string |
||
1043 | */ |
||
1044 | public function getNotes() |
||
1048 | |||
1049 | /** |
||
1050 | * @param string $notes |
||
1051 | * |
||
1052 | * @return Lead |
||
1053 | */ |
||
1054 | public function setNotes($notes) |
||
1060 | |||
1061 | /** |
||
1062 | * @param B2bCustomer $customer |
||
1063 | * @TODO remove null after BAP-5248 |
||
1064 | */ |
||
1065 | public function setCustomer(B2bCustomer $customer = null) |
||
1069 | |||
1070 | /** |
||
1071 | * @return B2bCustomer |
||
1072 | */ |
||
1073 | public function getCustomer() |
||
1077 | |||
1078 | /** |
||
1079 | * Set organization |
||
1080 | * |
||
1081 | * @param Organization $organization |
||
1082 | * @return Lead |
||
1083 | */ |
||
1084 | public function setOrganization(Organization $organization = null) |
||
1090 | |||
1091 | /** |
||
1092 | * Get organization |
||
1093 | * |
||
1094 | * @return Organization |
||
1095 | */ |
||
1096 | public function getOrganization() |
||
1100 | |||
1101 | /** |
||
1102 | * Remove Customer |
||
1103 | * |
||
1104 | * @return Lead |
||
1105 | */ |
||
1106 | public function removeCustomer() |
||
1112 | |||
1113 | /** |
||
1114 | * Set phones. |
||
1115 | * |
||
1116 | * This method could not be named setPhones because of bug CRM-253. |
||
1117 | * |
||
1118 | * @param Collection|LeadPhone[] $phones |
||
1119 | * |
||
1120 | * @return Lead |
||
1121 | */ |
||
1122 | public function resetPhones($phones) |
||
1132 | |||
1133 | /** |
||
1134 | * Add phone |
||
1135 | * |
||
1136 | * @param LeadPhone $phone |
||
1137 | * |
||
1138 | * @return Lead |
||
1139 | */ |
||
1140 | View Code Duplication | public function addPhone(LeadPhone $phone) |
|
1149 | |||
1150 | /** |
||
1151 | * Remove phone |
||
1152 | * |
||
1153 | * @param LeadPhone $phone |
||
1154 | * |
||
1155 | * @return Lead |
||
1156 | */ |
||
1157 | public function removePhone(LeadPhone $phone) |
||
1165 | |||
1166 | /** |
||
1167 | * Get phones |
||
1168 | * |
||
1169 | * @return Collection|LeadPhone[] |
||
1170 | */ |
||
1171 | public function getPhones() |
||
1175 | |||
1176 | /** |
||
1177 | * @param LeadPhone $phone |
||
1178 | * |
||
1179 | * @return bool |
||
1180 | */ |
||
1181 | public function hasPhone(LeadPhone $phone) |
||
1185 | |||
1186 | /** |
||
1187 | * Gets primary phone if it's available. |
||
1188 | * |
||
1189 | * @return LeadPhone|null |
||
1190 | */ |
||
1191 | View Code Duplication | public function getPrimaryPhone() |
|
1204 | |||
1205 | /** |
||
1206 | * @param LeadPhone $phone |
||
1207 | * |
||
1208 | * @return Lead |
||
1209 | */ |
||
1210 | View Code Duplication | public function setPrimaryPhone(LeadPhone $phone) |
|
1223 | |||
1224 | /** |
||
1225 | * Set emails. |
||
1226 | ** |
||
1227 | * @param Collection|LeadEmail[] $emails |
||
1228 | * |
||
1229 | * @return Lead |
||
1230 | */ |
||
1231 | public function resetEmails($emails) |
||
1241 | |||
1242 | /** |
||
1243 | * Add email |
||
1244 | * |
||
1245 | * @param LeadEmail $email |
||
1246 | * |
||
1247 | * @return Lead |
||
1248 | */ |
||
1249 | View Code Duplication | public function addEmail(LeadEmail $email) |
|
1258 | |||
1259 | /** |
||
1260 | * Remove email |
||
1261 | * |
||
1262 | * @param LeadEmail $email |
||
1263 | * |
||
1264 | * @return Lead |
||
1265 | */ |
||
1266 | public function removeEmail(LeadEmail $email) |
||
1274 | |||
1275 | /** |
||
1276 | * Get emails |
||
1277 | * |
||
1278 | * @return Collection|LeadEmail[] |
||
1279 | */ |
||
1280 | public function getEmails() |
||
1284 | |||
1285 | /** |
||
1286 | * {@inheritdoc} |
||
1287 | */ |
||
1288 | public function getEmail() |
||
1297 | |||
1298 | /** |
||
1299 | * @param LeadEmail $email |
||
1300 | * @return bool |
||
1301 | */ |
||
1302 | public function hasEmail(LeadEmail $email) |
||
1306 | |||
1307 | /** |
||
1308 | * Gets primary email if it's available. |
||
1309 | * |
||
1310 | * @return LeadEmail|null |
||
1311 | */ |
||
1312 | View Code Duplication | public function getPrimaryEmail() |
|
1325 | |||
1326 | /** |
||
1327 | * @return string |
||
1328 | */ |
||
1329 | public function getTwitter() |
||
1333 | |||
1334 | /** |
||
1335 | * @param string $twitter |
||
1336 | */ |
||
1337 | public function setTwitter($twitter) |
||
1341 | |||
1342 | /** |
||
1343 | * @return string |
||
1344 | */ |
||
1345 | public function getLinkedIn() |
||
1349 | |||
1350 | /** |
||
1351 | * @param string $linkedIn |
||
1352 | */ |
||
1353 | public function setLinkedIn($linkedIn) |
||
1357 | } |
||
1358 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.