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

SendResourceLogNotification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 20
rs 10
c 2
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A detemineNotificationClass() 0 5 1
A handle() 0 9 2
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