* @template-extends Response> */ class DataResponse extends Response { /** * response data * @var T */ protected $data; /** * @param T $data the object or array that should be transformed * @param S $statusCode the Http status code, defaults to 200 * @param H $headers additional key value based headers * @since 8.0.0 */ public function __construct(mixed $data = [], int $statusCode = Http::STATUS_OK, array $headers = []) { parent::__construct($statusCode, $headers); $this->data = $data; } /** * Sets values in the data json array * @psalm-suppress InvalidTemplateParam * @param T $data an array or object which will be transformed * @return DataResponse Reference to this object * @since 8.0.0 */ public function setData($data) { $this->data = $data; return $this; } /** * Used to get the set parameters * @return T the data * @since 8.0.0 */ public function getData() { return $this->data; } }