/** * @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); }
/** * @param $key * @param $value * @return $this */ protected function set($key, $value) { $this->view->set($key, $value); return $this; }