1 | <?php |
||
10 | class Module implements InitProviderInterface, ConfigProviderInterface |
||
11 | { |
||
12 | /** @var string */ |
||
13 | private $constant = 'APPLICATION_PATH'; |
||
14 | |||
15 | /** @var string */ |
||
16 | private $variable = 'APPLICATION_PATH'; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $file = '.env'; |
||
20 | |||
21 | /** |
||
22 | * Module constructor. |
||
23 | * @param string $constant |
||
24 | * @param string $variable |
||
25 | * @param string $file |
||
26 | */ |
||
27 | 5 | public function __construct($constant = null, $variable = null, $file = null) |
|
28 | { |
||
29 | 5 | if ($constant) { |
|
|
|||
30 | 1 | $this->constant = $constant; |
|
31 | 1 | } |
|
32 | |||
33 | 5 | if ($variable) { |
|
34 | 1 | $this->variable = $variable; |
|
35 | 1 | } |
|
36 | |||
37 | 5 | if ($file) { |
|
38 | 4 | $this->file = $file; |
|
39 | 4 | } |
|
40 | 5 | } |
|
41 | |||
42 | /** |
||
43 | * Returns configuration to merge with application configuration |
||
44 | * |
||
45 | * @return array|\Traversable |
||
46 | */ |
||
47 | 1 | public function getConfig() |
|
51 | |||
52 | /** |
||
53 | * @param ModuleManagerInterface $moduleManager |
||
54 | */ |
||
55 | 1 | public function init(ModuleManagerInterface $moduleManager) |
|
61 | |||
62 | /** |
||
63 | * @return mixed[] |
||
64 | * @throws \Abacaphiliac\ZendPhpDotEnv\Exception\InvalidConstantPathException |
||
65 | * @throws \Abacaphiliac\ZendPhpDotEnv\Exception\InvalidEnvironmentVariablePathException |
||
66 | * @throws \Abacaphiliac\ZendPhpDotEnv\Exception\InvalidWorkingDirectoryPathException |
||
67 | */ |
||
68 | 4 | public function loadEnvironmentVariables() |
|
83 | } |
||
84 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: