protected function getLifetime()
    {
        $params = session_get_cookie_params();
        $cookieLifetime = (int)$params['lifetime'];
        $gcLifetime = (int)ini_get('session.gc_maxlifetime');

        return $cookieLifetime ? min($cookieLifetime, $gcLifetime) : $gcLifetime;
    }