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:
1 | <?php |
||
12 | class MonitorSucceeded extends BaseNotification |
||
13 | { |
||
14 | /** @var \Spatie\UptimeMonitor\Events\MonitorSucceeded */ |
||
15 | public $event; |
||
16 | |||
17 | /** |
||
18 | * Get the mail representation of the notification. |
||
19 | * |
||
20 | * @param mixed $notifiable |
||
21 | * @return \Illuminate\Notifications\Messages\MailMessage |
||
22 | */ |
||
23 | public function toMail($notifiable) |
||
32 | |||
33 | View Code Duplication | public function toSlack($notifiable) |
|
42 | |||
43 | public function isStillRelevant(): bool |
||
47 | |||
48 | public function setEvent(MonitorSucceededEvent $event) |
||
54 | } |
||
55 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.