src/AbstractWebApplication.php
public function setHeader($name, $value, $replace = false)
	{
		// Sanitize the input values.
		$name  = (string) $name;
		$value = (string) $value;

		// If the replace flag is set, unset all known headers with the given name.
		if ($replace)
		{
			foreach ($this->response->headers as $key => $header)
			{
				if ($name == $header['name'])
				{
					unset($this->response->headers[$key]);
				}
			}

			// Clean up the array as unsetting nested arrays leaves some junk.
			$this->response->headers = array_values($this->response->headers);
		}

		// Add the header to the internal array.
		$this->response->headers[] = array('name' => $name, 'value' => $value);

		return $this;
	}
public function setHeader($name, $value, $replace = false)
	{
		// Sanitize the input values.
		$name  = (string) $name;
		$value = (string) $value;

		// If the replace flag is set, unset all known headers with the given name.
		if ($replace)
		{
			foreach ($this->response->headers as $key => $header)
			{
				if ($name == $header['name'])
				{
					unset($this->response->headers[$key]);
				}
			}

			// Clean up the array as unsetting nested arrays leaves some junk.
			$this->response->headers = array_values($this->response->headers);
		}

		// Add the header to the internal array.
		$this->response->headers[] = array('name' => $name, 'value' => $value);

		return $this;
	}
public function setHeader ( $ name , $ value , $ replace = false ) { // Sanitize the input values. $ name = ( string ) $ name ; $ value = ( string ) $ value ; // If the replace flag is set, unset all known headers with the given name. if ( $ replace ) { foreach ( $ this -> response -> headers as $ key => $ header ) { if ( $ name == $ header [ 'name' ] ) { unset ( $ this -> response -> headers [ $ key ] ) ; } } // Clean up the array as unsetting nested arrays leaves some junk. $ this -> response -> headers = array_values ( $ this -> response -> headers ) ; } // Add the header to the internal array. $ this -> response -> headers [ ] = array ( 'name' => $ name , 'value' => $ value ) ; return $ this ; }
Method to set a response header.  If the replace flag is set then all headers
with the given name will be replaced by the new one.  The headers are stored
in an internal array to be sent when the site is sent to the browser.

@param   string   $name     The name of the header to set.
@param   string   $value    The value of the header to set.
@param   boolean  $replace  True to replace any headers with the same name.

@return  AbstractWebApplication  Instance of $this to allow chaining.

@since   1.0
Method to set a response header . If the replace flag is set then all headers with the given name will be replaced by the new one . The headers are stored in an internal array to be sent when the site is sent to the browser .