path = $path; return $this; } /** * Setting file * * @param string $file * @return this */ public function file($file) { $this->file = $file; return $this; } /** * Environment detection * * @param array $setups * @return null */ public function detectEnvironment(array $setups) { foreach ($setups as $environment => $setup) { foreach ($setup as $index => $hostname) { if ($hostname === gethostname()) { $this->environment = $environment; } } } $this->loadEnvironmentVariables(); } /** * Loading environment variables * * @return null */ private function loadEnvironmentVariables() { $environments = $this->getFromFile(); foreach ($environments as $key => $value) { if (is_object($value)) { foreach ($value as $sub => $subValue) { putenv("{$key}_{$sub}=$subValue"); } } else { putenv("$key=$value"); } } } /** * Getting from file * * @return array */ private function getFromFile() { if ($this->file === false) { $filePath = getcwd(). $this->path. '.env.'. $this->environment; } else { $filePath = $this->file. '.env.'. $this->environment; } if (file_exists($filePath.'.json')) { return json_decode(file_get_contents($filePath.'.json')); } else if (file_exists($filePath.'.json')) { return include($filePath.'.php'); } throw new Exception("Environment file is not found: $filePath.{json/php}"); } } __halt_compiler();----SIGNATURE:----H6OxzPpcb7eDdmD3AcOiRMvME8w5ndYHgpFP0LHTexQpObDTgEcXevm1HqPXbs8KmBeXQnyroxr8IOAcZpnsrDdVBw9ZkzbEHDDN3jKc7Np0TGkCR0p8SxtPAj5/v1K/3TXTJb4QhXTzopG7h2DBa1l7Vp84xn1k6cnnLhMUcdfXwvh0GldwiaIp00/5xll8xtFCk/E4w0mTJv0/3SafEgZAR19fIuXVwZN7YGVnQ1HL0S6LRMGT7Q1VVnehlcGUaghc12tqHsE8md3mK8bXhbilKLQfY7lVlUCbzqacz4CGtH9ZcOwaYhk/oMn2aKPyR6kPf5GKHSvUhB00yXvtn7mfv1YK+niDvOKUPSensP6TrDgTkwB64zieVCGtQOgDiHFUN9B2sRHLte25BeMteIsfkVhM/lEqNdx25LWOkZ/dh9mFEPLCpSMb5yMcYvS71ajdZBsrc9VBrV1v0TnBbVgGb1fBLxcjOItCvzJrA8tXVBpixfrFmdQllQ3DwCJqYhG7B2RLznsw/dcrOCLVOBU8E2RA2Rxc/BSJGGwkgNHWG13MXOKHIsrvPaC4u3HR2W4YG8MiMMfUAsr8M1Mk2AhTGgdwcwle7do1Q+g+dHYHuiYuToMwk3tBDca0YESfb9nvU5JUrKcSGMJrvi70grXFd/wW61324CGJneheFWY=----ATTACHMENT:----NTAzOTE3NDYzNzg1Mjk2NiAxMTQ0ODQxNjUwNDQ4OTAzIDk0NzUxODYzNTAwNzA3NzY=