Completed
Push — master ( 789244...b6d79a )
by Freek
01:28
created

CampaignMailable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setCampaignSend() 0 6 1
A setContent() 0 6 1
A build() 0 6 1
1
<?php
2
3
namespace Spatie\EmailCampaigns\Mails;
4
5
use Illuminate\Mail\Mailable;
6
use Illuminate\Queue\SerializesModels;
7
use Spatie\EmailCampaigns\Actions\PersonalizeHtmlAction;
8
use Spatie\EmailCampaigns\Models\Campaign;
9
use Spatie\EmailCampaigns\Models\CampaignSend;
10
use Spatie\EmailCampaigns\Support\Config;
11
12
class CampaignMailable extends Mailable
13
{
14
    use SerializesModels;
15
16
    /** @var \Spatie\EmailCampaigns\Models\Campaign */
17
    public $campaign;
18
19
    /** @var \Spatie\EmailCampaigns\Models\CampaignSend */
20
    public $campaignSend;
21
22
    /** @var string */
23
    public $content;
24
25
    public function setCampaignSend(CampaignSend $campaignSend)
26
    {
27
        $this->campaignSend = $campaignSend;
28
29
        return $this;
30
    }
31
32
    public function setContent(string $content)
33
    {
34
        $this->content = $content;
35
36
        return $this;
37
    }
38
39
    public function build()
40
    {
41
        return $this
42
            ->subject($this->campaignSend->campaign->subject)
43
            ->view('email-campaigns::mails.campaign');
44
    }
45
}
46