WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана


Middleware::cookies() public Yoast 1.0

Middleware that adds cookies to requests.

The options array must be set to a CookieJarInterface in order to use cookies. This is typically handled for you by a client.

{} Это метод класса: Middleware{}

Хуков нет.


callable. Returns a function that accepts the next handler.


$result = Middleware::cookies();

Код Middleware::cookies() Yoast 15.7

public static function cookies()
    return function (callable $handler) {
        return function ($request, array $options) use($handler) {
            if (empty($options['cookies'])) {
                return $handler($request, $options);
            } elseif (!$options['cookies'] instanceof \YoastSEO_Vendor\GuzzleHttp\Cookie\CookieJarInterface) {
                throw new \InvalidArgumentException('cookies must be an instance of YoastSEO_Vendor\\GuzzleHttp\\Cookie\\CookieJarInterface');
            $cookieJar = $options['cookies'];
            $request = $cookieJar->withCookieHeader($request);
            return $handler($request, $options)->then(function ($response) use($cookieJar, $request) {
                $cookieJar->extractCookies($request, $response);
                return $response;