You are here

class Request in Zircon Profile 8

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

Class Request @package Zumba\GastonJS\NetworkTraffic

Hierarchy

  • class \Zumba\GastonJS\NetworkTraffic\Request

Expanded class hierarchy of Request

1 file declares its use of Request
BrowserNetworkTrait.php in vendor/jcalderonzumba/gastonjs/src/Browser/BrowserNetworkTrait.php
3 string references to 'Request'
legacy-services6.yml in vendor/symfony/dependency-injection/Tests/Fixtures/yaml/legacy-services6.yml
vendor/symfony/dependency-injection/Tests/Fixtures/yaml/legacy-services6.yml
services20.yml in vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services20.yml
vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services20.yml
services9.yml in vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services9.yml
vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services9.yml

File

vendor/jcalderonzumba/gastonjs/src/NetworkTraffic/Request.php, line 9

Namespace

Zumba\GastonJS\NetworkTraffic
View source
class Request {

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

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

  /**
   * @param array $data
   * @param array $responseParts
   */
  public function __construct($data, $responseParts = null) {
    $this->data = $data;
    $this->responseParts = $this
      ->createResponseParts($responseParts);
  }

  /**
   * Creates an array of Response objects from a given response array
   * @param $responseParts
   * @return array
   */
  protected function createResponseParts($responseParts) {
    if ($responseParts === null) {
      return array();
    }
    $responses = array();
    foreach ($responseParts as $responsePart) {
      $responses[] = new Response($responsePart);
    }
    return $responses;
  }

  /**
   * @return array
   */
  public function getResponseParts() {
    return $this->responseParts;
  }

  /**
   * @param array $responseParts
   */
  public function setResponseParts($responseParts) {
    $this->responseParts = $responseParts;
  }

  /**
   * Returns the url where the request is going to be made
   * @return string
   */
  public function getUrl() {

    //TODO: add isset maybe?
    return $this->data['url'];
  }

  /**
   * Returns the request method
   * @return string
   */
  public function getMethod() {
    return $this->data['method'];
  }

  /**
   * Gets the request headers
   * @return array
   */
  public function getHeaders() {

    //TODO: Check if the data is actually an array, else make it array and see implications
    return $this->data['headers'];
  }

  /**
   * Returns if exists the request 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
Request::$data protected property @var array
Request::$responseParts protected property @var array
Request::createResponseParts protected function Creates an array of Response objects from a given response array
Request::getHeaders public function Gets the request headers
Request::getMethod public function Returns the request method
Request::getResponseParts public function
Request::getTime public function Returns if exists the request time
Request::getUrl public function Returns the url where the request is going to be made
Request::setResponseParts public function
Request::__construct public function