MailDriver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 33
wmc 2
lcom 1
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A send() 0 10 1
1
<?php
2
3
namespace Adriandmitroca\LaravelExceptionMonitor\Drivers;
4
5
use Illuminate\Contracts\Mail\Mailer;
6
7
class MailDriver implements DriverInterface
8
{
9
10
    protected $mailer;
11
12
13
    /**
14
     * MailDriver constructor.
15
     *
16
     * @param Mailer $mailer
17
     */
18
    public function __construct(Mailer $mailer)
19
    {
20
        $this->mailer = $mailer;
21
    }
22
23
24
    /**
25
     * It sends e-mail notification for a given exception.
26
     *
27
     * @param \Exception $exception
28
     */
29
    public function send(\Exception $exception)
30
    {
31
        $config = config('exception-monitor.mail');
32
33
        $this->mailer->send('laravel-exception-monitor::email', [ 'e' => $exception ], function ($m) use ($config) {
34
            $m->from($config['from']);
35
            $m->to($config['to']);
36
            $m->subject('A exception has been thrown on ' . config('app.url'));
37
        });
38
    }
39
}