Completed
Push — master ( 4fe608...5ceeaf )
by Jindun
12s
created

PayloadException   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 6
dl 0
loc 25
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A emptyPayload() 0 3 1
A missingDockerComposeFilename() 0 3 1
A missingDockerfileName() 0 3 1
A missingServiceName() 0 3 1
A missingKubernetesPathname() 0 3 1
1
<?php
2
3
4
namespace TheAentMachine\AentGitLabCI\Exception;
5
6
use TheAentMachine\Aenthill\CommonEvents;
7
use TheAentMachine\Exception\AenthillException;
8
9
final class PayloadException extends AenthillException
10
{
11
    public static function emptyPayload(string $event): self
12
    {
13
        return new self("$event event requires a payload");
14
    }
15
16
    public static function missingDockerComposeFilename(): self
17
    {
18
        return new self(CommonEvents::NEW_DEPLOY_DOCKER_COMPOSE_JOB_EVENT . ' event requires a payload with the Docker Compose filename');
19
    }
20
21
    public static function missingKubernetesPathname(): self
22
    {
23
        return new self(CommonEvents::NEW_DEPLOY_KUBERNETES_JOB_EVENT . ' event requires a payload with the Kubernetes pathname');
24
    }
25
26
    public static function missingServiceName(): self
27
    {
28
        return new self(CommonEvents::NEW_BUILD_IMAGE_JOB_EVENT . ' event requires a payload with the service name');
29
    }
30
31
    public static function missingDockerfileName(): self
32
    {
33
        return new self(CommonEvents::NEW_BUILD_IMAGE_JOB_EVENT . ' event requires a payload with the Dockerfile name');
34
    }
35
}
36