Copied!

Cookie jar that stores cookies as an array

CloneableInstantiableIterable
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
 
    public clearSessionCookies() : void
     
      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

      • param string $name cookie name to search for
      • return \SetCookie|null cookie that was found or null if not found
      public getIterator() : ArrayIterator
       
      • return \ArrayIterator<int,\SetCookie>
      public setCookie(GuzzleHttp\Cookie\SetCookie $cookie) : bool
       
        public static shouldPersist(GuzzleHttp\Cookie\SetCookie $cookie, bool $allowSessionCookies = false) : bool
         

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

        • param \SetCookie $cookie Being evaluated.
        • param bool $allowSessionCookies If we should persist session cookies
        public toArray() : array
         
          public withCookieHeader(Psr\Http\Message\RequestInterface $request) : Psr\Http\Message\RequestInterface
          Properties
          private $cookies = []
           
          • var \SetCookie[] Loaded cookie data
          private $strictMode = NULL
           
          • var bool
          Methods
          private getCookiePathFromRequest(Psr\Http\Message\RequestInterface $request) : string
           

          Computes cookie path following RFC 6265 section 5.1.4

          • see https://tools.ietf.org/html/rfc6265#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.

          • param \SetCookie $cookie Being evaluated.
          • param bool $allowSessionCookies If we should persist session cookies
          © 2023 Bruce Wells
          Search Namespaces \ Classes
          Configuration