| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 1 | protected function getData($notifiable, Notification $notification) |
|
| 37 | { |
||
| 38 | 1 | if (method_exists($notification, 'toDatabase')) { |
|
| 39 | 1 | $data = $notification->toDatabase($notifiable); |
|
|
|
|||
| 40 | |||
| 41 | 1 | return is_array($data) ? $data : $data->data; |
|
| 42 | } elseif (method_exists($notification, 'toArray')) { |
||
| 43 | return $notification->toArray($notifiable); |
||
| 44 | } |
||
| 45 | |||
| 46 | throw new RuntimeException( |
||
| 47 | 'Notification is missing toDatabase / toArray method.' |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.