NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class ArrayCookieJar

Cookie cookieJar that stores cookies an an array

  Guzzle\Plugin\Cookie\CookieJar\ArrayCookieJar implements Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface, Serializable

### Direct known subclasses

`Guzzle\Plugin\Cookie\CookieJar\FileCookieJar`

Namespace: Guzzle\Plugin\Cookie\CookieJar
Located at Guzzle/Plugin/Cookie/CookieJar/ArrayCookieJar.php

## Methods summary

- `public` `__construct ( bool $strictMode = false )`
- `public` `setStrictMode ( bool $strictMode )`

  Enable or disable strict mode on the cookie jar

- `public` `remove ( string $domain = null, string $path = null, string $name = null )`

  Remove cookies currently held in the Cookie cookieJar.

- `public` `removeTemporary ( )`

  Discard all temporary cookies.

- `public` `removeExpired ( )`

  Delete any expired cookies

- `public` `all ( string $domain = null, string $path = null, string $name = null, bool $skipDiscardable = false, bool $skipExpired = true )`

  Get all of the matching cookies

- `public` `add ( Guzzle\Plugin\Cookie\Cookie $cookie )`

  Add a cookie to the cookie cookieJar

- `public` `serialize ( )`

  Serializes the cookie cookieJar

- `public` `unserialize ( mixed $data )`

  Unserializes the cookie cookieJar

- `public` `count ( )`

  Returns the total number of stored cookies

- `public` `getIterator ( )`

  Returns an iterator

- `public` `addCookiesFromResponse ( Guzzle\Http\Message\Response $response, Guzzle\Http\Message\RequestInterface $request = null )`

  Add cookies from a `Guzzle\Http\Message\Response` object

- `public` `getMatchingCookies ( Guzzle\Http\Message\RequestInterface $request )`

  Get cookies matching a request object

## Methods detail

# `public`
`__construct( boolean $strictMode = false )`

#### Parameters

$strictMode
  `boolean`
  $strictMode Set to true to throw exceptions when invalid cookies are added to the cookie jar

# `public `Guzzle\Plugin\Cookie\CookieJar\ArrayCookieJar``
`setStrictMode( boolean $strictMode )`

Enable or disable strict mode on the cookie jar

#### Parameters

$strictMode
  `boolean`
  $strictMode Set to true to throw exceptions when invalid cookies are added. False to ignore them.

#### Returns

``Guzzle\Plugin\Cookie\CookieJar\ArrayCookieJar``
# `public `Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface``
`remove( string $domain = null, string $path = null, string $name = null )`

Remove cookies currently held in the Cookie cookieJar.

Invoking this method without arguments will empty the whole Cookie cookieJar. 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
  `string`
  $domain Set to clear only cookies matching a domain
$path
  `string`
  $path Set to clear only cookies matching a domain and path
$name
  `string`
  $name Set to clear only cookies matching a domain, path, and name

#### Returns

``Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface``

#### Implementation of

`Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface::remove()`
# `public `Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface``
`removeTemporary( )`

Discard all temporary cookies.

Scans for all cookies in the cookieJar with either no expire field or a true discard flag. To be called when the user agent shuts down according to RFC 2965.

#### Returns

``Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface``

#### Implementation of

`Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface::removeTemporary()`
# `public `Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface``
`removeExpired( )`

Delete any expired cookies

#### Returns

``Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface``

#### Implementation of

`Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface::removeExpired()`
# `public array`
`all( string $domain = null, string $path = null, string $name = null, boolean $skipDiscardable = false, boolean $skipExpired = true )`

Get all of the matching cookies

#### Parameters

$domain
  `string`
  $domain Domain of the cookie
$path
  `string`
  $path Path of the cookie
$name
  `string`
  $name Name of the cookie
$skipDiscardable
  `boolean`
  $skipDiscardable Set to TRUE to skip cookies with the Discard attribute.
$skipExpired
  `boolean`
  $skipExpired Set to FALSE to include expired

#### Returns

`array`
Returns an array of Cookie objects

#### Implementation of

`Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface::all()`
# `public boolean`
`add( `Guzzle\Plugin\Cookie\Cookie` $cookie )`

Add a cookie to the cookie cookieJar

#### Parameters

$cookie
  ``Guzzle\Plugin\Cookie\Cookie``
  $cookie Cookie to add

#### Returns

`boolean`
Returns true on success or false on failure

#### Implementation of

`Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface::add()`
# `public string`
`serialize( )`

Serializes the cookie cookieJar

#### Returns

`string`

#### Implementation of

`Serializable::serialize()`
# `public`
`unserialize( mixed $data )`

Unserializes the cookie cookieJar

#### Implementation of

`Serializable::unserialize()`
# `public integer`
`count( )`

Returns the total number of stored cookies

#### Returns

`integer`

#### Implementation of

`Countable::count()`
# `public `ArrayIterator``
`getIterator( )`

Returns an iterator

#### Returns

``ArrayIterator``

#### Implementation of

`IteratorAggregate::getIterator()`
# `public`
`addCookiesFromResponse( `Guzzle\Http\Message\Response` $response, `Guzzle\Http\Message\RequestInterface` $request = null )`

Add cookies from a `Guzzle\Http\Message\Response` object

#### Parameters

$response
  ``Guzzle\Http\Message\Response``
  $response Response object
$request
  ``Guzzle\Http\Message\RequestInterface``
  $request Request that received the response

#### Implementation of

`Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface::addCookiesFromResponse()`
# `public array`
`getMatchingCookies( `Guzzle\Http\Message\RequestInterface` $request )`

Get cookies matching a request object

#### Parameters

$request
  ``Guzzle\Http\Message\RequestInterface``
  $request Request object to match

#### Returns

`array`

#### Implementation of

`Guzzle\Plugin\Cookie\CookieJar\CookieJarInterface::getMatchingCookies()`

### Magic methods summary

## Properties summary

`protected array` | $cookies | # Loaded cookie data
`protected boolean` | $strictMode | # Whether or not strict mode is enabled. When enabled, exceptions will be thrown for invalid cookies