/** * @return int|string */ protected function getTtl() { if ($this->ttl === NULL) { if ($this->session !== NULL) { $options = $this->session->getOptions(); $ttl = min(array_filter([$options['cookie_lifetime'], $options['gc_maxlifetime']], function ($v) { return $v > 0; })) ?: 0; } else { $ttl = ini_get('session.gc_maxlifetime'); } if ($ttl <= 0) { throw new \InvalidArgumentException('PHP settings "cookie_lifetime" or "gc_maxlifetime" must be greater than 0'); } $this->ttl = $ttl; } return $this->ttl; }