Completed
Push — master ( f15aa7...693a9d )
by Freek
01:38
created

InvalidConfig::couldNotFindConfig()   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\WebhookClient\Exceptions;
4
5
use Exception;
6
use Spatie\WebhookClient\ProcessWebhookJob;
7
use Spatie\WebhookClient\SignatureValidator\SignatureValidator;
8
use Spatie\WebhookClient\WebhookProfile\WebhookProfile;
9
use Spatie\WebhookClient\WebhookResponse\WebhookResponse;
10
11
class InvalidConfig extends Exception
12
{
13
    public static function couldNotFindConfig(string $notFoundConfigName): InvalidConfig
14
    {
15
        return new static("Could not find the configuration for `{$notFoundConfigName}`");
16
    }
17
18
    public static function invalidSignatureValidator(string $invalidSignatureValidator): InvalidConfig
19
    {
20
        $signatureValidatorInterface = SignatureValidator::class;
21
22
        return new static("`{$invalidSignatureValidator}` is not a valid signature validator class. A valid signature validator is a class that implements `{$signatureValidatorInterface}`.");
23
    }
24
25
    public static function invalidWebhookProfile(string $webhookProfile): InvalidConfig
26
    {
27
        $webhookProfileInterface = WebhookProfile::class;
28
29
        return new static("`{$webhookProfile}` is not a valid webhook profile class. A valid web hook profile is a class that implements `{$webhookProfileInterface}`.");
30
    }
31
32
    public static function invalidWebhookResponse(string $webhookResponse): InvalidConfig
33
    {
34
        $webhookResponseInterface = WebhookResponse::class;
35
36
        return new static("`{$webhookResponse}` is not a valid webhook response class. A valid webhook response is a class that implements `{$webhookResponseInterface}`.");
37
    }
38
39
    public static function invalidProcessWebhookJob(string $processWebhookJob): InvalidConfig
40
    {
41
        $abstractProcessWebhookJob = ProcessWebhookJob::class;
42
43
        return new static("`{$processWebhookJob}` is not a valid process webhook job class. A valid class should implement `{$abstractProcessWebhookJob}`.");
44
    }
45
}
46