Checked the given session could be paused at some point
(in other words : is section pause enabled)
@param $session
@return bool
544020
public function couldBePaused(TestSession $session = null)
    {
        return ($session->getState() === AssessmentTestSessionState::INTERACTING && $this->isProctored($session));
    }
28688
public function setSession(array $session = array())
    {
        $this->session = $session;
        if ($this->storeSession)
        {
            $this->storeSession($session);
        }
        return $this;
    }
1076616
public function hasSessionTokens()
    {
        return ($this->session->has(self::SESSION_TOKEN_KEY)
            && $this->session->has(self::SESSION_TOKEN_SECRET_KEY));
    }
82932
public function leave(Session $session)
    {
        Logger::debug($this, "Leaving realm {$session->getRealm()->getRealmName()}");

        $key = array_search($session, $this->sessions, true);

        if ($key !== false) {
            array_splice($this->sessions, $key, 1);
        }
    }
824241
public function tokenIsValid(Request $request, ISession $session) : bool
    {
        if (!$session->has(self::TOKEN_INPUT_NAME)) {
            $session->set(self::TOKEN_INPUT_NAME, \bin2hex(\random_bytes(16)));
        }

        if ($this->tokenShouldNotBeChecked($request)) {
            return true;
        }

        // Try an input
        $token = $request->getInput(self::TOKEN_INPUT_NAME);

        // Try the X-CSRF header
        if ($token === null) {
            $token = $request->getHeaders()->get('X-CSRF-TOKEN');
        }

        // Try the X-XSRF header
        if ($token === null) {
            $token = $request->getHeaders()->get('X-XSRF-TOKEN');
        }

        if ($token === null) {
            return false;
        }

        return \hash_equals($session->get(self::TOKEN_INPUT_NAME), $token);
    }
163143
protected function sessionTimedOut(ServletSessionInterface $session)
    {

        // we want to know what inactivity timeout we've to check the sessions for
        $inactivityTimeout = $this->getSessionSettings()->getInactivityTimeout();

        // load the sessions last activity timestamp
        $lastActivitySecondsAgo = time() - $session->getLastActivityTimestamp();

        // query whether or not an inactivity timeout has been set
        if ($inactivityTimeout < 1) {
            // if NOT, the inactivity timeout has to be higher than
            // the last activity timestamp to avoid session timeout
            $inactivityTimeout = $lastActivitySecondsAgo + 1;
        }

        // return TRUE it the last ativity timeout OR the session lifetime has been reached
        return $lastActivitySecondsAgo > $inactivityTimeout || $session->getLifetime() < time();
    }
1110731
private static function storage($session)
    {
        //Initiat the class
        static::session($session);

        $files = ['Storage'];
        $folder = static::$root.'Storage'.'/';

        self::call($files, $folder);

        $files = ['NotFoundStorageDiskException'];
        $folder = static::$root.'Storage/Exceptions'.'/';

        self::call($files, $folder);
    }
157543
public function getUserFromSession(Session $session)
    {
        $cl = $this->getUserClass();
        $this->user = new $cl;
        $this->user->obtainFromSession($session);
        return $this->user;
    }
1079444
private function resumeSession(): bool
    {
        if ($this->manager->isStarted() || $this->manager->resume()) {
            return true;
        }

        return false;
    }
1329972
protected function lockToUser($session, $request)
    {
        $session->set(self::LOCKED_FIELD, [
            'ip' => $request->getClientIp(),
            'agent' => md5($request->server('HTTP_USER_AGENT'))
        ]);
    }
891419
public function isPausable(TestSession $session = null)
    {
        if ($this->couldBePaused($session)) {

            /** @var AssessmentItemRef $itemRef */
            $itemRef = $session->getCurrentAssessmentItemRef();

            return $this->isItemPausable($itemRef);
        }
        return false;
    }
755406
private function _setSession(Session $session)
	{
		$selectors_handler = $session->getSelectorsHandler();

		if ( !$selectors_handler->isSelectorRegistered('se') ) {
			$selectors_handler->registerSelector('se', new SeleniumSelector());
		}

		$this->_session = $session;

		return $this;
	}
605421
public static function isEnabled()
    {
        if (!self::$_checkedEnabled) {
            self::$_checkedEnabled = true;

            $conf = self::getConfiguration();

            $enabled = false;
            if (strtolower($conf->trigger) == 'always') {
                $enabled = true;
            } elseif (strtolower($conf->trigger) == 'parameter') {
                if ((isset($_GET['profile']) && $_GET['profile'] == true) || (isset($_COOKIE['profile']) && $_COOKIE['profile'] == true)) {
                    $enabled = true;
                }
            }

            // Process filters
            if ($enabled && $conf->enableFilters) {

                // sampling filter
                if ($enabled && rand(0,100000) > $conf->filters->sampling * 1000) {
                    $enabled = false;
                }

                // request uri whitelist/blacklist
                $requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; // TODO: use script name instead for cli?
                if ($enabled && $conf->filters->requestUriWhiteList && !preg_match($conf->filters->requestUriWhiteList, $requestUri)) {
                    $enabled = false;
                }
                if ($enabled && $conf->filters->requestUriBlackList && preg_match($conf->filters->requestUriBlackList, $requestUri)) {
                    $enabled = false;
                }

                // note: timeThreshold and memoryThreshold will be checked before persisting records. In these cases data will still be recorded during the request
            }

            if ($enabled) {
                self::enable();
            }
        }
        return self::$_enabled;
    }
1283370
protected function stopSession()
	{
		if ( $this->_session === null ) {
			return;
		}

		$this->_session->stop();
		$this->_session = null;
	}
852484
public function isAccessible($property)
    {
        $value = isset($this->_accessible[$property]) ?
            $this->_accessible[$property] :
            null;

        return ($value === null && !empty($this->_accessible['*'])) || $value;
    }
182591
public function destroy(Session $session)
    {
        $session->delete();

        return intend([
            'back' => true,
            'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.session'), 'identifier' => $session->getKey()])],
        ]);
    }
127231
public function isRemembered() {
		if (isset($_SESSION) && isset($_SESSION[self::SESSION_FIELD_REMEMBERED])) {
			return $_SESSION[self::SESSION_FIELD_REMEMBERED];
		}
		else {
			return null;
		}
	}