Exemplo n.º 1
0
 /**
  * Adds a action method configuration.
  *
  * @param \AppserverIo\Routlt\Description\ActionDescriptorInterface $action The action method configuration
  *
  * @return void
  */
 public function addAction(ActionDescriptorInterface $action)
 {
     $name = $action->getName();
     foreach ($action->getRequestMethods() as $method) {
         $this->actions[$name][$method] = $action;
     }
 }
Exemplo n.º 2
0
 /**
  * Merges the passed configuration into this one. Configuration values
  * of the passed configuration will overwrite the this one.
  *
  * @param \AppserverIo\Routlt\Description\ActionDescriptorInterface $actionDescriptor The configuration to merge
  *
  * @return void
  * @throws \AppserverIo\Routlt\Description\DescriptorException Is thrown if the passed descriptor has a different method name
  */
 public function merge(ActionDescriptorInterface $actionDescriptor)
 {
     // check if the classes are equal
     if ($this->getMethodName() !== $actionDescriptor->getMethodName()) {
         throw new DescriptorException(sprintf('You try to merge a action configuration for % with %s', $actionDescriptor->getMethodName(), $this->getMethodName()));
     }
     // merge the name
     if ($name = $actionDescriptor->getName()) {
         $this->setName($name);
     }
 }