Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64
User : palandch ( 1163)
PHP Version : 7.1.33
Disable Function : NONE
Directory :  /home/palandch/Cloudflare-CPanel-7.0.1/vendor/guzzlehttp/ringphp/src/Client/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/Cloudflare-CPanel-7.0.1/vendor/guzzlehttp/ringphp/src/Client/Middleware.php
<?php
namespace GuzzleHttp\Ring\Client;

/**
 * Provides basic middleware wrappers.
 *
 * If a middleware is more complex than a few lines of code, then it should
 * be implemented in a class rather than a static method.
 */
class Middleware
{
    /**
     * Sends future requests to a future compatible handler while sending all
     * other requests to a default handler.
     *
     * When the "future" option is not provided on a request, any future responses
     * are automatically converted to synchronous responses and block.
     *
     * @param callable $default Handler used for non-streaming responses
     * @param callable $future  Handler used for future responses
     *
     * @return callable Returns the composed handler.
     */
    public static function wrapFuture(
        callable $default,
        callable $future
    ) {
        return function (array $request) use ($default, $future) {
            return empty($request['client']['future'])
                ? $default($request)
                : $future($request);
        };
    }

    /**
     * Sends streaming requests to a streaming compatible handler while sendin
     * all other requests to a default handler.
     *
     * This, for example, could be useful for taking advantage of the
     * performance benefits of curl while still supporting true streaming
     * through the StreamHandler.
     *
     * @param callable $default   Handler used for non-streaming responses
     * @param callable $streaming Handler used for streaming responses
     *
     * @return callable Returns the composed handler.
     */
    public static function wrapStreaming(
        callable $default,
        callable $streaming
    ) {
        return function (array $request) use ($default, $streaming) {
            return empty($request['client']['stream'])
                ? $default($request)
                : $streaming($request);
        };
    }
}

Spamworldpro Mini