Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CookieJar.php

function CookieJar::allValues

Returns not yet expired cookie values for the given URI.

1 call to CookieJar::allValues()
CookieJar::allRawValues in vendor/symfony/browser-kit/CookieJar.php
Returns not yet expired raw cookie values for the given URI.

File

vendor/symfony/browser-kit/CookieJar.php, line 163

Class

CookieJar
CookieJar.

Namespace

Symfony\Component\BrowserKit

Code

public function allValues(string $uri, bool $returnsRawValue = false) : array {
    $this->flushExpiredCookies();
    $parts = array_replace([
        'path' => '/',
    ], parse_url($uri));
    $cookies = [];
    foreach ($this->cookieJar as $domain => $pathCookies) {
        if ($domain) {
            $domain = '.' . ltrim($domain, '.');
            if (!str_ends_with('.' . $parts['host'], $domain)) {
                continue;
            }
        }
        foreach ($pathCookies as $path => $namedCookies) {
            if (!str_starts_with($parts['path'], $path)) {
                continue;
            }
            foreach ($namedCookies as $cookie) {
                if ($cookie->isSecure() && 'https' !== $parts['scheme']) {
                    continue;
                }
                $cookies[$cookie->getName()] = $returnsRawValue ? $cookie->getRawValue() : $cookie->getValue();
            }
        }
    }
    return $cookies;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal