'error', 'key' => 'cdf', 'method' => 'getCdf', 'data' => '', ]; if (!$request->headers->get('x-auth-token')) { $body['key'] = 'token'; $body['method'] = 'get'; $body['data'] = 'No token provided !'; return $respond->statusUnauthorized()->createBody($body)->respond(); } $cdfData = $cdf->getCdf($id); if (!$cdfData instanceof Exception) { // TODO : Update query to return Exception $body['type'] = "success"; $body['data'] = $cdfData; $respond->statusOK(); } else { $body['data'] = $cdfData->getMessage(); $respond->statusUnprocessableEntity(); } return $respond->createBody($body)->respond(); } }