Skip to content

Instantly share code, notes, and snippets.

@dusterio
Last active November 14, 2016 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dusterio/6191329e31e0c89a877a12957cb6bab3 to your computer and use it in GitHub Desktop.
Save dusterio/6191329e31e0c89a877a12957cb6bab3 to your computer and use it in GitHub Desktop.
<?php
class GatewayController extends Controller
{
/**
* @param Request $request
* @param RestClient $client
* @return Response
*/
public function get(Request $request, RestClient $client)
{
$parametersJar = $request->getRouteParams();
$output = $this->actions->reduce(function($carry, $batch) use (&$parametersJar, $client) {
$responses = $client->asyncRequest($batch, $parametersJar);
$parametersJar = array_merge($parametersJar, $responses->exportParameters());
return array_merge($carry, $responses->getResponses()->toArray());
}, []);
return $this->presenter->format($this->rearrangeKeys($output), 200);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment