Completed
Push — master ( f62f21...f72c97 )
by Freek
05:09
created

Mail   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A send() 0 10 1
1
<?php
2
3
namespace Spatie\Backup\Notifications\Senders;
4
5
use Illuminate\Mail\Message;
6
use Spatie\Backup\Notifications\BaseSender;
7
8
class Mail extends BaseSender
9
{
10
    /** @var \Illuminate\Contracts\Mail\Mailer */
11
    protected $mailer;
12
13
    /** @var array */
14
    protected $config;
15
16
    /**
17
     * @param \Illuminate\Contracts\Mail\Mailer       $mailer
18
     * @param \Illuminate\Contracts\Config\Repository $config
19
     */
20
    public function __construct($mailer, $config)
21
    {
22
        $this->config = $config->get('laravel-backup.notifications.mail');
0 ignored issues
show
Documentation Bug introduced by
It seems like $config->get('laravel-backup.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...
23
24
        $this->mailer = $mailer;
25
    }
26
27
    public function send()
28
    {
29
        $this->mailer->raw($this->message, function (Message $message) {
30
31
            $message
32
                ->subject($this->subject)
33
                ->from($this->config['from'])
34
                ->to($this->config['to']);
35
        });
36
    }
37
}
38