Overview

Namespaces

  • Baguette
    • Mastodon
      • Config
      • Entity
      • Grant
      • Service
  • GuzzleHttp
    • Cookie
    • Exception
    • Handler
    • Promise
  • Psr
    • Http
      • Message
  • Teto
    • Object

Classes

  • CookieJar
  • FileCookieJar
  • SessionCookieJar
  • SetCookie

Interfaces

  • CookieJarInterface
  • Overview
  • Namespace
  • Class

Class CookieJar

Cookie jar that stores cookies as an array

GuzzleHttp\Cookie\CookieJar implements GuzzleHttp\Cookie\CookieJarInterface

Direct known subclasses

GuzzleHttp\Cookie\FileCookieJar, GuzzleHttp\Cookie\SessionCookieJar
Namespace: GuzzleHttp\Cookie
Located at Cookie/CookieJar.php
Methods summary
public
# __construct( boolean $strictMode = false, array $cookieArray = [] )

Parameters

$strictMode

Set to true to throw exceptions when invalid cookies are added to the cookie jar.

$cookieArray

Array of SetCookie objects or a hash of arrays that can be used with the SetCookie constructor

public static GuzzleHttp\Cookie\CookieJar
# fromArray( array $cookies, string $domain )

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

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

Parameters

$cookies
Cookies to create the jar from
$domain
Domain to set the cookies to

Returns

GuzzleHttp\Cookie\CookieJar
public static
# getCookieValue( $value )

Deprecated

public static boolean
# shouldPersist( GuzzleHttp\Cookie\SetCookie $cookie, boolean $allowSessionCookies = false )

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

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

Parameters

$cookie
Being evaluated.
$allowSessionCookies
If we should persist session cookies

Returns

boolean
public array
# toArray( )

Converts the cookie jar to an array.

Converts the cookie jar to an array.

Returns

array

Implementation of

GuzzleHttp\Cookie\CookieJarInterface::toArray()
public GuzzleHttp\Cookie\CookieJarInterface
# clear( string $domain = null, string $path = null, string $name = null )

Remove cookies currently held in the cookie jar.

Remove cookies currently held in the cookie jar.

Invoking this method without arguments will empty the whole cookie jar. If given a $domain argument only cookies belonging to that domain will be removed. If given a $domain and $path argument, cookies belonging to the specified path within that domain are removed. If given all three arguments, then the cookie with the specified name, path and domain is removed.

Parameters

$domain
Clears cookies matching a domain
$path
Clears cookies matching a domain and path
$name
Clears cookies matching a domain, path, and name

Returns

GuzzleHttp\Cookie\CookieJarInterface

Implementation of

GuzzleHttp\Cookie\CookieJarInterface::clear()
public
# clearSessionCookies( )

Discard all sessions cookies.

Discard all sessions cookies.

Removes cookies that don't have an expire field or a have a discard field set to true. To be called when the user agent shuts down according to RFC 2965.

Implementation of

GuzzleHttp\Cookie\CookieJarInterface::clearSessionCookies()
public boolean
# setCookie( GuzzleHttp\Cookie\SetCookie $cookie )

Sets a cookie in the cookie jar.

Sets a cookie in the cookie jar.

Parameters

$cookie
Cookie to set.

Returns

boolean
Returns true on success or false on failure

Implementation of

GuzzleHttp\Cookie\CookieJarInterface::setCookie()
public
# count( )

Implementation of

Countable::count()
public
# getIterator( )

Implementation of

IteratorAggregate::getIterator()
public
# extractCookies( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response )

Extract cookies from an HTTP response and store them in the CookieJar.

Extract cookies from an HTTP response and store them in the CookieJar.

Parameters

$request
Request that was sent
$response
Response that was received

Implementation of

GuzzleHttp\Cookie\CookieJarInterface::extractCookies()
public Psr\Http\Message\RequestInterface
# withCookieHeader( Psr\Http\Message\RequestInterface $request )

Create a request with added cookie headers.

Create a request with added cookie headers.

If no matching cookies are found in the cookie jar, then no Cookie header is added to the request and the same request is returned.

Parameters

$request
Request object to modify.

Returns

Psr\Http\Message\RequestInterface
returns the modified request.

Implementation of

GuzzleHttp\Cookie\CookieJarInterface::withCookieHeader()
ξ ^ω^)ξ Baguette PHP Mastodon API Client / SDK API documentation generated by ApiGen