1 | <?php |
||
5 | class Environment |
||
6 | { |
||
7 | protected $blnIsDev; |
||
8 | |||
9 | public function __construct() |
||
12 | |||
13 | /** |
||
14 | * Set env to Dev |
||
15 | * |
||
16 | * @param bool $bln |
||
17 | * @return $this |
||
18 | */ |
||
19 | public function setDev($bln = true) |
||
24 | |||
25 | /** |
||
26 | * Determine if we are in development environment |
||
27 | * |
||
28 | * @return bool |
||
29 | */ |
||
30 | public function isDevEnv() |
||
49 | |||
50 | /** |
||
51 | * Determine if it's .dev domain |
||
52 | * |
||
53 | * @return bool |
||
54 | */ |
||
55 | public function isDevDomain() |
||
60 | |||
61 | /** |
||
62 | * Is is localhost |
||
63 | * |
||
64 | * @return bool |
||
65 | */ |
||
66 | public function isLocalhost() |
||
75 | } |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: