/**
  * @param ServesRequestData $request
  *
  * @throws MissingInterfaceImplementationForHandlingDomainRequests
  * @throws BuildingDomainRequestHandlerFailed
  * @return HandlesDomainRequests
  */
 public function buildDomainRequestHandler(ServesRequestData $request)
 {
     $domainName = $this->getStringToCamelCase($this->uriComponents->getDomain());
     $demandName = $this->getStringToCamelCase($this->uriComponents->getDemand());
     $subNamespaceReadOrWrite = $this->getSubNamespaceReadOrWrite();
     $className = sprintf("%s\\%s\\%s\\%sRequestHandler", $this->domainNamespace, $domainName, $subNamespaceReadOrWrite, $demandName);
     if (class_exists($className, true)) {
         $handlerInstance = new $className($request);
         $this->guardInstanceImplementsHandlerInterface($handlerInstance);
         return $handlerInstance;
     } else {
         throw new BuildingDomainRequestHandlerFailed($className);
     }
 }
Пример #2
0
 /**
  * @param array $requestData
  *
  * @return array
  */
 private function getMergedData(array $requestData)
 {
     return array_merge($requestData, $this->uriComponents->getParams());
 }