Inheritance: use trait Webiny\Component\StdLib\StdLibTrait
Exemple #1
0
 public function testGetAll()
 {
     $_SERVER['HTTP_HOST'] = "localhost";
     $headers = new Headers();
     $this->assertSame(['Host' => 'localhost'], $headers->getAll());
 }
Exemple #2
0
 /**
  * Get a value from HTTP Headers
  * If key doesn't not exist, $value will be returned and assigned under that key.
  *
  * @param string $key   Key for which you wish to get the value.
  * @param mixed  $value Default value that will be returned if $key doesn't exist.
  *
  * @return mixed Value of the given $key.
  */
 public function header($key = null, $value = null)
 {
     return $this->isNull($key) ? $this->headers->getAll() : $this->headers->get($key, $value);
 }