You are here

class Response in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response
  2. 8 vendor/symfony/browser-kit/Response.php \Symfony\Component\BrowserKit\Response
  3. 8 vendor/zendframework/zend-diactoros/src/Response.php \Zend\Diactoros\Response
  4. 8 vendor/zendframework/zend-stdlib/src/Response.php \Zend\Stdlib\Response
  5. 8 vendor/guzzlehttp/psr7/src/Response.php \GuzzleHttp\Psr7\Response
  6. 8 vendor/jcalderonzumba/gastonjs/src/NetworkTraffic/Response.php \Zumba\GastonJS\NetworkTraffic\Response
  7. 8 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Response.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Response
Same name and namespace in other branches
  1. 8.0 vendor/jcalderonzumba/gastonjs/src/NetworkTraffic/Response.php \Zumba\GastonJS\NetworkTraffic\Response

Class Response @package Zumba\GastonJS\NetworkTraffic

Hierarchy

  • class \Zumba\GastonJS\NetworkTraffic\Response

Expanded class hierarchy of Response

1 string reference to 'Response'
form_test.routing.yml in core/modules/system/tests/modules/form_test/form_test.routing.yml
core/modules/system/tests/modules/form_test/form_test.routing.yml

File

vendor/jcalderonzumba/gastonjs/src/NetworkTraffic/Response.php, line 8

Namespace

Zumba\GastonJS\NetworkTraffic
View source
class Response {

  /** @var  array */
  protected $data;

  /**
   * @param $data
   */
  public function __construct($data) {
    $this->data = $data;
  }

  /**
   * Gets Response url
   * @return string
   */
  public function getUrl() {
    return $this->data['url'];
  }

  /**
   * Gets the response status code
   * @return int
   */
  public function getStatus() {
    return intval($this->data['status']);
  }

  /**
   * Gets the status text of the response
   * @return string
   */
  public function getStatusText() {
    return $this->data['statusText'];
  }

  /**
   * Gets the response headers
   * @return array
   */
  public function getHeaders() {
    return $this->data['headers'];
  }

  /**
   * Get redirect url if response is a redirect
   * @return string
   */
  public function getRedirectUrl() {
    if (isset($this->data['redirectUrl']) && !empty($this->data['redirectUrl'])) {
      return $this->data['redirectUrl'];
    }
    return null;
  }

  /**
   * Returns the size of the response body
   * @return int
   */
  public function getBodySize() {
    if (isset($this->data['bodySize'])) {
      return intval($this->data['bodySize']);
    }
    return 0;
  }

  /**
   * Returns the content type of the response
   * @return string
   */
  public function getContentType() {
    if (isset($this->data['contentType'])) {
      return $this->data['contentType'];
    }
    return null;
  }

  /**
   * Returns if exists the response time
   * @return \DateTime
   */
  public function getTime() {
    if (isset($this->data['time'])) {
      $requestTime = new \DateTime();

      //TODO: fix the microseconds to miliseconds
      $requestTime
        ->createFromFormat("Y-m-dTH:i:s.uZ", $this->data["time"]);
      return $requestTime;
    }
    return null;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Response::$data protected property @var array
Response::getBodySize public function Returns the size of the response body
Response::getContentType public function Returns the content type of the response
Response::getHeaders public function Gets the response headers
Response::getRedirectUrl public function Get redirect url if response is a redirect
Response::getStatus public function Gets the response status code
Response::getStatusText public function Gets the status text of the response
Response::getTime public function Returns if exists the response time
Response::getUrl public function Gets Response url
Response::__construct public function