コード例 #1
0
ファイル: runtime.php プロジェクト: hbnro/habanero
function config($set = NULL, $value = NULL)
{
    if (func_num_args() === 0) {
        return \Sauce\Config::all();
    } elseif (func_num_args() === 2) {
        \Sauce\Config::set($set, $value);
    } else {
        $tmp = array();
        if ($set instanceof \Closure) {
            $tmp = (object) $tmp;
            $set($tmp);
        } elseif (is_file($set)) {
            $tmp = call_user_func(function () {
                include func_get_arg(0);
                return get_defined_vars();
            }, $set);
            $tmp = isset($tmp['config']) ? $tmp['config'] : $tmp;
        }
        \Sauce\Config::add((array) $tmp);
    }
}