Completed
Push — master ( 1789bd...153a0b )
by Freek
01:51 queued 10s
created

CampaignCouldNotSent::noSubjectSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Spatie\EmailCampaigns\Exceptions;
4
5
use Exception;
6
use ErrorException;
7
use Spatie\EmailCampaigns\Models\Campaign;
8
9
class CampaignCouldNotSent extends Exception
10
{
11
    public static function beingSent(Campaign $campaign): self
12
    {
13
        return new static("The campaign `{$campaign->name}` can't be sent, because it is already being sent.");
14
    }
15
16
    public static function alreadySent(Campaign $campaign): self
17
    {
18
        return new static("The campaign `{$campaign->name}` can't be sent, because it was already sent.");
19
    }
20
21
    public static function noListSet(Campaign $campaign)
22
    {
23
        return new static("The campaign `{$campaign->name}` can't be sent, because there is no list set to send it to.");
24
    }
25
26
    public static function noSubjectSet(Campaign $campaign)
27
    {
28
        return new static("The campaign `{$campaign->name}` can't be sent, because no subject has been set.");
29
    }
30
31
    public static function noContent(Campaign $campaign): self
32
    {
33
        return new static("The campaign `{$campaign->name}` can't be sent because not content has been set.");
34
    }
35
36
    public static function invalidContent(Campaign $campaign, ErrorException $errorException): self
37
    {
38
        return new static("The campaign `{$campaign->name}` can't be sent because the content isn't valid. Please check if the html is valid. DOMDocument reported: `{$errorException->getMessage()}`", 0, $errorException);
39
    }
40
}
41