Exemple #1
0
 /**
  * Pageリソースをリソースとして出力
  *
  * @param BEAR_Page &$page ページ
  * @param int       $cnt   プロトタイプリソースのスタックカウンタ
  *
  * @return array
  * @throws BEAR_Resource_Execute_Exception
  */
 protected function _outputResource(BEAR_Page &$page, $cnt)
 {
     // BEAR_Page::set()でsetされた値
     $pageValues = $page->getValues();
     $result = array();
     for ($i = 0; $i < $cnt; $i++) {
         $item = $this->_roPrototye->pop();
         list($key, $prototypeRo) = each($item);
         /* @var $prototypeRo BEAR_Ro_Prototype */
         $result[$key] = $prototypeRo->getValue();
     }
     $result = array_merge($result, (array) $pageValues);
     // $page->setPrototypeRo();
     return $result;
 }
Exemple #2
0
 /**
  * リソースリクエスト実行
  *
  * @return BEAR_Ro
  */
 public function request()
 {
     $start = microtime(true);
     $this->_log->start();
     parent::request();
     $time = microtime(true) - $start;
     $this->_ro->setHeader('_time', $time);
     $log = array('Time' => $time);
     $appLog = $this->_log->stop();
     if ($appLog) {
         $log['Log'] = array_values($appLog);
     }
     if ($log) {
         $this->_ro->setHeader('_log', $log);
     }
     return $this->_ro;
 }
Exemple #3
0
 /**
  * スタックされたRoプロトタイプを全て取り出す
  *
  * @return array
  */
 public function popAll()
 {
     $result = self::$_stack;
     self::$_stack = array();
     return $result;
 }