Version 1
[yaffs-website] / vendor / jcalderonzumba / gastonjs / src / Browser / BrowserHeadersTrait.php
1 <?php
2
3 namespace Zumba\GastonJS\Browser;
4
5 /**
6  * Trait BrowserHeadersTrait
7  * @package Zumba\GastonJS\Browser
8  */
9 trait BrowserHeadersTrait {
10   /**
11    * Returns the headers of the current page that will be used the next request
12    * @return mixed
13    */
14   public function getHeaders() {
15     return $this->command('get_headers');
16   }
17
18   /**
19    * Given an array of headers, set such headers for the requests, removing all others
20    * @param array $headers
21    * @return mixed
22    */
23   public function setHeaders($headers) {
24     return $this->command('set_headers', $headers);
25   }
26
27   /**
28    * Adds headers to current page overriding the existing ones for the next requests
29    * @param $headers
30    * @return mixed
31    */
32   public function addHeaders($headers) {
33     return $this->command('add_headers', $headers);
34   }
35
36   /**
37    * Adds a header to the page making it permanent if needed
38    * @param $header
39    * @param $permanent
40    * @return mixed
41    */
42   public function addHeader($header, $permanent = false) {
43     return $this->command('add_header', $header, $permanent);
44   }
45
46   /**
47    * Gets the response headers after a request
48    * @return mixed
49    */
50   public function responseHeaders() {
51     return $this->command('response_headers');
52   }
53 }