Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ApiResponse extends JsonResponse
- {
- /**
- * @OA\Property(description="Данные", type="object")
- */
- public $data;
- /**
- * @OA\Property(
- * property="meta",
- * type="object",
- * description="Разная опциональная дополнительная информация"
- * )
- */
- public $meta;
- /**
- * @OA\Property(description="Список ошибок", type="object")
- * @var object | null
- */
- public $errors;
- /**
- *
- * @param null $data
- * @param null $meta
- * @param null $errors
- * @param int $status
- * @param array $headers
- */
- public function __construct($data = null, $meta = null, $errors = null, int $status = 200, array $headers = [])
- {
- $data = [
- 'data' => $data,
- 'meta' => $meta,
- 'errors' => $errors
- ];
- parent::__construct($data, $status, $headers, false);
- $this->setEncodingOptions(JSON_UNESCAPED_UNICODE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement