Completed
Push — master ( e28e5a...6fa56b )
by Julien
02:03
created

PayloadException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 20
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A missingDockerfileName() 0 3 1
A missingServiceName() 0 3 1
A emptyPayload() 0 3 1
A missingDockerComposeFilename() 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 missingServiceName(): self
22
    {
23
        return new self(CommonEvents::NEW_BUILD_IMAGE_JOB_EVENT . ' event requires a payload with the service name');
24
    }
25
26
    public static function missingDockerfileName(): self
27
    {
28
        return new self(CommonEvents::NEW_BUILD_IMAGE_JOB_EVENT . ' event requires a payload with the Dockerfile name');
29
    }
30
}
31