/**
  * buildPipe
  *
  * @param MiddlewarePipe $middlewarePipe
  * @param Request        $request
  *
  * @return Request
  * @throws \Exception
  */
 public function buildPipe(MiddlewarePipe $middlewarePipe, Request $request)
 {
     $request = $this->withPaths($request);
     $middlewarePipe->pipeOperations($this->buildOperationCollection());
     return $request;
 }
 /**
  * buildPipe
  *
  * @param MiddlewarePipe $middlewarePipe
  * @param Request        $request
  *
  * @return MiddlewarePipe
  * @throws ResourceException
  */
 public function buildPipe(MiddlewarePipe $middlewarePipe, Request $request)
 {
     $resourceKey = $request->getAttribute(ResourceKey::getName());
     if ($resourceKey === null) {
         throw new ResourceException('ResourceKey not set: ' . $resourceKey);
     }
     $operations = $this->buildResourceOperationCollection($resourceKey);
     $middlewarePipe->pipeOperations($operations);
     return $request;
 }