$name){ $countries[] = [ 'iso_code' => $iso_code, 'name' => $name, ]; } $response = new PagingResponse ( count($countries), count($countries), 1, 1, $countries ); return $this->ok($response->toArray($expand = Input::get('expand',''))); } catch (ValidationException $ex1) { Log::warning($ex1); return $this->error412(array($ex1->getMessage())); } catch(EntityNotFoundException $ex2) { Log::warning($ex2); return $this->error404(array('message'=> $ex2->getMessage())); } catch (\Exception $ex) { Log::error($ex); return $this->error500($ex); } } }