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:----ju+0Znuj16y2N/ZW6uZr6nVA7S5TANdwWjSabHSYM58ysFfhyhSIrZFCyLfT8M0TcoaJRrmBMtgtwD0Q5u2bItpCy4FNKuiTl9mYZToVdbJTVPMrPz027NDCn3NJCFG9sE6mfqe/3Uc9/AqFkY18+4HeLECO0Y9q8bOkgPe2MvZe2XgNOP+ee0RoLTdvIExl25hO44i8RuqWqQ8nD8f/7gqS1ZtauK6AwMD+USSczx6Bj8Nd18J0aqJwt4hZXeI62jDrxGxvvXoZeUClOQPd+kku4b0odMWlg/Grt4fbx2mxKISTn6ku3RETcxZxTTcydIZEq9qzU1OfRR1RcHSFt9cDokCR7djdSDrcIn2Xe20z0yXORIXMEiANX/O1MbVceI+7e8VDR8ndD7eKQsQmqVGRMks4AXdfGTysYnOeuauagdCZgsQhvYinecCluFNXoT0uORWLk470raqNI03MmMEAyuEkRpUkLCAp6ejSlM3Q8pw91fzoYwSbXPP7lw0n5NEXCqLweCqx73yN960sfi096R9C9yiJiozzyCj4i9ibfK6o6/NtDuAC27BaLcs5M2bMcd/tPl/pVDnPqhfwsK3H2u3PgFiuLpPhG7Zicqc8oqr9y952NxMhlXN7ni0uYBVvSTnEVcWTWB8Dvkfy0R5v3tt1Qw/2j/nRfTsEamE=----ATTACHMENT:----ODUyNTI4MjAzMjU1MzU2OSAzNDU3NTU4NDA2NjA4ODMgMjIyOTgxMTk1OTA3MDA1MA==