Response - WaZeR-Adrien/Lightwork-api GitHub Wiki

Create a response :

/**
 * Response constructor.
 * @param Route $route
 * @param string $contentType
 */
public function __construct(Route $route, $contentType = "text/html; charset=UTF-8")

Features of Response :

  • public function getData() : get the data of the response
  • public function setData($data) : set the data of the response
  • public function getResponseCode() : get the code of the response
  • public function setResponseCode($responseCode) : set the code of the response
  • public function isSuccess() : check if the response code if an success
  • public function getRoute() : get the route of the response
  • public function getHeaders() : get the route of the response
  • public function getBody() : get the route of the response
  • public function render($code, $key = null) : render a response
  • public function toJson() : convert the content to of the response in JSON
  • public function toXml : convert the content to of the response in XML
  • public function view($view) : render a view