\Zend\Http\Header\Exception\InvalidArgumentException
see
see
package Default

 Methods

Cookie object constructor

__construct(string $name = null, string $value = null, integer|string|\DateTime $expires = null, string $path = null, string $domain = null, boolean $secure = false, boolean $httponly = false, string $maxAge = null, integer $version = null
todo Add validation of each one of the parameters (legal domain, etc.)

Parameters

$name

string

$value

string

$expires

integerstring\DateTime

$path

string

$domain

string

$secure

boolean

$httponly

boolean

$maxAge

string

$version

integer

fromString()

fromString($headerLine, boolean $bypassHeaderFieldName = false) : array | \Zend\Http\Header\SetCookie
Static
static

Parameters

$headerLine

$bypassHeaderFieldName

boolean

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException

Returns

array\Zend\Http\Header\SetCookie

getDomain()

getDomain() : string

Returns

string

getExpires()

getExpires(boolean $inSeconds = false) : integer | string

Parameters

$inSeconds

boolean

Returns

integerstring

getFieldName()

getFieldName() : string

Returns

string'Set-Cookie'

getFieldValue()

getFieldValue() : string

Exceptions

\Zend\Http\Header\Exception\RuntimeException

Returns

string

Get Max-Age

getMaxAge() : integer

Returns

integer

getName()

getName() : string

Returns

string

getPath()

getPath() : string

Returns

string

getValue()

getValue() : string

Returns

string

Get version

getVersion() : integer

Returns

integer

Check whether the value for this cookie should be quoted

hasQuoteFieldValue() : boolean

Returns

boolean

Check whether the cookie has expired

isExpired(integer $now = null) : boolean

Always returns false if the cookie is a session cookie (has no expiry time)

Parameters

$now

integer

Timestamp to consider as "now"

Returns

boolean

isHttponly()

isHttponly() : boolean

Returns

boolean

isSecure()

isSecure() : boolean

Returns

boolean

Check whether the cookie is a session cookie (has no expiry time set)

isSessionCookie() : boolean

Returns

boolean

isValidForRequest()

isValidForRequest($requestDomain, $path, $isSecure = false

Parameters

$requestDomain

$path

$isSecure

Checks whether the cookie should be sent or not in a specific scenario

match(string|\Zend\Uri\Uri $uri, boolean $matchSessionCookies = true, integer $now = null) : boolean

Parameters

$uri

string\Zend\Uri\Uri

URI to check against (secure, domain, path)

$matchSessionCookies

boolean

Whether to send session cookies

$now

integer

Override the current time when checking for expiry time

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException If URI does not have HTTP or HTTPS scheme.

Returns

boolean

Check if a cookie's domain matches a host name.

matchCookieDomain(string $cookieDomain, string $host) : boolean
Static

Used by Zend\Http\Cookies for cookie matching

Parameters

$cookieDomain

string

$host

string

Returns

boolean

Check if a cookie's path matches a URL path

matchCookiePath(string $cookiePath, string $path) : boolean
Static

Used by Zend\Http\Cookies for cookie matching

Parameters

$cookiePath

string

$path

string

Returns

boolean

setDomain()

setDomain(string $domain) : \Zend\Http\Header\SetCookie

Parameters

$domain

string

Returns

\Zend\Http\Header\SetCookie

Set Expires

setExpires(integer|string|\DateTime $expires) : \Zend\Http\Header\SetCookie
fluent This method is part of a fluent interface and will return the same instance

Parameters

$expires

integerstring\DateTime

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException

Returns

\Zend\Http\Header\SetCookie

setHttponly()

setHttponly(boolean $httponly) : \Zend\Http\Header\SetCookie

Parameters

$httponly

boolean

Returns

\Zend\Http\Header\SetCookie

Set Max-Age

setMaxAge(integer $maxAge) : \Zend\Http\Header\SetCookie

Parameters

$maxAge

integer

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException

Returns

\Zend\Http\Header\SetCookie

setName()

setName(string $name) : \Zend\Http\Header\SetCookie

Parameters

$name

string

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException

Returns

\Zend\Http\Header\SetCookie

setPath()

setPath(string $path) : \Zend\Http\Header\SetCookie

Parameters

$path

string

Returns

\Zend\Http\Header\SetCookie

Set whether the value for this cookie should be quoted

setQuoteFieldValue(boolean $quotedValue) : \Zend\Http\Header\SetCookie

Parameters

$quotedValue

boolean

Returns

\Zend\Http\Header\SetCookie

setSecure()

setSecure(boolean $secure) : \Zend\Http\Header\SetCookie

Parameters

$secure

boolean

Returns

\Zend\Http\Header\SetCookie

setValue()

setValue(string $value) : \Zend\Http\Header\SetCookie

Parameters

$value

string

Returns

\Zend\Http\Header\SetCookie

Set version

setVersion(integer $version) : \Zend\Http\Header\SetCookie

Parameters

$version

integer

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException

Returns

\Zend\Http\Header\SetCookie

toString()

toString() 

toStringMultipleHeaders()

toStringMultipleHeaders(array $headers) 
inherited_from \Zend\Http\Header\MultipleHeaderInterface::toStringMultipleHeaders()

Parameters

$headers

 Properties

 

Cookie domain

$domain : string | null

Default

null
 

Cookie expiry date

$expires : integer | null

Default

null
 

$httponly

$httponly : boolean | null

Default

null
 

Max Age

$maxAge : integer | null

Default

null
 

Cookie name

$name : string | null

Default

null
 

Cookie path

$path : string | null

Default

null
 

If the value need to be quoted or not

$quoteFieldValue : boolean

Default

false
 

Whether the cookie is secure or not

$secure : boolean | null

Default

null
 

Cookie value

$value : string | null

Default

null
 

Version

$version : integer | null

Default

null