Mail   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A send() 0 10 1
1
<?php
2
3
namespace EricMakesStuff\ServerMonitor\Notifications\Senders;
4
5
use Illuminate\Contracts\Config\Repository;
6
use Illuminate\Contracts\Mail\Mailer;
7
use Illuminate\Mail\Message;
8
use EricMakesStuff\ServerMonitor\Notifications\BaseSender;
9
10
class Mail extends BaseSender
11
{
12
    /** @var Mailer */
13
    protected $mailer;
14
15
    /** @var array */
16
    protected $config;
17
18
    /**
19
     * @param Mailer     $mailer
20
     * @param Repository $config
21
     */
22
    public function __construct(Mailer $mailer, Repository $config)
23
    {
24
        $this->config = $config->get('server-monitor.notifications.mail');
0 ignored issues
show
Documentation Bug introduced by
It seems like $config->get('server-monitor.notifications.mail') of type * is incompatible with the declared type array of property $config.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
25
26
        $this->mailer = $mailer;
27
    }
28
29
    public function send()
30
    {
31
        $this->mailer->raw($this->message, function (Message $message) {
32
33
            $message
34
                ->subject($this->subject)
35
                ->from($this->config['from'])
36
                ->to($this->config['to']);
37
        });
38
    }
39
}
40