| Total Complexity | 7 |
| Total Lines | 66 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class Config |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @return bool |
||
| 14 | */ |
||
| 15 | public function isStaging(): bool |
||
| 16 | { |
||
| 17 | return Environment::getVar(Env::ENV_NAME) === Environment::STAGING; |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @return bool |
||
| 22 | */ |
||
| 23 | public function isTesting(): bool |
||
| 24 | { |
||
| 25 | return Environment::getVar(Env::ENV_NAME) === Environment::TESTING; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @return bool |
||
| 30 | */ |
||
| 31 | public function isDevelopment(): bool |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return bool |
||
| 38 | */ |
||
| 39 | public function isProduction(): bool |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $envName |
||
| 46 | * @param mixed $expected |
||
| 47 | * @param mixed $default |
||
| 48 | * |
||
| 49 | * @return bool |
||
| 50 | */ |
||
| 51 | public function is(string $envName, $expected, $default = null): bool |
||
| 52 | { |
||
| 53 | return $this->get($envName, $default) === $expected; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @param string $envName |
||
| 58 | * @param mixed $default |
||
| 59 | * |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function get(string $envName, $default = null): string |
||
| 63 | { |
||
| 64 | return Environment::getVar($envName, $default); |
||
|
|
|||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param string $envName |
||
| 69 | * @param mixed $value |
||
| 70 | * |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | public function set(string $envName, string $value): Provider |
||
| 76 | } |
||
| 77 | } |
||
| 78 |