Passed
Push — main ( 66bbba...4d6295 )
by mohsen
03:38 queued 55s
created

detemineNotificationClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace MohsenAbrishami\Stethoscope\Listeners;
4
5
class SendResourceLogNotification
6
{
7
    public function handle($resourceLogs)
8
    {
9
        if (!is_null(config('stethoscope.notifications.notifiable'))) {
10
            $notifiable = app(config('stethoscope.notifications.notifiable'));
11
12
            $notificationClass = $this->detemineNotificationClass();
13
14
            $notifiable->notify(
15
                new $notificationClass($resourceLogs)
16
            );
17
        }
18
    }
19
20
    private function detemineNotificationClass()
21
    {
22
        $notifications = config('stethoscope.notifications.notifications');
23
24
        return array_keys($notifications)[0];
25
    }
26
}
27