| Total Complexity | 7 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Return action type |
||
| 42 | * |
||
| 43 | * @param string $action |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | 33 | public static function getExecType(string $action): string |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Check if the action type is PHP |
||
| 53 | * |
||
| 54 | * @param string $action |
||
| 55 | * @return bool |
||
| 56 | */ |
||
| 57 | 33 | private static function isPHPType(string $action): bool |
|
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Try to read an environment variable |
||
| 64 | * |
||
| 65 | * @param string $name |
||
| 66 | * @param string $default |
||
| 67 | * @return string |
||
| 68 | */ |
||
| 69 | 20 | public static function getEnv(string $name, string $default = ''): string |
|
| 75 |