Passed
Push — master ( 588c31...9953d3 )
by Stephen
02:33
created

SendMailAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 15 2
1
<?php
2
3
4
namespace Sfneal\PostOffice\MailCenter;
5
6
7
use Illuminate\Mail\Mailable;
8
use Illuminate\Support\Facades\Mail;
9
use Sfneal\Actions\AbstractActionStatic;
10
11
class SendMailAction extends AbstractActionStatic
12
{
13
    /**
14
     * Execute the SendMailAction
15
     *
16
     * @param Mailable $mailable
17
     * @param string $to
18
     * @param array $cc
19
     * @return bool
20
     */
21
    public static function execute(Mailable $mailable, string $to, array $cc = null)
22
    {
23
        // Initialize
24
        $mail = Mail::to($to);
25
26
        // CC users if provided
27
        if (isset($cc)) {
28
            $mail->cc($cc);
29
        }
30
31
        // Send mail
32
        $mail->send($mailable);
33
34
        // Confirm Email was sent
35
        return empty(Mail::failures());
36
    }
37
}
38