Exemple #1
0
 /**
  * ログライタを作成する
  */
 public static function build($spec)
 {
     $spec = Hash::create(Hash::NO_CASE_SENSITIVE, $spec);
     $class = sprintf(self::WRITER_CLASS_FORMAT, ucfirst($spec->get('type', 'stdout')));
     $writer = new $class($spec);
     return $writer;
 }
Exemple #2
0
 public function &get($k, $v = null)
 {
     if (!$this->has($k)) {
         throw new Exception\UndefinedParam($k);
     }
     return parent::get($k);
 }
Exemple #3
0
 public function initComponentImpl()
 {
     $this->_SERVER = Hash::create(Hash::NO_CASE_SENSITIVE, $_SERVER);
     $this->_ENV = Hash::create(Hash::NO_CASE_SENSITIVE, $_ENV);
     $this->_POST = Hash::create(Hash::NO_CASE_SENSITIVE, $_POST);
     $this->_GET = Hash::create(Hash::NO_CASE_SENSITIVE, $_GET);
     $this->_COOKIE = Hash::create(Hash::NO_CASE_SENSITIVE, $_COOKIE);
 }
Exemple #4
0
 /**
  * クロージャを作成する
  *
  * @param array|closure
  * @return callable
  */
 public function makeClosure($spec, $over = [])
 {
     if ($spec instanceof \Closure) {
         return $spec;
     }
     return function () use($spec, $over) {
         $over = Hash::create(0, $over);
         $function = array_pop($spec);
         $depends = $spec;
         $args = [];
         foreach ($depends as $d) {
             if ($over->has($d)) {
                 $args[] = $over->get($d);
                 continue;
             }
             $args[] = $this->getComponent($d);
         }
         foreach (func_get_args() as $a) {
             $args[] = $a;
         }
         return call_user_func_array($function, $args);
     };
 }
Exemple #5
0
 /**
  * 初期化処理
  */
 protected function initComponentImpl()
 {
     $this->_data = Hash::create(Hash::NO_CASE_SENSITIVE);
 }