Example #1
0
 private function initSession($token = null)
 {
     if ($this->identityId !== null) {
         return $this;
     }
     if (null === $token) {
         if (!isset($_COOKIE[$this->settings->sessionName])) {
             $this->identityId = false;
             return $this;
         }
         $token = $_COOKIE[$this->settings->sessionName];
     }
     $session = Session::findByToken($token);
     if (!$session) {
         $this->identityId = false;
     } else {
         $this->identityId = $session->identityId;
     }
     return $this;
 }