Util   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 4
dl 0
loc 30
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isTypeValid() 0 3 1
A getExecType() 0 3 2
1
<?php
2
3
/**
4
 * This file is part of SebastianFeldmann\Git.
5
 *
6
 * (c) Sebastian Feldmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CaptainHook\App\Runner;
13
14
/**
15
 * Class Util
16
 *
17
 * @package CaptainHook\App\Runner
18
 */
19
final class Util
20
{
21
    /**
22
     * List of valid action types
23
     *
24
     * @var array<bool>
25
     */
26
    private static $validTypes = ['php' => true, 'cli' => true];
27
28
29
    /**
30
     * Check the validity of a exec type
31
     *
32
     * @param  string $type
33
     * @return bool
34
     */
35 1
    public static function isTypeValid(string $type): bool
36
    {
37 1
        return isset(self::$validTypes[$type]);
38
    }
39
40
    /**
41
     * Return action type
42
     *
43
     * @param  string $action
44
     * @return string
45
     */
46 32
    public static function getExecType(string $action): string
47
    {
48 32
        return substr($action, 0, 1) === '\\' ? 'php' : 'cli';
49
    }
50
}
51