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

InvalidConfig   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 35
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A couldNotFindConfig() 0 4 1
A invalidSignatureValidator() 0 6 1
A invalidWebhookProfile() 0 6 1
A invalidWebhookResponse() 0 6 1
A invalidProcessWebhookJob() 0 6 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