Conditions | 2 |
Paths | 2 |
Total Lines | 25 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public function format(NotificationInterface $notification) |
||
13 | { |
||
14 | $message = new Message(); |
||
15 | // $notificationData = $notification->getDataArray(); |
||
|
|||
16 | |||
17 | /** @var Slackable $notifiable */ |
||
18 | $notifiable = $notification->getNotifiable(); |
||
19 | if (!$notifiable instanceof Slackable) { |
||
20 | throw new \RuntimeException('Notifiable mustimplement Slackable interface in order to send SMS'); |
||
21 | } |
||
22 | |||
23 | // Build the dispatch data array. |
||
24 | $dispatchData = [ |
||
25 | 'webhook' => $notifiable->getSlackWebhook(), |
||
26 | ]; |
||
27 | |||
28 | // Build the message data array. |
||
29 | $messageData = []; |
||
30 | $messageData['body'] = 'A Hoi hoi! Mullin!'; |
||
31 | |||
32 | $message->setDispatchData($dispatchData); |
||
33 | $message->setMessageData($messageData); |
||
34 | |||
35 | return $message; |
||
36 | } |
||
37 | } |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.