You are here

public function CookieJar::getCookieByName in Lockr 7.3

Finds and returns the cookie based on the name

Parameters

string $name cookie name to search for:

Return value

SetCookie|null cookie that was found or null if not found

File

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

Class

CookieJar
Cookie jar that stores cookies as an array

Namespace

GuzzleHttp\Cookie

Code

public function getCookieByName($name) {

  // don't allow a null name
  if ($name === null) {
    return null;
  }
  foreach ($this->cookies as $cookie) {
    if ($cookie
      ->getName() !== null && strcasecmp($cookie
      ->getName(), $name) === 0) {
      return $cookie;
    }
  }
}