protected function handleRestfulStrategy($controller, array $vars = [])
{
try {
$response = $this->invokeController($controller, [$this->container->get('Orno\\Http\\Request'), $vars]);
if ($response instanceof JsonResponse) {
return $response;
}
if (is_array($response) || $response instanceof \ArrayObject) {
return new JsonResponse($response);
}
throw new \RuntimeException('Your controller action must return a valid response for the Restful Strategy. ' . 'Acceptable responses are of type: [Array], [ArrayObject] and [Orno\\Http\\JsonResponse]');
} catch (HttpException $e) {
return $e->getJsonResponse();
}
}