HandleNotifyException::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 10
nc 1
nop 1
dl 0
loc 12
ccs 0
cts 11
cp 0
crap 2
rs 9.9332
c 1
b 0
f 1
1
<?php
2
3
namespace Someshwer\Firewall\src\Listeners;
4
5
use Illuminate\Support\Facades\Mail;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\Mail was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Someshwer\Firewall\src\Events\NotifyException;
7
8
class HandleNotifyException
9
{
10
    /**
11
     * Create the event listener.
12
     */
13
    public function __construct()
14
    {
15
        //
16
    }
17
18
    /**
19
     * Handle the event.
20
     *
21
     * @param NotifyException $event
22
     *
23
     * @return void
24
     */
25
    public function handle(NotifyException $event)
26
    {
27
        $exception = $event->exception_data;
28
        Mail::send(
29
            'package_redirect::exception_notification_view',
30
            ['exception' => $exception],
31
            function ($message) {
32
                $from = config('firewall.notify_exceptions.mail_from');
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
                $from = /** @scrutinizer ignore-call */ config('firewall.notify_exceptions.mail_from');
Loading history...
33
                $to = config('firewall.notify_exceptions.mail_to');
34
                $subject = config('firewall.notify_exceptions.subject');
35
                $message->from($from, $subject);
36
                $message->to($to);
37
            }
38
        );
39
    }
40
}
41