Ejemplo n.º 1
0
 private static function instance()
 {
     if (static::$obj === NULL) {
         $klass = \Sauce\Config::get('logger');
         if (!$klass instanceof \Psr\Log\LoggerInterface) {
             $klass = new \Sauce\LoggerAware();
         } elseif (is_string($klass)) {
             $klass = new $klass();
         }
         static::$obj = $klass;
     }
     return static::$obj;
 }
Ejemplo n.º 2
0
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);
    }
}