2 namespace Zumba\GastonJS\NetworkTraffic;
6 * @package Zumba\GastonJS\NetworkTraffic
15 public function __construct($data) {
23 public function getUrl() {
24 return $this->data['url'];
28 * Gets the response status code
31 public function getStatus() {
32 return intval($this->data['status']);
36 * Gets the status text of the response
39 public function getStatusText() {
40 return $this->data['statusText'];
44 * Gets the response headers
47 public function getHeaders() {
48 return $this->data['headers'];
52 * Get redirect url if response is a redirect
55 public function getRedirectUrl() {
56 if (isset($this->data['redirectUrl']) && !empty($this->data['redirectUrl'])) {
57 return $this->data['redirectUrl'];
63 * Returns the size of the response body
66 public function getBodySize() {
67 if (isset($this->data['bodySize'])) {
68 return intval($this->data['bodySize']);
74 * Returns the content type of the response
77 public function getContentType() {
78 if (isset($this->data['contentType'])) {
79 return $this->data['contentType'];
85 * Returns if exists the response time
88 public function getTime() {
89 if (isset($this->data['time'])) {
90 $requestTime = new \DateTime();
91 //TODO: fix the microseconds to miliseconds
92 $requestTime->createFromFormat("Y-m-dTH:i:s.uZ", $this->data["time"]);