Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
GuzzleHttp\Cookie\CookieJarInterface Interface Reference
Inheritance diagram for GuzzleHttp\Cookie\CookieJarInterface:
GuzzleHttp\Cookie\CookieJar GuzzleHttp\Cookie\FileCookieJar GuzzleHttp\Cookie\SessionCookieJar

Public Member Functions

 clear (string $domain=null, string $path=null, string $name=null)
 Remove cookies currently held in the cookie jar.
 
 clearSessionCookies ()
 Discard all sessions cookies.
 
 extractCookies (RequestInterface $request, ResponseInterface $response)
 Extract cookies from an HTTP response and store them in the CookieJar.
 
 setCookie (SetCookie $cookie)
 Sets a cookie in the cookie jar.
 
 toArray ()
 Converts the cookie jar to an array.
 
 withCookieHeader (RequestInterface $request)
 Create a request with added cookie headers.
 

Member Function Documentation

◆ clear()

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

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
string | null$domainClears cookies matching a domain
string | null$pathClears cookies matching a domain and path
string | null$nameClears cookies matching a domain, path, and name

Implemented in GuzzleHttp\Cookie\CookieJar.

◆ clearSessionCookies()

GuzzleHttp\Cookie\CookieJarInterface::clearSessionCookies ( )

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.

Implemented in GuzzleHttp\Cookie\CookieJar.

◆ extractCookies()

GuzzleHttp\Cookie\CookieJarInterface::extractCookies ( RequestInterface $request,
ResponseInterface $response )

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

Parameters
RequestInterface$requestRequest that was sent
ResponseInterface$responseResponse that was received

Implemented in GuzzleHttp\Cookie\CookieJar.

◆ setCookie()

GuzzleHttp\Cookie\CookieJarInterface::setCookie ( SetCookie $cookie)

Sets a cookie in the cookie jar.

Parameters
SetCookie$cookieCookie to set.
Return values
boolReturns true on success or false on failure

Implemented in GuzzleHttp\Cookie\CookieJar.

◆ toArray()

GuzzleHttp\Cookie\CookieJarInterface::toArray ( )

Converts the cookie jar to an array.

Implemented in GuzzleHttp\Cookie\CookieJar.

◆ withCookieHeader()

GuzzleHttp\Cookie\CookieJarInterface::withCookieHeader ( RequestInterface $request)

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
RequestInterface$requestRequest object to modify.
Return values
RequestInterfacereturns the modified request.

Implemented in GuzzleHttp\Cookie\CookieJar.


The documentation for this interface was generated from the following file: