Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | protected function determineNotification($event): Notification |
||
39 | { |
||
40 | $eventName = class_basename($event); |
||
41 | |||
42 | $notificationClass = collect($this->config->get('laravel-backup.notifications.notifications')) |
||
43 | ->keys() |
||
44 | ->first(function ($notificationClass) use ($eventName) { |
||
45 | $notificationName = class_basename($notificationClass); |
||
46 | |||
47 | return $notificationName === $eventName; |
||
48 | }); |
||
49 | |||
50 | if (! $notificationClass) { |
||
51 | throw NotificationCouldNotBeSent::noNotifcationClassForEvent($event); |
||
52 | } |
||
53 | |||
54 | return app($notificationClass)->setEvent($event); |
||
55 | } |
||
56 | |||
64 |