Open Journal Systems  3.3.0
Symfony\Component\HttpFoundation\Session\Session Class Reference
Inheritance diagram for Symfony\Component\HttpFoundation\Session\Session:
Symfony\Component\HttpFoundation\Session\SessionInterface

Public Member Functions

 __construct (SessionStorageInterface $storage=null, AttributeBagInterface $attributes=null, FlashBagInterface $flashes=null)
 
 __construct (SessionStorageInterface $storage=null, AttributeBagInterface $attributes=null, FlashBagInterface $flashes=null)
 
 all ()
 
 all ()
 
 clear ()
 
 clear ()
 
 count ()
 
 count ()
 
 get ($name, $default=null)
 
 get ($name, $default=null)
 
 getBag ($name)
 
 getBag ($name)
 
 getFlashBag ()
 
 getFlashBag ()
 
 getId ()
 
 getId ()
 
 getIterator ()
 
 getIterator ()
 
 getMetadataBag ()
 
 getMetadataBag ()
 
 getName ()
 
 getName ()
 
getUsageIndex ()
 
 has ($name)
 
 has ($name)
 
 invalidate ($lifetime=null)
 
 invalidate ($lifetime=null)
 
 isEmpty ()
 
 isStarted ()
 
 isStarted ()
 
 migrate ($destroy=false, $lifetime=null)
 
 migrate ($destroy=false, $lifetime=null)
 
 registerBag (SessionBagInterface $bag)
 
 registerBag (SessionBagInterface $bag)
 
 remove ($name)
 
 remove ($name)
 
 replace (array $attributes)
 
 replace (array $attributes)
 
 save ()
 
 save ()
 
 set ($name, $value)
 
 set ($name, $value)
 
 setId ($id)
 
 setId ($id)
 
 setName ($name)
 
 setName ($name)
 
 start ()
 
 start ()
 

Protected Attributes

 $storage
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct() [1/2]

Symfony\Component\HttpFoundation\Session\Session::__construct ( SessionStorageInterface  $storage = null,
AttributeBagInterface  $attributes = null,
FlashBagInterface  $flashes = null 
)

Constructor.

Parameters
SessionStorageInterface$storageA SessionStorageInterface instance
AttributeBagInterface$attributesAn AttributeBagInterface instance, (defaults null for default AttributeBag)
FlashBagInterface$flashesA FlashBagInterface instance (defaults null for default FlashBag)

Definition at line 62 of file lib/vendor/symfony/http-foundation/Session/Session.php.

References Symfony\Component\HttpFoundation\Session\Session\$storage, and Symfony\Component\HttpFoundation\Session\Session\registerBag().

◆ __construct() [2/2]

Symfony\Component\HttpFoundation\Session\Session::__construct ( SessionStorageInterface  $storage = null,
AttributeBagInterface  $attributes = null,
FlashBagInterface  $flashes = null 
)

Member Function Documentation

◆ all() [1/2]

Symfony\Component\HttpFoundation\Session\Session::all ( )

{Returns attributes.

Returns
array Attributes
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 87 of file vendor/symfony/http-foundation/Session/Session.php.

◆ all() [2/2]

Symfony\Component\HttpFoundation\Session\Session::all ( )

◆ clear() [1/2]

Symfony\Component\HttpFoundation\Session\Session::clear ( )

◆ clear() [2/2]

Symfony\Component\HttpFoundation\Session\Session::clear ( )

◆ count() [1/2]

Symfony\Component\HttpFoundation\Session\Session::count ( )

Returns the number of attributes.

Returns
int

Definition at line 139 of file vendor/symfony/http-foundation/Session/Session.php.

References Symfony\Component\HttpFoundation\Session\Session\all().

◆ count() [2/2]

◆ get() [1/2]

Symfony\Component\HttpFoundation\Session\Session::get (   $name,
  $default = null 
)

{Returns an attribute.

Parameters
string$nameThe attribute name
mixed$defaultThe default value if not found
Returns
mixed
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 71 of file vendor/symfony/http-foundation/Session/Session.php.

◆ get() [2/2]

Symfony\Component\HttpFoundation\Session\Session::get (   $name,
  $default = null 
)

{Returns an attribute.

Parameters
string$nameThe attribute name
mixed$defaultThe default value if not found
Returns
mixed
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 94 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ getBag() [1/2]

Symfony\Component\HttpFoundation\Session\Session::getBag (   $name)

◆ getBag() [2/2]

Symfony\Component\HttpFoundation\Session\Session::getBag (   $name)

{Gets a bag instance by name.

Parameters
string$name
Returns
SessionBagInterface
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 247 of file vendor/symfony/http-foundation/Session/Session.php.

◆ getFlashBag() [1/2]

Symfony\Component\HttpFoundation\Session\Session::getFlashBag ( )

Gets the flashbag interface.

Returns
FlashBagInterface

Definition at line 254 of file lib/vendor/symfony/http-foundation/Session/Session.php.

References Symfony\Component\HttpFoundation\Session\Session\getBag().

◆ getFlashBag() [2/2]

Symfony\Component\HttpFoundation\Session\Session::getFlashBag ( )

Gets the flashbag interface.

Returns
FlashBagInterface

Definition at line 259 of file vendor/symfony/http-foundation/Session/Session.php.

References Symfony\Component\HttpFoundation\Session\Session\getBag().

◆ getId() [1/2]

Symfony\Component\HttpFoundation\Session\Session::getId ( )

{Returns the session ID.

Returns
string The session ID
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 195 of file vendor/symfony/http-foundation/Session/Session.php.

◆ getId() [2/2]

Symfony\Component\HttpFoundation\Session\Session::getId ( )

{Returns the session ID.

Returns
string The session ID
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 196 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ getIterator() [1/2]

Symfony\Component\HttpFoundation\Session\Session::getIterator ( )

Returns an iterator for attributes.

Returns
\ArrayIterator An \ArrayIterator instance

Definition at line 129 of file vendor/symfony/http-foundation/Session/Session.php.

References Symfony\Component\HttpFoundation\Session\Session\all().

◆ getIterator() [2/2]

Symfony\Component\HttpFoundation\Session\Session::getIterator ( )

Returns an iterator for attributes.

Returns
\ArrayIterator An \ArrayIterator instance

Definition at line 152 of file lib/vendor/symfony/http-foundation/Session/Session.php.

References Symfony\Component\HttpFoundation\Session\Session\all().

◆ getMetadataBag() [1/2]

Symfony\Component\HttpFoundation\Session\Session::getMetadataBag ( )

{Gets session meta.

Returns
MetadataBag
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 228 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ getMetadataBag() [2/2]

Symfony\Component\HttpFoundation\Session\Session::getMetadataBag ( )

{Gets session meta.

Returns
MetadataBag
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 229 of file vendor/symfony/http-foundation/Session/Session.php.

◆ getName() [1/2]

Symfony\Component\HttpFoundation\Session\Session::getName ( )

{Returns the session name.

Returns
mixed The session name
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 212 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ getName() [2/2]

Symfony\Component\HttpFoundation\Session\Session::getName ( )

{Returns the session name.

Returns
mixed The session name
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 213 of file vendor/symfony/http-foundation/Session/Session.php.

◆ getUsageIndex()

& Symfony\Component\HttpFoundation\Session\Session::getUsageIndex ( )

◆ has() [1/2]

Symfony\Component\HttpFoundation\Session\Session::has (   $name)

{Checks if an attribute is defined.

Parameters
string$nameThe attribute name
Returns
bool true if the attribute is defined, false otherwise
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 63 of file vendor/symfony/http-foundation/Session/Session.php.

◆ has() [2/2]

Symfony\Component\HttpFoundation\Session\Session::has (   $name)

{Checks if an attribute is defined.

Parameters
string$nameThe attribute name
Returns
bool true if the attribute is defined, false otherwise
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 86 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ invalidate() [1/2]

Symfony\Component\HttpFoundation\Session\Session::invalidate (   $lifetime = null)

{Invalidates the current session.Clears all session attributes and flashes and regenerates the session and deletes the old session from persistence.

Parameters
int$lifetimeSets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.
Returns
bool True if session invalidated, false if error
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 169 of file vendor/symfony/http-foundation/Session/Session.php.

References Symfony\Component\HttpFoundation\Session\Session\migrate().

◆ invalidate() [2/2]

Symfony\Component\HttpFoundation\Session\Session::invalidate (   $lifetime = null)

{Invalidates the current session.Clears all session attributes and flashes and regenerates the session and deletes the old session from persistence.

Parameters
int$lifetimeSets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.
Returns
bool True if session invalidated, false if error
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 170 of file lib/vendor/symfony/http-foundation/Session/Session.php.

References Symfony\Component\HttpFoundation\Session\Session\migrate().

◆ isEmpty()

Symfony\Component\HttpFoundation\Session\Session::isEmpty ( )

◆ isStarted() [1/2]

Symfony\Component\HttpFoundation\Session\Session::isStarted ( )

{Checks if the session was started.

Returns
bool
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 119 of file vendor/symfony/http-foundation/Session/Session.php.

◆ isStarted() [2/2]

Symfony\Component\HttpFoundation\Session\Session::isStarted ( )

◆ migrate() [1/2]

Symfony\Component\HttpFoundation\Session\Session::migrate (   $destroy = false,
  $lifetime = null 
)

{Migrates the current session to a new session id while maintaining all session attributes.

Parameters
bool$destroyWhether to delete the old session or leave it to garbage collection
int$lifetimeSets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.
Returns
bool True if session migrated, false if error
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 179 of file vendor/symfony/http-foundation/Session/Session.php.

◆ migrate() [2/2]

Symfony\Component\HttpFoundation\Session\Session::migrate (   $destroy = false,
  $lifetime = null 
)

{Migrates the current session to a new session id while maintaining all session attributes.

Parameters
bool$destroyWhether to delete the old session or leave it to garbage collection
int$lifetimeSets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.
Returns
bool True if session migrated, false if error
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 180 of file lib/vendor/symfony/http-foundation/Session/Session.php.

Referenced by Symfony\Component\HttpFoundation\Session\Session\invalidate().

◆ registerBag() [1/2]

Symfony\Component\HttpFoundation\Session\Session::registerBag ( SessionBagInterface  $bag)

◆ registerBag() [2/2]

Symfony\Component\HttpFoundation\Session\Session::registerBag ( SessionBagInterface  $bag)

◆ remove() [1/2]

Symfony\Component\HttpFoundation\Session\Session::remove (   $name)

{Removes an attribute.

Parameters
string$name
Returns
mixed The removed value or null when it does not exist
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 103 of file vendor/symfony/http-foundation/Session/Session.php.

◆ remove() [2/2]

Symfony\Component\HttpFoundation\Session\Session::remove (   $name)

{Removes an attribute.

Parameters
string$name
Returns
mixed The removed value or null when it does not exist
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 126 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ replace() [1/2]

Symfony\Component\HttpFoundation\Session\Session::replace ( array  $attributes)

{Sets attributes.

Parameters
array$attributesAttributes
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 95 of file vendor/symfony/http-foundation/Session/Session.php.

◆ replace() [2/2]

Symfony\Component\HttpFoundation\Session\Session::replace ( array  $attributes)

{Sets attributes.

Parameters
array$attributesAttributes
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 118 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ save() [1/2]

Symfony\Component\HttpFoundation\Session\Session::save ( )

{Force the session to be saved and closed.This method is generally not required for real sessions as the session will be automatically saved at the end of code execution.}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 187 of file vendor/symfony/http-foundation/Session/Session.php.

◆ save() [2/2]

Symfony\Component\HttpFoundation\Session\Session::save ( )

{Force the session to be saved and closed.This method is generally not required for real sessions as the session will be automatically saved at the end of code execution.}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 188 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ set() [1/2]

Symfony\Component\HttpFoundation\Session\Session::set (   $name,
  $value 
)

{Sets an attribute.

Parameters
string$name
mixed$value
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 79 of file vendor/symfony/http-foundation/Session/Session.php.

◆ set() [2/2]

Symfony\Component\HttpFoundation\Session\Session::set (   $name,
  $value 
)

{Sets an attribute.

Parameters
string$name
mixed$value
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 102 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ setId() [1/2]

Symfony\Component\HttpFoundation\Session\Session::setId (   $id)

{Sets the session ID.

Parameters
string$id
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 203 of file vendor/symfony/http-foundation/Session/Session.php.

◆ setId() [2/2]

Symfony\Component\HttpFoundation\Session\Session::setId (   $id)

{Sets the session ID.

Parameters
string$id
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 204 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ setName() [1/2]

Symfony\Component\HttpFoundation\Session\Session::setName (   $name)

{Sets the session name.

Parameters
string$name
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 220 of file lib/vendor/symfony/http-foundation/Session/Session.php.

◆ setName() [2/2]

Symfony\Component\HttpFoundation\Session\Session::setName (   $name)

{Sets the session name.

Parameters
string$name
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 221 of file vendor/symfony/http-foundation/Session/Session.php.

◆ start() [1/2]

Symfony\Component\HttpFoundation\Session\Session::start ( )

{Starts the session storage.

Returns
bool True if session started
Exceptions
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 55 of file vendor/symfony/http-foundation/Session/Session.php.

◆ start() [2/2]

Symfony\Component\HttpFoundation\Session\Session::start ( )

{Starts the session storage.

Returns
bool True if session started
Exceptions
}

Implements Symfony\Component\HttpFoundation\Session\SessionInterface.

Definition at line 78 of file lib/vendor/symfony/http-foundation/Session/Session.php.

Field Documentation

◆ $storage

SessionStorageInterface Session::$storage
protected

Storage driver.

Definition at line 37 of file lib/vendor/symfony/http-foundation/Session/Session.php.

Referenced by Symfony\Component\HttpFoundation\Session\Session\__construct(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\getMemorySqlitePdo(), Symfony\Component\HttpFoundation\Tests\Session\Storage\PhpBridgeSessionStorageTest\getStorage(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\getStorage(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testBag(), Symfony\Component\HttpFoundation\Tests\Session\Storage\PhpBridgeSessionStorageTest\testClear(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NativeFileSessionHandlerTest\testConstruct(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NativeFileSessionHandlerTest\testConstructDefault(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testCreateTableTwice(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testDefaultSessionCacheLimiter(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testExplicitSessionCacheLimiter(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testGetConnection(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testGetConnectionConnectsIfNeeded(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testGetId(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testInexistentTable(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NullSessionHandlerTest\testNothingIsPersisted(), Symfony\Component\HttpFoundation\Tests\Session\Storage\PhpBridgeSessionStorageTest\testPhpSession(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testReadConvertsStreamToString(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testReadingRequiresExactlySameId(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testReadLockedConvertsStreamToString(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testReadWriteReadWithNullByte(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testRegenerate(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testRegenerateDestroy(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testRegenerationFailureDoesNotFlagStorageAsStarted(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testRegisterBagException(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testRegisterBagForAStartedSessionThrowsException(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testRestart(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NullSessionHandlerTest\testSaveHandlers(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\NullSessionHandlerTest\testSession(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testSessionDestroy(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testSessionGC(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testSessionGlobalIsUpToDateAfterIdRegeneration(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testSetSaveHandler(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testSetSaveHandlerException(), Symfony\Component\HttpFoundation\Tests\Session\Storage\NativeSessionStorageTest\testStarted(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testWithLazyDsnConnection(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testWithLazySavePathConnection(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testWriteDifferentSessionIdThanRead(), Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testWrongPdoErrMode(), and Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler\PdoSessionHandlerTest\testWrongUsageStillWorks().


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