Пример #1
0
 protected function generateCookie()
 {
     $lifetime = $this->options->getInt('cookie_lifetime');
     if ($lifetime !== 0) {
         $lifetime += time();
     }
     return new Cookie($this->session->getName(), $this->session->getId(), $lifetime, $this->options['cookie_path'], $this->options['cookie_domain'] ?: null, $this->options->getBoolean('cookie_secure'), $this->options->getBoolean('cookie_httponly'));
 }
Пример #2
0
 protected function collectGarbage()
 {
     $probability = $this->options->getInt('gc_probability');
     if ($probability < 0) {
         return;
     }
     $divisor = $this->options->getInt('gc_divisor');
     $rand = mt_rand(0, $divisor);
     if ($rand < $probability) {
         $this->handler->gc($this->options->getInt('gc_maxlifetime'));
     }
 }