public static function set($file) { //var $e $f = stream_resolve_include_path($file); if ($f) { $config = parse_ini_file($f, TRUE); \limepie\config::set($config); } else { $caller = debug_backtrace()[0]; trigger_error("file does not exists: " . $file . " in " . $caller['file'] . ' on line ' . $caller['line'] . ' and defined ', E_USER_ERROR); } }
public static function set($file) { //var $e, $config, $error; $f = stream_resolve_include_path($file); if ($f) { $config = json_decode(file_get_contents($f), TRUE); if (json_last_error()) { $caller = debug_backtrace()[0]; trigger_error(json_last_error_msg() . ": " . $file . " in " . $caller['file'] . ' on line ' . $caller['line'] . ' and defined ', E_USER_ERROR); } else { \limepie\config::set($config); } } else { $caller = debug_backtrace()[0]; trigger_error("file does not exists: " . $file . " in " . $caller['file'] . ' on line ' . $caller['line'] . ' and defined ', E_USER_ERROR); } }
public static function environment($domains, \Closure $func) { $match = FALSE; foreach ($domains as $environment => $domain) { // HTTP_HOST와 매칭되는 도메인을 찾는다. if (TRUE === in_array(getenv('HTTP_HOST'), $domain)) { \limepie\config::set('ENVIRONMENT', $environment); // environment별 환경설정 파일 인클루드 $func($environment); $match = TRUE; break; } } if (FALSE === $match) { throw new \limepie\config\exception("domain Configuration file does not exists"); } }