PHP Class Symfony\Component\HttpFoundation\Session

Author: Fabien Potencier ([email protected])
Inheritance: implements Serializable
显示文件 Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Property Type Description
$attributes
$defaultLocale
$flashes
$locale
$oldFlashes
$started
$storage

Public Methods

Method Description
__construct ( Symfony\Component\HttpFoundation\SessionStorage\SessionStorageInterface $storage, string $defaultLocale = 'en' ) Constructor.
__destruct ( )
all ( ) : array Returns attributes.
clear ( ) Clears all attributes.
clearFlashes ( ) Removes the flash messages.
get ( string $name, mixed $default = null ) : mixed Returns an attribute.
getAttributes ( ) : array Returns attributes.
getFlash ( string $name, string | null $default = null ) : string Gets a flash message.
getFlashes ( ) : array Gets the flash messages.
getId ( ) : mixed Returns the session ID
getLocale ( ) : string Returns the locale
has ( string $name ) : boolean Checks if an attribute is defined.
hasFlash ( string $name ) : boolean Checks whether a flash message exists.
invalidate ( ) Invalidates the current session.
migrate ( ) Migrates the current session to a new session id while maintaining all session attributes.
remove ( string $name ) Removes an attribute.
removeFlash ( string $name ) Removes a flash message.
replace ( array $attributes ) Sets attributes.
save ( )
serialize ( )
set ( string $name, mixed $value ) Sets an attribute.
setAttributes ( array $attributes ) Sets attributes.
setFlash ( string $name, string $value ) Sets a flash message.
setFlashes ( array $values ) Sets the flash messages.
setLocale ( string $locale ) Sets the locale.
start ( ) Starts the session storage.
unserialize ( $serialized )

Private Methods

Method Description
setPhpDefaultLocale ( $locale )

Method Details

__construct() public method

Constructor.
public __construct ( Symfony\Component\HttpFoundation\SessionStorage\SessionStorageInterface $storage, string $defaultLocale = 'en' )
$storage Symfony\Component\HttpFoundation\SessionStorage\SessionStorageInterface A SessionStorageInterface instance
$defaultLocale string The default locale

__destruct() public method

public __destruct ( )

all() public method

Returns attributes.
public all ( ) : array
return array Attributes

clear() public method

Clears all attributes.
public clear ( )

clearFlashes() public method

Removes the flash messages.
public clearFlashes ( )

get() public method

Returns an attribute.
public get ( string $name, mixed $default = null ) : mixed
$name string The attribute name
$default mixed The default value
return mixed

getAttributes() public method

Returns attributes.
public getAttributes ( ) : array
return array Attributes

getFlash() public method

Gets a flash message.
public getFlash ( string $name, string | null $default = null ) : string
$name string
$default string | null
return string

getFlashes() public method

Gets the flash messages.
public getFlashes ( ) : array
return array

getId() public method

Returns the session ID
public getId ( ) : mixed
return mixed The session ID

getLocale() public method

Returns the locale
public getLocale ( ) : string
return string

has() public method

Checks if an attribute is defined.
public has ( string $name ) : boolean
$name string The attribute name
return boolean true if the attribute is defined, false otherwise

hasFlash() public method

Checks whether a flash message exists.
public hasFlash ( string $name ) : boolean
$name string
return boolean

invalidate() public method

Invalidates the current session.
public invalidate ( )

migrate() public method

Migrates the current session to a new session id while maintaining all session attributes.
public migrate ( )

remove() public method

Removes an attribute.
public remove ( string $name )
$name string

removeFlash() public method

Removes a flash message.
public removeFlash ( string $name )
$name string

replace() public method

Sets attributes.
public replace ( array $attributes )
$attributes array Attributes

save() public method

public save ( )

serialize() public method

public serialize ( )

set() public method

Sets an attribute.
public set ( string $name, mixed $value )
$name string
$value mixed

setAttributes() public method

Sets attributes.
public setAttributes ( array $attributes )
$attributes array Attributes

setFlash() public method

Sets a flash message.
public setFlash ( string $name, string $value )
$name string
$value string

setFlashes() public method

Sets the flash messages.
public setFlashes ( array $values )
$values array

setLocale() public method

Sets the locale.
public setLocale ( string $locale )
$locale string

start() public method

Starts the session storage.
public start ( )

unserialize() public method

public unserialize ( $serialized )

Property Details

$attributes protected_oe property

protected $attributes

$defaultLocale protected_oe property

protected $defaultLocale

$flashes protected_oe property

protected $flashes

$locale protected_oe property

protected $locale

$oldFlashes protected_oe property

protected $oldFlashes

$started protected_oe property

protected $started

$storage protected_oe property

protected $storage