You are here

public function CookieJar::allValues in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/browser-kit/CookieJar.php \Symfony\Component\BrowserKit\CookieJar::allValues()

Returns not yet expired cookie values for the given URI.

Parameters

string $uri A URI:

bool $returnsRawValue Returns raw value or urldecoded value:

Return value

array An array of cookie values

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 196

Class

CookieJar
CookieJar.

Namespace

Symfony\Component\BrowserKit

Code

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