ResponseBase
in package
Base class for API responses.
This class provides common functionality for handling different response formats (CSV, HTML, JSON).
Table of Contents
Properties
Methods
- __construct() : mixed
- ResponseBase constructor.
- getCsv() : string
- Get the CSV content of the response.
- getHtml() : string
- Get the HTML content of the response.
- isCsv() : bool
- Check if the response is in CSV format.
- isHtml() : bool
- Check if the response is in HTML format.
- isJson() : bool
- Check if the response is in JSON format.
Properties
$csv
protected
string
$csv
The CSV content of the response.
$html
protected
string
$html
The HTML content of the response.
Methods
__construct()
ResponseBase constructor.
public
__construct(object $response) : mixed
Parameters
- $response : object
-
The raw response object from the API.
getCsv()
Get the CSV content of the response.
public
getCsv() : string
Return values
string —The CSV content.
getHtml()
Get the HTML content of the response.
public
getHtml() : string
Return values
string —The HTML content.
isCsv()
Check if the response is in CSV format.
public
isCsv() : bool
Return values
bool —True if the response is in CSV format, false otherwise.
isHtml()
Check if the response is in HTML format.
public
isHtml() : bool
Return values
bool —True if the response is in HTML format, false otherwise.
isJson()
Check if the response is in JSON format.
public
isJson() : bool
Return values
bool —True if the response is in JSON format, false otherwise.