docs/class-Psr.Http.Message.ServerRequestInterface.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Interface Psr\Http\Message\ServerRequestInterface | ξ ^ω^)ξ 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><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 class="active"><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 ServerRequestInterface</h1>
<div class="description">
<p>Representation of an incoming, server-side HTTP request.</p>
<p>Per the HTTP specification, this interface includes properties for
each of the following:</p>
<ul>
<li>Protocol version</li>
<li>HTTP method</li>
<li>URI</li>
<li>Headers</li>
<li>Message body</li>
</ul>
<p>Additionally, it encapsulates all data as it has arrived to the
application from the CGI and/or PHP environment, including:</p>
<ul>
<li>The values represented in $_SERVER.</li>
<li>Any cookies provided (generally via $_COOKIE)</li>
<li>Query string arguments (generally via $_GET, or as parsed via parse_str())</li>
<li>Upload files, if any (as represented by $_FILES)</li>
<li>Deserialized body parameters (generally from $_POST)</li>
</ul>
<p>$_SERVER values MUST be treated as immutable, as they represent application
state at the time of request; as such, no methods are provided to allow
modification of those values. The other values provide such methods, as they
can be restored from $_SERVER or the request body, and may need treatment
during the application (e.g., body parameters may be deserialized based on
content type).</p>
<p>Additionally, this interface recognizes the utility of introspecting a
request to derive and match additional parameters (e.g., via URI path
matching, decrypting cookie values, deserializing non-form-encoded body
content, matching authorization headers to users, etc). These parameters
are stored in an "attributes" property.</p>
<p>Requests 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>
<dl class="tree">
<dd style="padding-left:0px">
<b><span>Psr\Http\Message\ServerRequestInterface</span></b>
implements
<a href="class-Psr.Http.Message.RequestInterface.html"><span>Psr\Http\Message\RequestInterface</span></a>
</dd>
</dl>
<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>Located at</b> <a href="source-class-Psr.Http.Message.ServerRequestInterface.html#5-261" title="Go to source code">ServerRequestInterface.php</a>
<br>
</div>
<table class="summary methods" id="methods">
<caption>Methods summary</caption>
<tr data-order="getServerParams" id="_getServerParams">
<td class="attributes"><code>
public
array
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getServerParams">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#45-54" title="Go to source code">getServerParams</a>( )</code>
<div class="description short">
<p>Retrieve server parameters.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve server parameters.</p>
<p>Retrieves data related to the incoming request environment,
typically derived from PHP's $_SERVER superglobal. The data IS NOT
REQUIRED to originate from $_SERVER.</p>
<h4>Returns</h4>
<div class="list">
array
</div>
</div>
</div></td>
</tr>
<tr data-order="getCookieParams" id="_getCookieParams">
<td class="attributes"><code>
public
array
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getCookieParams">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#56-66" title="Go to source code">getCookieParams</a>( )</code>
<div class="description short">
<p>Retrieve cookies.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve cookies.</p>
<p>Retrieves cookies sent by the client to the server.</p>
<p>The data MUST be compatible with the structure of the $_COOKIE
superglobal.</p>
<h4>Returns</h4>
<div class="list">
array
</div>
</div>
</div></td>
</tr>
<tr data-order="withCookieParams" id="_withCookieParams">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withCookieParams">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#68-85" title="Go to source code">withCookieParams</a>( <span>array <var>$cookies</var></span> )</code>
<div class="description short">
<p>Return an instance with the specified cookies.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance with the specified cookies.</p>
<p>The data IS NOT REQUIRED to come from the $_COOKIE superglobal, but MUST
be compatible with the structure of $_COOKIE. Typically, this data will
be injected at instantiation.</p>
<p>This method MUST NOT update the related Cookie header of the request
instance, nor related values in the server params.</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
updated cookie values.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$cookies</var></dt>
<dd>Array of key/value pairs representing cookies.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
</div>
</div></td>
</tr>
<tr data-order="getQueryParams" id="_getQueryParams">
<td class="attributes"><code>
public
array
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getQueryParams">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#87-99" title="Go to source code">getQueryParams</a>( )</code>
<div class="description short">
<p>Retrieve query string arguments.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve query string arguments.</p>
<p>Retrieves the deserialized query string arguments, if any.</p>
<p>Note: the query params might not be in sync with the URI or server
params. If you need to ensure you are only getting the original
values, you may need to parse the query string from <code>getUri()->getQuery()</code>
or from the <code>QUERY_STRING</code> server param.</p>
<h4>Returns</h4>
<div class="list">
array
</div>
</div>
</div></td>
</tr>
<tr data-order="withQueryParams" id="_withQueryParams">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withQueryParams">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#101-123" title="Go to source code">withQueryParams</a>( <span>array <var>$query</var></span> )</code>
<div class="description short">
<p>Return an instance with the specified query string arguments.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance with the specified query string arguments.</p>
<p>These values SHOULD remain immutable over the course of the incoming
request. They MAY be injected during instantiation, such as from PHP's
$_GET superglobal, or MAY be derived from some other value such as the
URI. In cases where the arguments are parsed from the URI, the data
MUST be compatible with what PHP's parse_str() would return for
purposes of how duplicate query parameters are handled, and how nested
sets are handled.</p>
<p>Setting query string arguments MUST NOT change the URI stored by the
request, nor the values in the server params.</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
updated query string arguments.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$query</var></dt>
<dd><p>Array of query string arguments, typically from
$_GET.</p></dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
</div>
</div></td>
</tr>
<tr data-order="getUploadedFiles" id="_getUploadedFiles">
<td class="attributes"><code>
public
array
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getUploadedFiles">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#125-137" title="Go to source code">getUploadedFiles</a>( )</code>
<div class="description short">
<p>Retrieve normalized file upload data.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve normalized file upload data.</p>
<p>This method returns upload metadata in a normalized tree, with each leaf
an instance of Psr\Http\Message\UploadedFileInterface.</p>
<p>These values MAY be prepared from $_FILES or the message body during
instantiation, or MAY be injected via withUploadedFiles().</p>
<h4>Returns</h4>
<div class="list">
array<br><p>An array tree of UploadedFileInterface instances; an empty
array MUST be returned if no data is present.</p>
</div>
</div>
</div></td>
</tr>
<tr data-order="withUploadedFiles" id="_withUploadedFiles">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withUploadedFiles">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#139-150" title="Go to source code">withUploadedFiles</a>( <span>array <var>$uploadedFiles</var></span> )</code>
<div class="description short">
<p>Create a new instance with the specified uploaded files.</p>
</div>
<div class="description detailed hidden">
<p>Create a new instance with the specified uploaded files.</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
updated body parameters.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$uploadedFiles</var></dt>
<dd>An array tree of UploadedFileInterface instances.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
<h4>Throws</h4>
<div class="list">
InvalidArgumentException<br>if an invalid structure is provided.
</div>
</div>
</div></td>
</tr>
<tr data-order="getParsedBody" id="_getParsedBody">
<td class="attributes"><code>
public
null|array|object
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getParsedBody">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#152-167" title="Go to source code">getParsedBody</a>( )</code>
<div class="description short">
<p>Retrieve any parameters provided in the request body.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve any parameters provided in the request body.</p>
<p>If the request Content-Type is either application/x-www-form-urlencoded
or multipart/form-data, and the request method is POST, this method MUST
return the contents of $_POST.</p>
<p>Otherwise, this method may return any results of deserializing
the request body content; as parsing returns structured content, the
potential types MUST be arrays or objects only. A null value indicates
the absence of body content.</p>
<h4>Returns</h4>
<div class="list">
null|array|object<br><p>The deserialized body parameters, if any.
These will typically be an array or object.</p>
</div>
</div>
</div></td>
</tr>
<tr data-order="withParsedBody" id="_withParsedBody">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withParsedBody">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#169-197" title="Go to source code">withParsedBody</a>( <span>null|array|object <var>$data</var></span> )</code>
<div class="description short">
<p>Return an instance with the specified body parameters.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance with the specified body parameters.</p>
<p>These MAY be injected during instantiation.</p>
<p>If the request Content-Type is either application/x-www-form-urlencoded
or multipart/form-data, and the request method is POST, use this method
ONLY to inject the contents of $_POST.</p>
<p>The data IS NOT REQUIRED to come from $_POST, but MUST be the results of
deserializing the request body content. Deserialization/parsing returns
structured data, and, as such, this method ONLY accepts arrays or objects,
or a null value if nothing was available to parse.</p>
<p>As an example, if content negotiation determines that the request data
is a JSON payload, this method could be used to create a request
instance with the deserialized parameters.</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
updated body parameters.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$data</var></dt>
<dd><p>The deserialized body data. This will
typically be in an array or object.</p></dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
<h4>Throws</h4>
<div class="list">
InvalidArgumentException<br><p>if an unsupported argument type is
provided.</p>
</div>
</div>
</div></td>
</tr>
<tr data-order="getAttributes" id="_getAttributes">
<td class="attributes"><code>
public
array
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getAttributes">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#199-210" title="Go to source code">getAttributes</a>( )</code>
<div class="description short">
<p>Retrieve attributes derived from the request.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve attributes derived from the request.</p>
<p>The request "attributes" may be used to allow injection of any
parameters derived from the request: e.g., the results of path
match operations; the results of decrypting cookies; the results of
deserializing non-form-encoded message bodies; etc. Attributes
will be application and request specific, and CAN be mutable.</p>
<h4>Returns</h4>
<div class="list">
array<br>Attributes derived from the request.
</div>
</div>
</div></td>
</tr>
<tr data-order="getAttribute" id="_getAttribute">
<td class="attributes"><code>
public
mixed
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_getAttribute">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#212-227" title="Go to source code">getAttribute</a>( <span>string <var>$name</var></span>, <span>mixed <var>$default</var> = <span class="php-keyword1">null</span></span> )</code>
<div class="description short">
<p>Retrieve a single derived request attribute.</p>
</div>
<div class="description detailed hidden">
<p>Retrieve a single derived request attribute.</p>
<p>Retrieves a single derived request attribute as described in
getAttributes(). If the attribute has not been previously set, returns
the default value as provided.</p>
<p>This method obviates the need for a hasAttribute() method, as it allows
specifying a default value to return if the attribute is not found.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$name</var></dt>
<dd>The attribute name.</dd>
<dt><var>$default</var></dt>
<dd>Default value to return if the attribute does not exist.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
mixed
</div>
<h4>See</h4>
<div class="list">
<code><a href="class-Psr.Http.Message.ServerRequestInterface.html#_getAttributes">Psr\Http\Message\ServerRequestInterface::getAttributes()</a></code><br>
</div>
</div>
</div></td>
</tr>
<tr data-order="withAttribute" id="_withAttribute">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withAttribute">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#229-244" title="Go to source code">withAttribute</a>( <span>string <var>$name</var></span>, <span>mixed <var>$value</var></span> )</code>
<div class="description short">
<p>Return an instance with the specified derived request attribute.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance with the specified derived request attribute.</p>
<p>This method allows setting a single derived request attribute as
described in getAttributes().</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
updated attribute.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$name</var></dt>
<dd>The attribute name.</dd>
<dt><var>$value</var></dt>
<dd>The value of the attribute.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
<h4>See</h4>
<div class="list">
<code><a href="class-Psr.Http.Message.ServerRequestInterface.html#_getAttributes">Psr\Http\Message\ServerRequestInterface::getAttributes()</a></code><br>
</div>
</div>
</div></td>
</tr>
<tr data-order="withoutAttribute" id="_withoutAttribute">
<td class="attributes"><code>
public
static
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_withoutAttribute">#</a>
<code><a href="source-class-Psr.Http.Message.ServerRequestInterface.html#246-260" title="Go to source code">withoutAttribute</a>( <span>string <var>$name</var></span> )</code>
<div class="description short">
<p>Return an instance that removes the specified derived request attribute.</p>
</div>
<div class="description detailed hidden">
<p>Return an instance that removes the specified derived request attribute.</p>
<p>This method allows removing a single derived request attribute as
described in getAttributes().</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 attribute.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$name</var></dt>
<dd>The attribute name.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
static
</div>
<h4>See</h4>
<div class="list">
<code><a href="class-Psr.Http.Message.ServerRequestInterface.html#_getAttributes">Psr\Http\Message\ServerRequestInterface::getAttributes()</a></code><br>
</div>
</div>
</div></td>
</tr>
</table>
<table class="summary inherited">
<caption>Methods inherited from <a href="class-Psr.Http.Message.RequestInterface.html#methods">Psr\Http\Message\RequestInterface</a></caption>
<tr>
<td><code>
<a href="class-Psr.Http.Message.RequestInterface.html#_getMethod">getMethod()</a>,
<a href="class-Psr.Http.Message.RequestInterface.html#_getRequestTarget">getRequestTarget()</a>,
<a href="class-Psr.Http.Message.RequestInterface.html#_getUri">getUri()</a>,
<a href="class-Psr.Http.Message.RequestInterface.html#_withMethod">withMethod()</a>,
<a href="class-Psr.Http.Message.RequestInterface.html#_withRequestTarget">withRequestTarget()</a>,
<a href="class-Psr.Http.Message.RequestInterface.html#_withUri">withUri()</a>
</code></td>
</tr>
</table>
<table class="summary inherited">
<caption>Methods inherited from <a href="class-Psr.Http.Message.MessageInterface.html#methods">Psr\Http\Message\MessageInterface</a></caption>
<tr>
<td><code>
<a href="class-Psr.Http.Message.MessageInterface.html#_getBody">getBody()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_getHeader">getHeader()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_getHeaderLine">getHeaderLine()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_getHeaders">getHeaders()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_getProtocolVersion">getProtocolVersion()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_hasHeader">hasHeader()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_withAddedHeader">withAddedHeader()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_withBody">withBody()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_withHeader">withHeader()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_withProtocolVersion">withProtocolVersion()</a>,
<a href="class-Psr.Http.Message.MessageInterface.html#_withoutHeader">withoutHeader()</a>
</code></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>