You are here

private function CookieJar::getCookiePathFromRequest in Lockr 7.3

Computes cookie path following RFC 6265 section 5.1.4

@link https://tools.ietf.org/html/rfc6265#section-5.1.4

Parameters

RequestInterface $request:

Return value

string

1 call to CookieJar::getCookiePathFromRequest()
CookieJar::extractCookies in vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
Extract cookies from an HTTP response and store them in the CookieJar.

File

vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php, line 254

Class

CookieJar
Cookie jar that stores cookies as an array

Namespace

GuzzleHttp\Cookie

Code

private function getCookiePathFromRequest(RequestInterface $request) {
  $uriPath = $request
    ->getUri()
    ->getPath();
  if ('' === $uriPath) {
    return '/';
  }
  if (0 !== strpos($uriPath, '/')) {
    return '/';
  }
  if ('/' === $uriPath) {
    return '/';
  }
  if (0 === ($lastSlashPos = strrpos($uriPath, '/'))) {
    return '/';
  }
  return substr($uriPath, 0, $lastSlashPos);
}