HasMailCC   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 29
ccs 0
cts 12
cp 0
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A withMailCC() 0 10 3
A mailCC() 0 5 1
A mailBCC() 0 5 1
1
<?php
2
3
namespace ThinKit\Notifications\Mail;
4
5
use Illuminate\Notifications\Messages\MailMessage;
6
7
trait HasMailCC
8
{
9
    protected array $mailCC  = [];
10
    protected array $mailBCC = [];
11
12
    public function mailCC(array $receivers = []): static
13
    {
14
        $this->mailCC = $receivers;
15
16
        return $this;
17
    }
18
19
    public function mailBCC(array $receivers = []): static
20
    {
21
        $this->mailBCC = $receivers;
22
23
        return $this;
24
    }
25
26
    protected function withMailCC(MailMessage $message): MailMessage
27
    {
28
        if (!empty($this->mailCC)) {
29
            $message->cc($this->mailCC);
30
        }
31
        if (!empty($this->mailCC)) {
32
            $message->bcc($this->mailBCC);
33
        }
34
35
        return $message;
36
    }
37
}
38