Exemplo n.º 1
0
 /**
  * Initialize the parameters
  *
  * @throws \InvalidArgumentException
  */
 private function initParams()
 {
     if (empty($this->controller)) {
         throw new \InvalidArgumentException('Controller and method needs to be set via setController');
     }
     if (!is_array($this->controller) || empty($this->controller[0]) || !is_object($this->controller[0])) {
         throw new \InvalidArgumentException('Controller needs to be set as a class instance (closures/functions are not supported)');
     }
     $this->params = $this->paramReader->read(new \ReflectionClass(ClassUtils::getClass($this->controller[0])), $this->controller[1]);
 }
Exemplo n.º 2
0
 public function getParamsFromMethod(\ReflectionMethod $method)
 {
     $parentParams = array();
     $params = parent::getParamsFromMethod($method);
     // This loads the annotations of the parent method
     $declaringClass = $method->getDeclaringClass();
     $parentClass = $declaringClass->getParentClass();
     if ($parentClass && $parentClass->hasMethod($method->getShortName())) {
         $parentMethod = $parentClass->getMethod($method->getShortName());
         $parentParams = parent::getParamsFromMethod($parentMethod);
     }
     return array_merge($params, $parentParams);
 }