Completed
Pull Request — master (#59)
by Julien
02:49
created

CommonAents::getAentsListByDependencyKey()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 11
nc 5
nop 1
dl 0
loc 13
rs 9.6111
c 0
b 0
f 0
1
<?php
2
3
namespace TheAentMachine\Aenthill;
4
5
use TheAentMachine\Exception\CommonAentsException;
6
7
final class CommonAents
8
{
9
    // TODO handle version
10
    private static $orchestratorAents = [
11
        'theaentmachine/aent-docker-compose',
12
        'theaentmachine/aent-kubernetes'
13
    ];
14
15
    private static $reverseProxyAents = [
16
        'theaentmachine/aent-traefik'
17
    ];
18
19
    private static $CIAents = [
20
        'theaentmachine/aent-gitlabci'
21
    ];
22
23
    private static $imageBuilderAents = [
24
        'theaentmachine/aent-dockerfile'
25
    ];
26
27
    /**
28
     * @param string $key
29
     * @return string[]
30
     * @throws CommonAentsException
31
     */
32
    public static function getAentsListByDependencyKey(string $key): array
33
    {
34
        switch ($key) {
35
            case CommonDependencies::ORCHESTRATOR_KEY:
36
                return self::$orchestratorAents;
37
            case CommonDependencies::REVERSE_PROXY_KEY:
38
                return self::$reverseProxyAents;
39
            case CommonDependencies::CI_KEY:
40
                return self::$CIAents;
41
            case CommonDependencies::IMAGE_BUILDER_KEY:
42
                return self::$imageBuilderAents;
43
            default:
44
                throw CommonAentsException::noAentsAvailable($key);
45
        }
46
    }
47
}
48