Пример #1
0
 /**
  * @param array $data
  * @param int $statusCode
  * @return Response
  */
 public static function json(array $data, $statusCode = 200)
 {
     $response = new JsonResponse();
     $response->setContent(json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT));
     $response->setHeader('Content-Type', 'application/json');
     $response->setStatusCode($statusCode);
     return $response;
 }