示例#1
0
文件: Controller.php 项目: hejxing/jt
 /**
  * 匹配,过滤参数
  *
  * @param       $p
  * @param array $options
  */
 private function combParam(array $p, array $options)
 {
     foreach ($options as $name => $option) {
         switch ($option[0]) {
             case 'request':
                 $this->param[] = Requester::createFromRequest($option[3], $name);
                 break;
             case 'inject':
                 $class = $option[1];
                 $ruler = $option[2];
                 $param = [];
                 if (isset($ruler['param'])) {
                     $param = $ruler['param'];
                 }
                 if (isset($ruler['instance'])) {
                     $instance = $ruler['instance'];
                     $this->param[] = $class::$instance(...$param);
                 } else {
                     $this->param[] = new $class(...$param);
                 }
                 break;
             default:
                 $this->param[] = Requester::doProcess($p[$option[4]], $option[2], 'path:' . $name, true);
                 break;
         }
     }
 }