docs/class-Psr.Http.Message.MessageInterface.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Interface Psr\Http\Message\MessageInterface | ξ ^ω^)ξ Baguette PHP Mastodon API Client / SDK</title>
<link rel="stylesheet" href="resources/style.css?c2f33731c1948fbed7c333554678bfa68d4817da">
</head>
<body>
<div id="left">
<div id="menu">
<a href="index.html" title="Overview"><span>Overview</span></a>
<div id="groups">
<h3>Namespaces</h3>
<ul>
<li>
<a href="namespace-Baguette.html">
Baguette<span></span>
</a>
<ul>
<li>
<a href="namespace-Baguette.Mastodon.html">
Mastodon<span></span>
</a>
<ul>
<li class="main">
<a href="namespace-Baguette.Mastodon.Config.html">
Config </a>
</li>
<li class="main">
<a href="namespace-Baguette.Mastodon.Entity.html">
Entity </a>
</li>
<li class="main">
<a href="namespace-Baguette.Mastodon.Grant.html">
Grant </a>
</li>
<li class="main">
<a href="namespace-Baguette.Mastodon.Service.html">
Service </a>
</li>
</ul></li></ul></li>
<li>
<a href="namespace-GuzzleHttp.html">
GuzzleHttp<span></span>
</a>
<ul>
<li>
<a href="namespace-GuzzleHttp.Cookie.html">
Cookie </a>
</li>
<li>
<a href="namespace-GuzzleHttp.Exception.html">
Exception </a>
</li>
<li>
<a href="namespace-GuzzleHttp.Handler.html">
Handler </a>
</li>
<li>
<a href="namespace-GuzzleHttp.Promise.html">
Promise </a>
</li>
</ul></li>
<li class="active">
<a href="namespace-Psr.html">
Psr<span></span>
</a>
<ul>
<li class="active">
<a href="namespace-Psr.Http.html">
Http<span></span>
</a>
<ul>
<li class="active">
<a href="namespace-Psr.Http.Message.html">
Message </a>
</li>
</ul></li></ul></li>
<li>
<a href="namespace-Teto.html">
Teto<span></span>
</a>
<ul>
<li>
<a href="namespace-Teto.Object.html">
Object </a>
</li>
</ul></li>
</ul>
</div>
<hr>
<div id="elements">
<h3>Interfaces</h3>
<ul>
<li class="active"><a href="class-Psr.Http.Message.MessageInterface.html">MessageInterface</a></li>
<li><a href="class-Psr.Http.Message.RequestInterface.html">RequestInterface</a></li>
<li><a href="class-Psr.Http.Message.ResponseInterface.html">ResponseInterface</a></li>
<li><a href="class-Psr.Http.Message.ServerRequestInterface.html">ServerRequestInterface</a></li>
<li><a href="class-Psr.Http.Message.StreamInterface.html">StreamInterface</a></li>
<li><a href="class-Psr.Http.Message.UploadedFileInterface.html">UploadedFileInterface</a></li>
<li><a href="class-Psr.Http.Message.UriInterface.html">UriInterface</a></li>
</ul>
</div>
</div>
</div>
<div id="splitter"></div>
<div id="right">
<div id="rightInner">
<form id="search">
<input type="hidden" name="cx" value="">
<input type="hidden" name="ie" value="UTF-8">
<input type="text" name="q" class="text" placeholder="Search">
</form>
<div id="navigation">
<ul>
<li>
<a href="index.html" title="Overview"><span>Overview</span></a>
</li>
<li>
<a href="namespace-Psr.Http.Message.html" title="Summary of Psr\Http\Message"><span>Namespace</span></a>
</li>
<li class="active">
<span>Class</span> </li>
</ul>
<ul>
</ul>
<ul>
</ul>
</div>
<div id="content" class="class">
<h1>Interface MessageInterface</h1>
<div class="description">
<p>HTTP messages consist of requests from a client to a server and responses
from a server to a client. This interface defines the methods common to
each.</p>
<p>Messages are considered immutable; all methods that might change state MUST
be implemented such that they retain the internal state of the current
message and return an instance that contains the changed state.</p>
</div>
<div>
<h4>Direct known implementers</h4>
<a href="class-Psr.Http.Message.RequestInterface.html">Psr\Http\Message\RequestInterface</a>,
<a href="class-Psr.Http.Message.ResponseInterface.html">Psr\Http\Message\ResponseInterface</a>
</div>
<div>
<h4>Indirect known implementers</h4>
<a href="class-Psr.Http.Message.ServerRequestInterface.html">Psr\Http\Message\ServerRequestInterface</a>
</div>
<div class="info">
<b>Namespace:</b> <a href="namespace-Psr.html">Psr</a>\<a href="namespace-Psr.Http.html">Http</a>\<a href="namespace-Psr.Http.Message.html">Message</a><br>
<b>Link:</b>
<a href="http://www.ietf.org/rfc/rfc7230.txt">http://www.ietf.org/rfc/rfc7230.txt</a><br>
<b>Link:</b>
<a href="http://www.ietf.org/rfc/rfc7231.txt">http://www.ietf.org/rfc/rfc7231.txt</a><br>
<b>Located at</b> <a href="source-class-Psr.Http.Message.MessageInterface.html#5-187" title="Go to source code">MessageInterface.php</a>
<br>
</div>
<table class="summary methods" id="methods">
<caption>Methods summary</caption>
<tr data-order="getProtocolVersion" id="_getProtocolVersion">
<td class="attributes"><code>
public
string
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getProtocolVersion">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#19-26" title="Go to source code">getProtocolVersion</a>( )</code>
<div class="description short">
<p>Retrieves the HTTP protocol version as a string.</p>
</div>
<div class="description detailed hidden">
<p>Retrieves the HTTP protocol version as a string.</p>
<p>The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").</p>
<h4>Returns</h4>
<div class="list">
string<br>HTTP protocol version.
</div>
</div>
</div></td>
</tr>
<tr data-order="withProtocolVersion" id="_withProtocolVersion">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withProtocolVersion">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#28-41" title="Go to source code">withProtocolVersion</a>( <span>string <var>$version</var></span> )</code>
<div class="description short">
<p>Return an instance with the specified HTTP protocol version.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance with the specified HTTP protocol version.</p>
<p>The version string MUST contain only the HTTP version number (e.g.,
"1.1", "1.0").</p>
<p>This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that has the
new protocol version.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$version</var></dt>
<dd>HTTP protocol version</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
</div>
</div></td>
</tr>
<tr data-order="getHeaders" id="_getHeaders">
<td class="attributes"><code>
public
string[][]
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getHeaders">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#43-68" title="Go to source code">getHeaders</a>( )</code>
<div class="description short">
<p>Retrieves all message header values.</p>
</div>
<div class="description detailed hidden">
<p>Retrieves all message header values.</p>
<p>The keys represent the header name as it will be sent over the wire, and
each value is an array of strings associated with the header.
// Represent the headers as a string foreach ($message->getHeaders() as $name => $values) { echo $name . ": " . implode(", ", $values); }
// Emit headers iteratively: foreach ($message->getHeaders() as $name => $values) { foreach ($values as $value) { header(sprintf('%s: %s', $name, $value), false); } }</p>
<p>While header names are not case-sensitive, getHeaders() will preserve the
exact case in which headers were originally specified.</p>
<h4>Returns</h4>
<div class="list">
string[][]<br><p>Returns an associative array of the message's headers. Each
key MUST be a header name, and each value MUST be an array of strings
for that header.</p>
</div>
</div>
</div></td>
</tr>
<tr data-order="hasHeader" id="_hasHeader">
<td class="attributes"><code>
public
boolean
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_hasHeader">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#70-78" title="Go to source code">hasHeader</a>( <span>string <var>$name</var></span> )</code>
<div class="description short">
<p>Checks if a header exists by the given case-insensitive name.</p>
</div>
<div class="description detailed hidden">
<p>Checks if a header exists by the given case-insensitive name.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$name</var></dt>
<dd>Case-insensitive header field name.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
boolean<br><p>Returns true if any header names match the given header
name using a case-insensitive string comparison. Returns false if
no matching header name is found in the message.</p>
</div>
</div>
</div></td>
</tr>
<tr data-order="getHeader" id="_getHeader">
<td class="attributes"><code>
public
string[]
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getHeader">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#80-94" title="Go to source code">getHeader</a>( <span>string <var>$name</var></span> )</code>
<div class="description short">
<p>Retrieves a message header value by the given case-insensitive name.</p>
</div>
<div class="description detailed hidden">
<p>Retrieves a message header value by the given case-insensitive name.</p>
<p>This method returns an array of all the header values of the given
case-insensitive header name.</p>
<p>If the header does not appear in the message, this method MUST return an
empty array.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$name</var></dt>
<dd>Case-insensitive header field name.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
string[]<br><p>An array of string values as provided for the given
header. If the header does not appear in the message, this method MUST
return an empty array.</p>
</div>
</div>
</div></td>
</tr>
<tr data-order="getHeaderLine" id="_getHeaderLine">
<td class="attributes"><code>
public
string
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getHeaderLine">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#96-115" title="Go to source code">getHeaderLine</a>( <span>string <var>$name</var></span> )</code>
<div class="description short">
<p>Retrieves a comma-separated string of the values for a single header.</p>
</div>
<div class="description detailed hidden">
<p>Retrieves a comma-separated string of the values for a single header.</p>
<p>This method returns all of the header values of the given
case-insensitive header name as a string concatenated together using
a comma.</p>
<p>NOTE: Not all header values may be appropriately represented using
comma concatenation. For such headers, use getHeader() instead
and supply your own delimiter when concatenating.</p>
<p>If the header does not appear in the message, this method MUST return
an empty string.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$name</var></dt>
<dd>Case-insensitive header field name.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
string<br><p>A string of values as provided for the given header
concatenated together using a comma. If the header does not appear in
the message, this method MUST return an empty string.</p>
</div>
</div>
</div></td>
</tr>
<tr data-order="withHeader" id="_withHeader">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withHeader">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#117-132" title="Go to source code">withHeader</a>( <span>string <var>$name</var></span>, <span>string|string[] <var>$value</var></span> )</code>
<div class="description short">
<p>Return an instance with the provided value replacing the specified header.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance with the provided value replacing the specified header.</p>
<p>While header names are case-insensitive, the casing of the header will
be preserved by this function, and returned from getHeaders().</p>
<p>This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that has the
new and/or updated header and value.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$name</var></dt>
<dd>Case-insensitive header field name.</dd>
<dt><var>$value</var></dt>
<dd>Header value(s).</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
<h4>Throws</h4>
<div class="list">
InvalidArgumentException<br>for invalid header names or values.
</div>
</div>
</div></td>
</tr>
<tr data-order="withAddedHeader" id="_withAddedHeader">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withAddedHeader">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#134-150" title="Go to source code">withAddedHeader</a>( <span>string <var>$name</var></span>, <span>string|string[] <var>$value</var></span> )</code>
<div class="description short">
<p>Return an instance with the specified header appended with the given value.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance with the specified header appended with the given value.</p>
<p>Existing values for the specified header will be maintained. The new
value(s) will be appended to the existing list. If the header did not
exist previously, it will be added.</p>
<p>This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that has the
new header and/or value.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$name</var></dt>
<dd>Case-insensitive header field name to add.</dd>
<dt><var>$value</var></dt>
<dd>Header value(s).</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
<h4>Throws</h4>
<div class="list">
InvalidArgumentException<br>for invalid header names or values.
</div>
</div>
</div></td>
</tr>
<tr data-order="withoutHeader" id="_withoutHeader">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withoutHeader">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#152-164" title="Go to source code">withoutHeader</a>( <span>string <var>$name</var></span> )</code>
<div class="description short">
<p>Return an instance without the specified header.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance without the specified header.</p>
<p>Header resolution MUST be done without case-sensitivity.</p>
<p>This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that removes
the named header.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$name</var></dt>
<dd>Case-insensitive header field name to remove.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
</div>
</div></td>
</tr>
<tr data-order="getBody" id="_getBody">
<td class="attributes"><code>
public
<code><a href="class-Psr.Http.Message.StreamInterface.html">Psr\Http\Message\StreamInterface</a></code>
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getBody">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#166-171" title="Go to source code">getBody</a>( )</code>
<div class="description short">
<p>Gets the body of the message.</p>
</div>
<div class="description detailed hidden">
<p>Gets the body of the message.</p>
<h4>Returns</h4>
<div class="list">
<code><a href="class-Psr.Http.Message.StreamInterface.html">Psr\Http\Message\StreamInterface</a></code><br>Returns the body as a stream.
</div>
</div>
</div></td>
</tr>
<tr data-order="withBody" id="_withBody">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withBody">#</a>
<code><a href="source-class-Psr.Http.Message.MessageInterface.html#173-186" title="Go to source code">withBody</a>( <span><code><a href="class-Psr.Http.Message.StreamInterface.html">Psr\Http\Message\StreamInterface</a></code> <var>$body</var></span> )</code>
<div class="description short">
<p>Return an instance with the specified message body.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance with the specified message body.</p>
<p>The body MUST be a StreamInterface object.</p>
<p>This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return a new instance that has the
new body stream.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$body</var></dt>
<dd>Body.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
<h4>Throws</h4>
<div class="list">
InvalidArgumentException<br>When the body is not valid.
</div>
</div>
</div></td>
</tr>
</table>
</div>
<div id="footer">
ξ ^ω^)ξ Baguette PHP Mastodon API Client / SDK API documentation generated by <a href="http://apigen.org">ApiGen</a>
</div>
</div>
</div>
<script src="resources/combined.js"></script>
<script src="elementlist.js"></script>
</body>
</html>