Passed
Push — master ( ed877e...53d661 )
by Radu
08:24
created

EnvironmentHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 12 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WebServCo\Framework\Helpers;
6
7
use WebServCo\Framework\Values\Environment;
8
9
class EnvironmentHelper
10
{
11
    public static function validate(string $value): bool
12
    {
13
        if (
14
            !\in_array(
15
                $value,
16
                [Environment::DEVELOPMENT, Environment::TESTING, Environment::STAGING, Environment::PRODUCTION],
17
                true,
18
            )
19
        ) {
20
            throw new \WebServCo\Framework\Exceptions\EnvironmentException('Invalid environment value.');
21
        }
22
        return true;
23
    }
24
}
25