Example #1
0
 /**
  * Session will expire after given number of seconds of inactivity
  *
  * @param int $secs
  * @return Session
  * @throws SessionException
  */
 public function setSessionLife(int $secs) : self
 {
     if ($secs <= 0) {
         throw SessionException::configError("sessionLife", "Expiry in seconds must be a positive integer");
     }
     $this->config->sessionLife = $secs;
     return $this;
 }
Example #2
0
 /**
  * Prepare session for resuming
  */
 public function __wakeup()
 {
     // Check if all properties exist...
     foreach (["id", "encoded", "hash", "timeStamp"] as $property) {
         if (!property_exists($this, $property)) {
             throw SessionException::badWakeUp();
         }
     }
 }