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 Event 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 Event, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
28 | class Event extends Component |
||
29 | { |
||
30 | const TIME_TRANSPARENCY_OPAQUE = 'OPAQUE'; |
||
31 | const TIME_TRANSPARENCY_TRANSPARENT = 'TRANSPARENT'; |
||
32 | |||
33 | const STATUS_TENTATIVE = 'TENTATIVE'; |
||
34 | const STATUS_CONFIRMED = 'CONFIRMED'; |
||
35 | const STATUS_CANCELLED = 'CANCELLED'; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $uniqueId; |
||
41 | |||
42 | /** |
||
43 | * The property indicates the date/time that the instance of |
||
44 | * the iCalendar object was created. |
||
45 | * |
||
46 | * The value MUST be specified in the UTC time format. |
||
47 | * |
||
48 | * @var \DateTime |
||
49 | */ |
||
50 | protected $dtStamp; |
||
51 | |||
52 | /** |
||
53 | * @var \DateTime |
||
54 | */ |
||
55 | protected $dtStart; |
||
56 | |||
57 | /** |
||
58 | * Preferentially chosen over the duration if both are set. |
||
59 | * |
||
60 | * @var \DateTime |
||
61 | */ |
||
62 | protected $dtEnd; |
||
63 | |||
64 | /** |
||
65 | * @var \DateInterval |
||
66 | */ |
||
67 | protected $duration; |
||
68 | |||
69 | /** |
||
70 | * @var bool |
||
71 | */ |
||
72 | protected $noTime = false; |
||
73 | |||
74 | /** |
||
75 | * @var string |
||
76 | */ |
||
77 | protected $url; |
||
78 | |||
79 | /** |
||
80 | * @var string |
||
81 | */ |
||
82 | protected $location; |
||
83 | |||
84 | /** |
||
85 | * @var string |
||
86 | */ |
||
87 | protected $locationTitle; |
||
88 | |||
89 | /** |
||
90 | * @var string |
||
91 | */ |
||
92 | protected $locationGeo; |
||
93 | |||
94 | /** |
||
95 | * @var string |
||
96 | */ |
||
97 | protected $summary; |
||
98 | |||
99 | /** |
||
100 | * @var Organizer |
||
101 | */ |
||
102 | protected $organizer; |
||
103 | |||
104 | /** |
||
105 | * @see http://www.ietf.org/rfc/rfc2445.txt 4.8.2.7 Time Transparency |
||
106 | * |
||
107 | * @var string |
||
108 | */ |
||
109 | protected $transparency = self::TIME_TRANSPARENCY_OPAQUE; |
||
110 | |||
111 | /** |
||
112 | * If set to true the timezone will be added to the event. |
||
113 | * |
||
114 | * @var bool |
||
115 | */ |
||
116 | protected $useTimezone = false; |
||
117 | |||
118 | /** |
||
119 | * @var int |
||
120 | */ |
||
121 | protected $sequence = 0; |
||
122 | |||
123 | /** |
||
124 | * @var Attendees |
||
125 | */ |
||
126 | protected $attendees; |
||
127 | |||
128 | /** |
||
129 | * @var string |
||
130 | */ |
||
131 | protected $description; |
||
132 | |||
133 | /** |
||
134 | * @var string |
||
135 | */ |
||
136 | protected $descriptionHTML; |
||
137 | |||
138 | /** |
||
139 | * @var string |
||
140 | */ |
||
141 | protected $status; |
||
142 | |||
143 | /** |
||
144 | * @var RecurrenceRule |
||
145 | */ |
||
146 | protected $recurrenceRule; |
||
147 | |||
148 | /** |
||
149 | * This property specifies the date and time that the calendar |
||
150 | * information was created. |
||
151 | * |
||
152 | * The value MUST be specified in the UTC time format. |
||
153 | * |
||
154 | * @var \DateTime |
||
155 | */ |
||
156 | protected $created; |
||
157 | |||
158 | /** |
||
159 | * The property specifies the date and time that the information |
||
160 | * associated with the calendar component was last revised. |
||
161 | * |
||
162 | * The value MUST be specified in the UTC time format. |
||
163 | * |
||
164 | * @var \DateTime |
||
165 | */ |
||
166 | protected $modified; |
||
167 | |||
168 | /** |
||
169 | * Indicates if the UTC time should be used or not. |
||
170 | * |
||
171 | * @var bool |
||
172 | */ |
||
173 | protected $useUtc = true; |
||
174 | |||
175 | /** |
||
176 | * @var bool |
||
177 | */ |
||
178 | protected $cancelled; |
||
179 | |||
180 | /** |
||
181 | * This property is used to specify categories or subtypes |
||
182 | * of the calendar component. The categories are useful in searching |
||
183 | * for a calendar component of a particular type and category. |
||
184 | * |
||
185 | * @see https://tools.ietf.org/html/rfc5545#section-3.8.1.2 |
||
186 | * |
||
187 | * @var array |
||
188 | */ |
||
189 | protected $categories; |
||
190 | |||
191 | /** |
||
192 | * https://tools.ietf.org/html/rfc5545#section-3.8.1.3. |
||
193 | * |
||
194 | * @var bool |
||
195 | */ |
||
196 | protected $isPrivate = false; |
||
197 | |||
198 | /** |
||
199 | * Dates to be excluded from a series of events. |
||
200 | * |
||
201 | * @var \DateTime[] |
||
202 | */ |
||
203 | protected $exDates = []; |
||
204 | |||
205 | /** |
||
206 | * @var RecurrenceId |
||
207 | */ |
||
208 | protected $recurrenceId; |
||
209 | |||
210 | 4 | public function __construct($uniqueId = null) |
|
211 | { |
||
212 | 4 | if (null == $uniqueId) { |
|
213 | 2 | $uniqueId = uniqid(); |
|
214 | } |
||
215 | |||
216 | 4 | $this->uniqueId = $uniqueId; |
|
217 | 4 | } |
|
218 | |||
219 | /** |
||
220 | * {@inheritdoc} |
||
221 | */ |
||
222 | 4 | public function getType() |
|
223 | { |
||
224 | 4 | return 'VEVENT'; |
|
225 | } |
||
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | */ |
||
230 | 4 | public function buildPropertyBag() |
|
231 | { |
||
232 | 4 | $propertyBag = new PropertyBag(); |
|
233 | |||
234 | // mandatory information |
||
235 | 4 | $propertyBag->set('UID', $this->uniqueId); |
|
|
|||
236 | |||
237 | 4 | $propertyBag->add(new DateTimeProperty('DTSTART', $this->dtStart, $this->noTime, $this->useTimezone, $this->useUtc)); |
|
238 | 4 | $propertyBag->set('SEQUENCE', $this->sequence); |
|
239 | 4 | $propertyBag->set('TRANSP', $this->transparency); |
|
240 | |||
241 | 4 | if ($this->status) { |
|
242 | $propertyBag->set('STATUS', $this->status); |
||
243 | } |
||
244 | |||
245 | // An event can have a 'dtend' or 'duration', but not both. |
||
246 | 4 | if (null !== $this->dtEnd) { |
|
247 | 2 | $propertyBag->add(new DateTimeProperty('DTEND', $this->dtEnd, $this->noTime, $this->useTimezone, $this->useUtc)); |
|
248 | 2 | } elseif (null != $this->duration) { |
|
249 | $propertyBag->set('DURATION', $this->duration->format('P%dDT%hH%iM%sS')); |
||
250 | } |
||
251 | |||
252 | // optional information |
||
253 | 4 | if (null != $this->url) { |
|
254 | $propertyBag->set('URL', $this->url); |
||
255 | } |
||
256 | |||
257 | 4 | if (null != $this->location) { |
|
258 | $propertyBag->set('LOCATION', $this->location); |
||
259 | |||
260 | if (null != $this->locationGeo) { |
||
261 | $propertyBag->add( |
||
262 | new Property( |
||
263 | 'X-APPLE-STRUCTURED-LOCATION', |
||
264 | 'geo:' . $this->locationGeo, |
||
265 | [ |
||
266 | 'VALUE' => 'URI', |
||
267 | 'X-ADDRESS' => $this->location, |
||
268 | 'X-APPLE-RADIUS' => 49, |
||
269 | 'X-TITLE' => $this->locationTitle, |
||
270 | ] |
||
271 | ) |
||
272 | ); |
||
273 | $propertyBag->set('GEO', $this->locationGeo); |
||
274 | } |
||
275 | } |
||
276 | |||
277 | 4 | if (null != $this->summary) { |
|
278 | $propertyBag->set('SUMMARY', $this->summary); |
||
279 | } |
||
280 | |||
281 | 4 | if (null != $this->attendees) { |
|
282 | $propertyBag->add($this->attendees); |
||
283 | } |
||
284 | |||
285 | 4 | $propertyBag->set('CLASS', $this->isPrivate ? 'PRIVATE' : 'PUBLIC'); |
|
286 | |||
287 | 4 | if (null != $this->description) { |
|
288 | 2 | $propertyBag->set('DESCRIPTION', new Description($this->description)); |
|
289 | } |
||
290 | |||
291 | 4 | if (null != $this->descriptionHTML) { |
|
292 | $propertyBag->add( |
||
293 | new Property( |
||
294 | 'X-ALT-DESC', |
||
295 | $this->descriptionHTML, |
||
296 | [ |
||
297 | 'FMTTYPE' => 'text/html', |
||
298 | ] |
||
299 | ) |
||
300 | ); |
||
301 | } |
||
302 | |||
303 | 4 | if (null != $this->recurrenceRule) { |
|
304 | $propertyBag->set('RRULE', $this->recurrenceRule); |
||
305 | } |
||
306 | |||
307 | 4 | if (null != $this->recurrenceId) { |
|
308 | $this->recurrenceId->applyTimeSettings($this->noTime, $this->useTimezone, $this->useUtc); |
||
309 | $propertyBag->add($this->recurrenceId); |
||
310 | } |
||
311 | |||
312 | 4 | if (!empty($this->exDates)) { |
|
313 | $propertyBag->add(new DateTimesProperty('EXDATE', $this->exDates, $this->noTime, $this->useTimezone, $this->useUtc)); |
||
314 | } |
||
315 | |||
316 | 4 | if ($this->cancelled) { |
|
317 | $propertyBag->set('STATUS', 'CANCELLED'); |
||
318 | } |
||
319 | |||
320 | 4 | if (null != $this->organizer) { |
|
321 | 2 | $propertyBag->add($this->organizer); |
|
322 | } |
||
323 | |||
324 | 4 | if ($this->noTime) { |
|
325 | $propertyBag->set('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); |
||
326 | } |
||
327 | |||
328 | 4 | if (null != $this->categories) { |
|
329 | $propertyBag->set('CATEGORIES', $this->categories); |
||
330 | } |
||
331 | |||
332 | 4 | $propertyBag->add( |
|
333 | 4 | new DateTimeProperty('DTSTAMP', $this->dtStamp ?: new \DateTime(), false, false, true) |
|
334 | ); |
||
335 | |||
336 | 4 | if ($this->created) { |
|
337 | $propertyBag->add(new DateTimeProperty('CREATED', $this->created, false, false, true)); |
||
338 | } |
||
339 | |||
340 | 4 | if ($this->modified) { |
|
341 | $propertyBag->add(new DateTimeProperty('LAST-MODIFIED', $this->modified, false, false, true)); |
||
342 | } |
||
343 | |||
344 | 4 | return $propertyBag; |
|
345 | } |
||
346 | |||
347 | /** |
||
348 | * @param $dtEnd |
||
349 | * |
||
350 | * @return $this |
||
351 | */ |
||
352 | 2 | public function setDtEnd($dtEnd) |
|
353 | { |
||
354 | 2 | $this->dtEnd = $dtEnd; |
|
355 | |||
356 | 2 | return $this; |
|
357 | } |
||
358 | |||
359 | public function getDtEnd() |
||
360 | { |
||
361 | return $this->dtEnd; |
||
362 | } |
||
363 | |||
364 | 2 | public function setDtStart($dtStart) |
|
365 | { |
||
366 | 2 | $this->dtStart = $dtStart; |
|
367 | |||
368 | 2 | return $this; |
|
369 | } |
||
370 | |||
371 | /** |
||
372 | * @param $dtStamp |
||
373 | * |
||
374 | * @return $this |
||
375 | */ |
||
376 | public function setDtStamp($dtStamp) |
||
377 | { |
||
378 | $this->dtStamp = $dtStamp; |
||
379 | |||
380 | return $this; |
||
381 | } |
||
382 | |||
383 | /** |
||
384 | * @param $duration |
||
385 | * |
||
386 | * @return $this |
||
387 | */ |
||
388 | public function setDuration($duration) |
||
389 | { |
||
390 | $this->duration = $duration; |
||
391 | |||
392 | return $this; |
||
393 | } |
||
394 | |||
395 | /** |
||
396 | * @param $location |
||
397 | * @param string $title |
||
398 | * @param null $geo |
||
399 | * |
||
400 | * @return $this |
||
401 | */ |
||
402 | public function setLocation($location, $title = '', $geo = null) |
||
403 | { |
||
404 | $this->location = $location; |
||
405 | $this->locationTitle = $title; |
||
406 | $this->locationGeo = $geo; |
||
407 | |||
408 | return $this; |
||
409 | } |
||
410 | |||
411 | /** |
||
412 | * @param $noTime |
||
413 | * |
||
414 | * @return $this |
||
415 | */ |
||
416 | public function setNoTime($noTime) |
||
417 | { |
||
418 | $this->noTime = $noTime; |
||
419 | |||
420 | return $this; |
||
421 | } |
||
422 | |||
423 | /** |
||
424 | * @param int $sequence |
||
425 | * |
||
426 | * @return $this |
||
427 | */ |
||
428 | public function setSequence($sequence) |
||
429 | { |
||
430 | $this->sequence = $sequence; |
||
431 | |||
432 | return $this; |
||
433 | } |
||
434 | |||
435 | /** |
||
436 | * @return int |
||
437 | */ |
||
438 | public function getSequence() |
||
439 | { |
||
440 | return $this->sequence; |
||
441 | } |
||
442 | |||
443 | /** |
||
444 | * @param Organizer $organizer |
||
445 | * |
||
446 | * @return $this |
||
447 | */ |
||
448 | 2 | public function setOrganizer(Organizer $organizer) |
|
449 | { |
||
450 | 2 | $this->organizer = $organizer; |
|
451 | |||
452 | 2 | return $this; |
|
453 | } |
||
454 | |||
455 | /** |
||
456 | * @param $summary |
||
457 | * |
||
458 | * @return $this |
||
459 | */ |
||
460 | public function setSummary($summary) |
||
461 | { |
||
462 | $this->summary = $summary; |
||
463 | |||
464 | return $this; |
||
465 | } |
||
466 | |||
467 | /** |
||
468 | * @param $uniqueId |
||
469 | * |
||
470 | * @return $this |
||
471 | */ |
||
472 | public function setUniqueId($uniqueId) |
||
473 | { |
||
474 | $this->uniqueId = $uniqueId; |
||
475 | |||
476 | return $this; |
||
477 | } |
||
478 | |||
479 | /** |
||
480 | * @return string |
||
481 | */ |
||
482 | public function getUniqueId() |
||
483 | { |
||
484 | return $this->uniqueId; |
||
485 | } |
||
486 | |||
487 | /** |
||
488 | * @param $url |
||
489 | * |
||
490 | * @return $this |
||
491 | */ |
||
492 | public function setUrl($url) |
||
493 | { |
||
494 | $this->url = $url; |
||
495 | |||
496 | return $this; |
||
497 | } |
||
498 | |||
499 | /** |
||
500 | * @param $useTimezone |
||
501 | * |
||
502 | * @return $this |
||
503 | */ |
||
504 | public function setUseTimezone($useTimezone) |
||
505 | { |
||
506 | $this->useTimezone = $useTimezone; |
||
507 | |||
508 | return $this; |
||
509 | } |
||
510 | |||
511 | /** |
||
512 | * @return bool |
||
513 | */ |
||
514 | public function getUseTimezone() |
||
515 | { |
||
516 | return $this->useTimezone; |
||
517 | } |
||
518 | |||
519 | /** |
||
520 | * @param Attendees $attendees |
||
521 | * |
||
522 | * @return $this |
||
523 | */ |
||
524 | public function setAttendees(Attendees $attendees) |
||
525 | { |
||
526 | $this->attendees = $attendees; |
||
527 | |||
528 | return $this; |
||
529 | } |
||
530 | |||
531 | /** |
||
532 | * @param string $attendee |
||
533 | * @param array $params |
||
534 | * |
||
535 | * @return $this |
||
536 | */ |
||
537 | public function addAttendee($attendee, $params = []) |
||
538 | { |
||
539 | if (!isset($this->attendees)) { |
||
540 | $this->attendees = new Attendees(); |
||
541 | } |
||
542 | $this->attendees->add($attendee, $params); |
||
543 | |||
544 | return $this; |
||
545 | } |
||
546 | |||
547 | /** |
||
548 | * @return Attendees |
||
549 | */ |
||
550 | public function getAttendees() |
||
551 | { |
||
552 | return $this->attendees; |
||
553 | } |
||
554 | |||
555 | /** |
||
556 | * @param $description |
||
557 | * |
||
558 | * @return $this |
||
559 | */ |
||
560 | 2 | public function setDescription($description) |
|
561 | { |
||
562 | 2 | $this->description = $description; |
|
563 | |||
564 | 2 | return $this; |
|
565 | } |
||
566 | |||
567 | /** |
||
568 | * @param $descriptionHTML |
||
569 | * |
||
570 | * @return $this |
||
571 | */ |
||
572 | public function setDescriptionHTML($descriptionHTML) |
||
573 | { |
||
574 | $this->descriptionHTML = $descriptionHTML; |
||
575 | |||
576 | return $this; |
||
577 | } |
||
578 | |||
579 | /** |
||
580 | * @param bool $useUtc |
||
581 | * |
||
582 | * @return $this |
||
583 | */ |
||
584 | public function setUseUtc($useUtc = true) |
||
585 | { |
||
586 | $this->useUtc = $useUtc; |
||
587 | |||
588 | return $this; |
||
589 | } |
||
590 | |||
591 | /** |
||
592 | * @return string |
||
593 | */ |
||
594 | public function getDescription() |
||
595 | { |
||
596 | return $this->description; |
||
597 | } |
||
598 | |||
599 | /** |
||
600 | * @return string |
||
601 | */ |
||
602 | public function getDescriptionHTML() |
||
603 | { |
||
604 | return $this->descriptionHTML; |
||
605 | } |
||
606 | |||
607 | /** |
||
608 | * @param $status |
||
609 | * |
||
610 | * @return $this |
||
611 | */ |
||
612 | public function setCancelled($status) |
||
613 | { |
||
614 | $this->cancelled = (bool) $status; |
||
615 | |||
616 | return $this; |
||
617 | } |
||
618 | |||
619 | /** |
||
620 | * @param $transparency |
||
621 | * |
||
622 | * @return $this |
||
623 | * |
||
624 | * @throws \InvalidArgumentException |
||
625 | */ |
||
626 | View Code Duplication | public function setTimeTransparency($transparency) |
|
627 | { |
||
628 | $transparency = strtoupper($transparency); |
||
629 | if ($transparency === self::TIME_TRANSPARENCY_OPAQUE |
||
630 | || $transparency === self::TIME_TRANSPARENCY_TRANSPARENT |
||
631 | ) { |
||
632 | $this->transparency = $transparency; |
||
633 | } else { |
||
634 | throw new \InvalidArgumentException('Invalid value for transparancy'); |
||
635 | } |
||
636 | |||
637 | return $this; |
||
638 | } |
||
639 | |||
640 | /** |
||
641 | * @param $status |
||
642 | * |
||
643 | * @return $this |
||
644 | * |
||
645 | * @throws \InvalidArgumentException |
||
646 | */ |
||
647 | public function setStatus($status) |
||
648 | { |
||
649 | $status = strtoupper($status); |
||
650 | if ($status == self::STATUS_CANCELLED |
||
651 | || $status == self::STATUS_CONFIRMED |
||
652 | || $status == self::STATUS_TENTATIVE |
||
653 | ) { |
||
654 | $this->status = $status; |
||
655 | } else { |
||
656 | throw new \InvalidArgumentException('Invalid value for status'); |
||
657 | } |
||
658 | |||
659 | return $this; |
||
660 | } |
||
661 | |||
662 | /** |
||
663 | * @param RecurrenceRule $recurrenceRule |
||
664 | * |
||
665 | * @return $this |
||
666 | */ |
||
667 | public function setRecurrenceRule(RecurrenceRule $recurrenceRule) |
||
668 | { |
||
669 | $this->recurrenceRule = $recurrenceRule; |
||
670 | |||
671 | return $this; |
||
672 | } |
||
673 | |||
674 | /** |
||
675 | * @return RecurrenceRule |
||
676 | */ |
||
677 | public function getRecurrenceRule() |
||
678 | { |
||
679 | return $this->recurrenceRule; |
||
680 | } |
||
681 | |||
682 | /** |
||
683 | * @param $dtStamp |
||
684 | * |
||
685 | * @return $this |
||
686 | */ |
||
687 | public function setCreated($dtStamp) |
||
688 | { |
||
689 | $this->created = $dtStamp; |
||
690 | |||
691 | return $this; |
||
692 | } |
||
693 | |||
694 | /** |
||
695 | * @param $dtStamp |
||
696 | * |
||
697 | * @return $this |
||
698 | */ |
||
699 | public function setModified($dtStamp) |
||
700 | { |
||
701 | $this->modified = $dtStamp; |
||
702 | |||
703 | return $this; |
||
704 | } |
||
705 | |||
706 | /** |
||
707 | * @param $categories |
||
708 | * |
||
709 | * @return $this |
||
710 | */ |
||
711 | public function setCategories($categories) |
||
712 | { |
||
713 | $this->categories = $categories; |
||
714 | |||
715 | return $this; |
||
716 | } |
||
717 | |||
718 | /** |
||
719 | * Sets the event privacy. |
||
720 | * |
||
721 | * @param bool $flag |
||
722 | * |
||
723 | * @return $this |
||
724 | */ |
||
725 | public function setIsPrivate($flag) |
||
726 | { |
||
727 | $this->isPrivate = (bool) $flag; |
||
728 | |||
729 | return $this; |
||
730 | } |
||
731 | |||
732 | /** |
||
733 | * @param \DateTime $dateTime |
||
734 | * |
||
735 | * @return \Eluceo\iCal\Component\Event |
||
736 | */ |
||
737 | public function addExDate(\DateTime $dateTime) |
||
738 | { |
||
739 | $this->exDates[] = $dateTime; |
||
740 | |||
741 | return $this; |
||
742 | } |
||
743 | |||
744 | /** |
||
745 | * @return \DateTime[] |
||
746 | */ |
||
747 | public function getExDates() |
||
751 | |||
752 | /** |
||
753 | * @param \DateTime[] |
||
754 | * |
||
755 | * @return \Eluceo\iCal\Component\Event |
||
756 | */ |
||
757 | public function setExDates(array $exDates) |
||
758 | { |
||
759 | $this->exDates = $exDates; |
||
760 | |||
761 | return $this; |
||
762 | } |
||
763 | |||
764 | /** |
||
765 | * @return \Eluceo\iCal\Property\Event\RecurrenceId |
||
766 | */ |
||
767 | public function getRecurrenceId() |
||
768 | { |
||
769 | return $this->recurrenceId; |
||
770 | } |
||
771 | |||
772 | /** |
||
773 | * @param RecurrenceId $recurrenceId |
||
774 | * |
||
775 | * @return \Eluceo\iCal\Component\Event |
||
776 | */ |
||
777 | public function setRecurrenceId(RecurrenceId $recurrenceId) |
||
778 | { |
||
779 | $this->recurrenceId = $recurrenceId; |
||
780 | |||
781 | return $this; |
||
782 | } |
||
783 | } |
||
784 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.