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 MonitorFailed extends BaseNotification |
||
| 13 | { |
||
| 14 | /** @var \Spatie\UptimeMonitor\Events\MonitorFailed */ |
||
| 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 getMonitorProperties($extraProperties = []): array |
||
| 51 | |||
| 52 | public function isStillRelevant(): bool |
||
| 56 | |||
| 57 | public function setEvent(MonitorFailedEvent $event) |
||
| 63 | } |
||
| 64 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.