예제 #1
0
파일: Transform.php 프로젝트: uqiauto/fusio
 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);
 }
예제 #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();
     }
 }
예제 #3
0
파일: Pipe.php 프로젝트: uqiauto/fusio
 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);
 }