CampaignSendMail   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A build() 0 4 1
1
<?php
2
3
namespace App\Mail;
4
5
use App\Models\Campaign;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Mail\Mailable;
8
use Illuminate\Queue\SerializesModels;
9
10
/**
11
 * @param $subscriptions
12
 * @property Campaign campaign
13
 */
14
class CampaignSendMail extends Mailable
15
{
16
    use Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Mail\CampaignSendMail: $id, $class, $relations
Loading history...
17
18
    public $subscriptions;
19
    public $campaign;
20
21
    public function __construct($subscriptions, Campaign $campaign)
22
    {
23
        $this->subscriptions = $subscriptions;
24
        $this->campaign = $campaign;
25
    }
26
27
    /**
28
     * Build the message.
29
     *
30
     * @return $this
31
     */
32
    public function build()
33
    {
34
        return $this->markdown('emails.campaigns.send', ['campaign' => $this->campaign->name, 'subscribers' => count($this->subscriptions)])
35
            ->subject(trans('emails.campaigns.send.subject'));
0 ignored issues
show
Bug introduced by
It seems like trans('emails.campaigns.send.subject') can also be of type array; however, parameter $subject of Illuminate\Mail\Mailable::subject() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

35
            ->subject(/** @scrutinizer ignore-type */ trans('emails.campaigns.send.subject'));
Loading history...
36
    }
37
}
38