Skip to content

Instantly share code, notes, and snippets.

@thewilkybarkid
Last active December 10, 2015 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thewilkybarkid/4442127 to your computer and use it in GitHub Desktop.
Save thewilkybarkid/4442127 to your computer and use it in GitHub Desktop.
<?php
namespace Psr\Http\Header;
/**
* HTTP message header.
*/
interface HeaderInterface
{
/**
* Return the header in the format 'Name: Value'.
*
* @return string Header as a string.
*/
public function __toString();
/**
* Gets the header name.
*
* @return string Header name.
*/
public function getName();
/**
* Sets the header name.
*
* @param string $name Header name.
*
* @return self Reference to the header.
*/
public function setName($name);
/**
* Gets the header value.
*
* @return string Value.
*/
public function value();
/**
* Sets the header value.
*
* A null value will remove an existing value.
*
* @param string|array $value Value.
*
* @return self Reference to the header.
*/
public function set($value);
}
<?php
namespace Psr\Http\Header;
use Countable,
Traversable;
/**
* HTTP message header that can contain more than one value.
*/
interface MultiValueHeaderInterface extends HeaderInterface, Traversable, Countable
{
/**
* Return the header in the format 'Name: Value, Value'.
*
* @return string Header as a string.
*/
public function __toString();
/**
* Gets the header value in the format 'Value, Value'.
*
* @return string Value.
*/
public function value();
/**
* Gets the header values.
*
* @return array Values.
*/
public function all();
/**
* Sets the header values.
*
* The value is a either an array of values, or a string containing
* comma-delimited values.
*
* A null value will remove all existing values.
*
* @param string|array $values Values.
*
* @return self Reference to the header.
*/
public function set($values);
/**
* Adds a value to the header.
*
* @param string $value Value to add.
*
* @return self Reference to the header.
*/
public function add($value);
/**
* Checks if a certain value is present.
*
* @param string $value Value.
*
* @return bool If the value is present.
*/
public function contains($value);
/**
* Remove a specific value from the header.
*
* @param string $value Value to remove.
*
* @return self Reference to the header.
*/
public function remove($value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment