lithium\storage\Session::key PHP Method

key() public static method

Returns (and Sets) the key used to identify the session.
public static key ( mixed $name = null, $sessionId = null ) : string
$name mixed Optional named session configuration.
return string Returns the value of the session identifier key, or `null` if no named configuration exists, no session id has been set or no session has been started.
    public static function key($name = null, $sessionId = null)
    {
        return is_object($adapter = static::adapter($name)) ? $adapter->key($sessionId) : null;
    }

Usage Example

 /**
  * Tests querying session keys from the primary adapter.
  * The memory adapter returns a UUID.
  *
  * @return void
  */
 public function testKey()
 {
     $result = Session::key();
     $pattern = "/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\$/";
     $this->assertPattern($pattern, $result);
 }
All Usage Examples Of lithium\storage\Session::key