Ejemplo n.º 1
0
 public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context)
 {
     // parse json
     $parser = $this->templateFactory->newTextParser();
     $response = $parser->parse($request, $context, $configuration->get('patch'));
     // patch
     $patch = new Patch(Json::decode($response, false));
     $body = $patch->patch(Transformer::toStdClass($request->getBody()));
     $body = Transformer::toRecord($body);
     return $this->processor->execute($configuration->get('action'), $request->withBody($body), $context);
 }
Ejemplo n.º 2
0
 protected function parseRequest(MethodAbstract $method)
 {
     if ($method->hasRequest()) {
         if ($method->getRequest()->getDefinition()->getName() == self::SCHEMA_PASSTHRU) {
             return Transformer::toRecord($this->getBody());
         } else {
             return $this->getBodyAs($method->getRequest());
         }
     } else {
         return new Record();
     }
 }
Ejemplo n.º 3
0
 public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context)
 {
     $response = $this->processor->execute($configuration->get('source'), $request, $context);
     $body = Transformer::toRecord($response->getBody());
     return $this->processor->execute($configuration->get('destination'), $request->withBody($body), $context);
 }