示例#1
0
文件: Dispatch.php 项目: wscore/pages
 /**
  * @param $execMethod
  * @return array
  */
 protected function execMethod($execMethod)
 {
     $controller = $this->controller;
     $refMethod = new \ReflectionMethod($controller, $execMethod);
     $refArgs = $refMethod->getParameters();
     $parameters = array();
     foreach ($refArgs as $arg) {
         $key = $arg->getPosition();
         $name = $arg->getName();
         $opt = $arg->isOptional() ? $arg->getDefaultValue() : null;
         $val = $this->request->get($name, $opt);
         $parameters[$key] = $val;
         $this->view->set($name, $val);
     }
     $refMethod->setAccessible(true);
     return $refMethod->invokeArgs($controller, $parameters);
 }
示例#2
0
 /**
  * @param $key
  * @param $value
  * @return $this
  */
 protected function set($key, $value)
 {
     $this->view->set($key, $value);
     return $this;
 }