docs/class-GuzzleHttp.Middleware.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class GuzzleHttp\Middleware | ξ ^ω^)ξ 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 class="active">
<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>
<a href="namespace-Psr.html">
Psr<span></span>
</a>
<ul>
<li>
<a href="namespace-Psr.Http.html">
Http<span></span>
</a>
<ul>
<li>
<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>Classes</h3>
<ul>
<li><a href="class-GuzzleHttp.Client.html">Client</a></li>
<li><a href="class-GuzzleHttp.HandlerStack.html">HandlerStack</a></li>
<li><a href="class-GuzzleHttp.MessageFormatter.html">MessageFormatter</a></li>
<li class="active"><a href="class-GuzzleHttp.Middleware.html">Middleware</a></li>
<li><a href="class-GuzzleHttp.Pool.html">Pool</a></li>
<li><a href="class-GuzzleHttp.PrepareBodyMiddleware.html">PrepareBodyMiddleware</a></li>
<li><a href="class-GuzzleHttp.RedirectMiddleware.html">RedirectMiddleware</a></li>
<li><a href="class-GuzzleHttp.RequestOptions.html">RequestOptions</a></li>
<li><a href="class-GuzzleHttp.RetryMiddleware.html">RetryMiddleware</a></li>
<li><a href="class-GuzzleHttp.TransferStats.html">TransferStats</a></li>
<li><a href="class-GuzzleHttp.UriTemplate.html">UriTemplate</a></li>
</ul>
<h3>Interfaces</h3>
<ul>
<li><a href="class-GuzzleHttp.ClientInterface.html">ClientInterface</a></li>
</ul>
<h3>Functions</h3>
<ul>
<li><a href="function-GuzzleHttp.choose_handler.html">choose_handler</a></li>
<li><a href="function-GuzzleHttp.debug_resource.html">debug_resource</a></li>
<li><a href="function-GuzzleHttp.default_ca_bundle.html">default_ca_bundle</a></li>
<li><a href="function-GuzzleHttp.default_user_agent.html">default_user_agent</a></li>
<li><a href="function-GuzzleHttp.describe_type.html">describe_type</a></li>
<li><a href="function-GuzzleHttp.headers_from_lines.html">headers_from_lines</a></li>
<li><a href="function-GuzzleHttp.is_host_in_noproxy.html">is_host_in_noproxy</a></li>
<li><a href="function-GuzzleHttp.json_decode.html">json_decode</a></li>
<li><a href="function-GuzzleHttp.json_encode.html">json_encode</a></li>
<li><a href="function-GuzzleHttp.normalize_header_keys.html">normalize_header_keys</a></li>
<li><a href="function-GuzzleHttp.uri_template.html">uri_template</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-GuzzleHttp.html" title="Summary of GuzzleHttp"><span>Namespace</span></a>
</li>
<li class="active">
<span>Class</span> </li>
</ul>
<ul>
</ul>
<ul>
</ul>
</div>
<div id="content" class="class">
<h1>Class Middleware</h1>
<div class="description">
<p>Functions used to create and wrap handlers with handler middleware.</p>
</div>
<div class="info">
<b>Final</b><br>
<b>Namespace:</b> <a href="namespace-GuzzleHttp.html">GuzzleHttp</a><br>
<b>Located at</b> <a href="source-class-GuzzleHttp.Middleware.html#12-254" title="Go to source code">Middleware.php</a>
<br>
</div>
<table class="summary methods" id="methods">
<caption>Methods summary</caption>
<tr data-order="cookies" id="_cookies">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_cookies">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#17-44" title="Go to source code">cookies</a>( )</code>
<div class="description short">
<p>Middleware that adds cookies to requests.</p>
</div>
<div class="description detailed hidden">
<p>Middleware that adds cookies to requests.</p>
<p>The options array must be set to a CookieJarInterface in order to use
cookies. This is typically handled for you by a client.</p>
<h4>Returns</h4>
<div class="list">
callable<br>Returns a function that accepts the next handler.
</div>
</div>
</div></td>
</tr>
<tr data-order="httpErrors" id="_httpErrors">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_httpErrors">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#46-70" title="Go to source code">httpErrors</a>( )</code>
<div class="description short">
<p>Middleware that throws exceptions for 4xx or 5xx responses when the
"http_error" request option is set to true.</p>
</div>
<div class="description detailed hidden">
<p>Middleware that throws exceptions for 4xx or 5xx responses when the
"http_error" request option is set to true.</p>
<h4>Returns</h4>
<div class="list">
callable<br>Returns a function that accepts the next handler.
</div>
</div>
</div></td>
</tr>
<tr data-order="history" id="_history">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_history">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#72-110" title="Go to source code">history</a>( <span>array <var>& $container</var></span> )</code>
<div class="description short">
<p>Middleware that pushes history data to an ArrayAccess container.</p>
</div>
<div class="description detailed hidden">
<p>Middleware that pushes history data to an ArrayAccess container.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$container</var></dt>
<dd>Container to hold the history (by reference).</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
callable<br>Returns a function that accepts the next handler.
</div>
<h4>Throws</h4>
<div class="list">
InvalidArgumentException<br>if container is not an array or ArrayAccess.
</div>
</div>
</div></td>
</tr>
<tr data-order="tap" id="_tap">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_tap">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#112-139" title="Go to source code">tap</a>( <span>callable <var>$before</var> = <span class="php-keyword1">null</span></span>, <span>callable <var>$after</var> = <span class="php-keyword1">null</span></span> )</code>
<div class="description short">
<p>Middleware that invokes a callback before and after sending a request.</p>
</div>
<div class="description detailed hidden">
<p>Middleware that invokes a callback before and after sending a request.</p>
<p>The provided listener cannot modify or alter the response. It simply
"taps" into the chain to be notified before returning the promise. The
before listener accepts a request and options array, and the after
listener accepts a request, options array, and response promise.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$before</var></dt>
<dd>Function to invoke before forwarding the request.</dd>
<dt><var>$after</var></dt>
<dd>Function invoked after forwarding.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
callable<br>Returns a function that accepts the next handler.
</div>
</div>
</div></td>
</tr>
<tr data-order="redirect" id="_redirect">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_redirect">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#141-151" title="Go to source code">redirect</a>( )</code>
<div class="description short">
<p>Middleware that handles request redirects.</p>
</div>
<div class="description detailed hidden">
<p>Middleware that handles request redirects.</p>
<h4>Returns</h4>
<div class="list">
callable<br>Returns a function that accepts the next handler.
</div>
</div>
</div></td>
</tr>
<tr data-order="retry" id="_retry">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_retry">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#153-173" title="Go to source code">retry</a>( <span>callable <var>$decider</var></span>, <span>callable <var>$delay</var> = <span class="php-keyword1">null</span></span> )</code>
<div class="description short">
<p>Middleware that retries requests based on the boolean result of
invoking the provided "decider" function.</p>
</div>
<div class="description detailed hidden">
<p>Middleware that retries requests based on the boolean result of
invoking the provided "decider" function.</p>
<p>If no delay function is provided, a simple implementation of exponential
backoff will be utilized.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$decider</var></dt>
<dd><p>Function that accepts the number of retries,
a request, [response], and [exception] and
returns true if the request is to be retried.</p></dd>
<dt><var>$delay</var></dt>
<dd><p>Function that accepts the number of retries and
returns the number of milliseconds to delay.</p></dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
callable<br>Returns a function that accepts the next handler.
</div>
</div>
</div></td>
</tr>
<tr data-order="log" id="_log">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_log">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#175-206" title="Go to source code">log</a>( <span>Psr\Log\LoggerInterface <var>$logger</var></span>, <span><code><a href="class-GuzzleHttp.MessageFormatter.html">GuzzleHttp\MessageFormatter</a></code> <var>$formatter</var></span>, <span>string <var>$logLevel</var> = GuzzleHttp\LogLevel::INFO</span> )</code>
<div class="description short">
<p>Middleware that logs requests, responses, and errors using a message
formatter.</p>
</div>
<div class="description detailed hidden">
<p>Middleware that logs requests, responses, and errors using a message
formatter.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$logger</var></dt>
<dd>Logs messages.</dd>
<dt><var>$formatter</var></dt>
<dd>Formatter used to create message strings.</dd>
<dt><var>$logLevel</var></dt>
<dd>Level at which to log requests.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
callable<br>Returns a function that accepts the next handler.
</div>
</div>
</div></td>
</tr>
<tr data-order="prepareBody" id="_prepareBody">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_prepareBody">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#208-219" title="Go to source code">prepareBody</a>( )</code>
<div class="description short">
<p>This middleware adds a default content-type if possible, a default
content-length or transfer-encoding header, and the expect header.</p>
</div>
<div class="description detailed hidden">
<p>This middleware adds a default content-type if possible, a default
content-length or transfer-encoding header, and the expect header.</p>
<h4>Returns</h4>
<div class="list">
callable
</div>
</div>
</div></td>
</tr>
<tr data-order="mapRequest" id="_mapRequest">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_mapRequest">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#221-236" title="Go to source code">mapRequest</a>( <span>callable <var>$fn</var></span> )</code>
<div class="description short">
<p>Middleware that applies a map function to the request before passing to
the next handler.</p>
</div>
<div class="description detailed hidden">
<p>Middleware that applies a map function to the request before passing to
the next handler.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$fn</var></dt>
<dd><p>Function that accepts a RequestInterface and returns
a RequestInterface.</p></dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
callable
</div>
</div>
</div></td>
</tr>
<tr data-order="mapResponse" id="_mapResponse">
<td class="attributes"><code>
public static
callable
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_mapResponse">#</a>
<code><a href="source-class-GuzzleHttp.Middleware.html#238-253" title="Go to source code">mapResponse</a>( <span>callable <var>$fn</var></span> )</code>
<div class="description short">
<p>Middleware that applies a map function to the resolved promise's
response.</p>
</div>
<div class="description detailed hidden">
<p>Middleware that applies a map function to the resolved promise's
response.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$fn</var></dt>
<dd><p>Function that accepts a ResponseInterface and
returns a ResponseInterface.</p></dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
callable
</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>