PHP Class Webiny\Component\Http\Cookie

Inheritance: use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\StdLib\FactoryLoaderTrait, use trait Webiny\Component\StdLib\SingletonTrait
Afficher le fichier Open project: Webiny/Framework Class Usage Examples

Méthodes publiques

Méthode Description
delete ( string $name ) : boolean Remove the given cookie.
get ( string $name ) : string | boolean Get the cookie.
getConfig ( ) : ConfigObject Returns cookie config from Http object.
save ( string $name, string $value, integer $expiration = null, boolean $httpOnly = true, string $path = '/' ) : boolean Save a cookie.

Méthodes protégées

Méthode Description
init ( ) Constructor.

Private Methods

Méthode Description
getStorage ( ConfigObject $config = null ) : Webiny\Component\Http\Cookie\CookieStorageInterface Get cookie storage driver.

Method Details

delete() public méthode

Remove the given cookie.
public delete ( string $name ) : boolean
$name string Cookie name.
Résultat boolean True if cookie was deleted, or if it doesn't exist, otherwise false.

get() public méthode

Get the cookie.
public get ( string $name ) : string | boolean
$name string Cookie name.
Résultat string | boolean String if cookie is found, false if cookie is not found.

getConfig() public static méthode

Returns cookie config from Http object.
public static getConfig ( ) : ConfigObject
Résultat Webiny\Component\Config\ConfigObject

init() protected méthode

Constructor.
protected init ( )

save() public méthode

Save a cookie.
public save ( string $name, string $value, integer $expiration = null, boolean $httpOnly = true, string $path = '/' ) : boolean
$name string Name of the cookie.
$value string Cookie value.
$expiration integer Timestamp when the cookie should expire.
$httpOnly boolean Is the cookie https-only or not.
$path string Path under which the cookie is accessible.
Résultat boolean True if cookie was save successfully, otherwise false.