Copied!

Cookie jar that stores cookies as an array

Cloneable Instantiable Iterable
Methods
public __construct ( bool $strictMode = false , array $cookieArray = [ ] )
 
  • param bool $strictMode Set to true to throw exceptions when invalid
    cookies are added to the cookie jar.
  • param array $cookieArray Array of SetCookie objects or a hash of
    arrays that can be used with the SetCookie
    constructor
public clear ( ? string $domain = NULL , ? string $path = NULL , ? string $name = NULL ) : void
 
  • inheritDoc
public clearSessionCookies () : void
 
  • inheritDoc
public count () : int
public extractCookies ( Psr\Http\Message\RequestInterface $request , Psr\Http\Message\ResponseInterface $response ) : void
public static fromArray ( array $cookies , string $domain ) : self
 

Create a new Cookie jar from an associative array and domain.

  • param array $cookies Cookies to create the jar from
  • param string $domain Domain to set the cookies to
public getCookieByName ( string $name ) : ? GuzzleHttp\Cookie\SetCookie
 

Finds and returns the cookie based on the name

public getIterator () : ArrayIterator
 
  • return ArrayIterator
public setCookie ( GuzzleHttp\Cookie\SetCookie $cookie ) : bool
 
  • inheritDoc
public static shouldPersist ( GuzzleHttp\Cookie\SetCookie $cookie , bool $allowSessionCookies = false ) : bool
 

Evaluate if this cookie should be persisted to storage
that survives between requests.

public toArray () : array
 
  • inheritDoc
public withCookieHeader ( Psr\Http\Message\RequestInterface $request ) : Psr\Http\Message\RequestInterface
Properties
private $cookies
 
private $strictMode
 
  • var bool
Methods
private getCookiePathFromRequest ( Psr\Http\Message\RequestInterface $request ) : string
 

Computes cookie path following RFC 6265 section 5.1.4

private removeCookieIfEmpty ( GuzzleHttp\Cookie\SetCookie $cookie ) : void
 

If a cookie already exists and the server asks to set it again with a
null value, the cookie must be deleted.

Methods
public static fromArray ( array $cookies , string $domain ) : self
 

Create a new Cookie jar from an associative array and domain.

  • param array $cookies Cookies to create the jar from
  • param string $domain Domain to set the cookies to
public static shouldPersist ( GuzzleHttp\Cookie\SetCookie $cookie , bool $allowSessionCookies = false ) : bool
 

Evaluate if this cookie should be persisted to storage
that survives between requests.

© 2022 Bruce Wells
Search Namespaces \ Classes
Configuration