/** * Merges the passed configuration into this one. Configuration values * of the passed configuration will overwrite the this one. * * @param \AppserverIo\Routlt\Description\ResultDescriptorInterface $resultDescriptor 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(ResultDescriptorInterface $resultDescriptor) { // check if the classes are equal if ($this->getName() !== $resultDescriptor->getName()) { throw new DescriptorException(sprintf('You try to merge a result configuration for % with %s', $resultDescriptor->getName(), $this->getName())); } // merge the type if ($type = $resultDescriptor->getType()) { $this->setType($type); } // merge the result if ($result = $resultDescriptor->getResult()) { $this->setResult($result); } }
/** * Initializes the instance with the configured result value. * * @param \AppserverIo\Routlt\Results\ResultDescriptorInterface $resultDescriptor The result descriptor instance */ public function __construct(ResultDescriptorInterface $resultDescriptor) { $this->name = $resultDescriptor->getName(); $this->type = $resultDescriptor->getType(); $this->result = $resultDescriptor->getResult(); }
/** * Adds a result action configuration. * * @param \AppserverIo\Routlt\Description\ResultDescriptorInterface $result The action result configuration * * @return void */ public function addResult(ResultDescriptorInterface $result) { $this->results[$result->getName()] = $result; }