AppserverIo\Appserver\ServletEngine\Http\Session::emptyInstance PHP Method

emptyInstance() public static method

Creates a new and empty session instance.
public static emptyInstance ( ) : AppserverIo\Psr\Servlet\ServletSessionInterface
return AppserverIo\Psr\Servlet\ServletSessionInterface The empty, but initialized session instance
    public static function emptyInstance()
    {
        // extract the values
        $id = null;
        $name = 'empty';
        $lifetime = -1;
        $maximumAge = -1;
        $domain = '';
        $path = '';
        $secure = false;
        $httpOnly = false;
        // initialize and return the empty instance
        return new Session($id, $name, $lifetime, $maximumAge, $domain, $path, $secure, $httpOnly);
    }

Usage Example

コード例 #1
0
 /**
  * Initializes the session instance from the passed JSON string. If the encoded
  * data contains objects, they will be unserialized before reattached to the
  * session instance.
  *
  * @param string $marshalled The marshaled session representation
  *
  * @return \AppserverIo\Psr\Servlet\ServletSessionInterface The un-marshaled servlet session instance
  */
 protected function unmarshall($marshalled)
 {
     // create a new and empty servlet session instance
     $servletSession = Session::emptyInstance();
     // unmarshall the session data
     $this->getSessionMarshaller()->unmarshall($servletSession, $marshalled);
     // returns the initialized servlet session instance
     return $servletSession;
 }
All Usage Examples Of AppserverIo\Appserver\ServletEngine\Http\Session::emptyInstance