Retrurns the current session

@throws common_exception_Error
@return common_session_Session
960970
public static function getSession()
    {
        if (is_null(self::$session)) {
            if (PHPSession::singleton()->hasAttribute(self::PHPSESSION_SESSION_KEY)) {
                $session = PHPSession::singleton()->getAttribute(self::PHPSESSION_SESSION_KEY);
                if (! $session instanceof common_session_Session) {
                    throw new common_exception_Error('Non session stored in php-session');
                }
                self::$session = $session;
            } else {
                self::$session = new common_session_AnonymousSession();
            }
        }
        if (self::$session instanceof ServiceLocatorAwareInterface) {
            self::$session->setServiceLocator(ServiceManager::getServiceManager());
        }
        return self::$session;
    }
1037834
public static function reset() {
		static::$_config = [];
		static::$_checks = [];
		static::$_exceptionHandler = null;
		static::$_checks = [
			'type'  => function($config, $info) {
				return (boolean) array_filter((array) $config['type'], function($type) use ($info) {
					return $type === $info['type'] || is_subclass_of($info['type'], $type);
				});
			},
			'code' => function($config, $info) {
				return ($config['code'] & $info['code']);
			},
			'stack' => function($config, $info) {
				return (boolean) array_intersect((array) $config['stack'], $info['stack']);
			},
			'message' => function($config, $info) {
				return preg_match($config['message'], $info['message']);
			}
		];
		static::$_exceptionHandler = function($exception, $return = false) {
			if (ob_get_length()) {
				ob_end_clean();
			}
			$info = compact('exception') + [
				'type' => get_class($exception),
				'stack' => static::trace($exception->getTrace())
			];
			foreach (['message', 'file', 'line', 'trace'] as $key) {
				$method = 'get' . ucfirst($key);
				$info[$key] = $exception->{$method}();
			}
			return $return ? $info : static::handle($info);
		};
	}
383266
public function rewind() {
		reset($this->_data);
		reset($this->_updated);
		$this->_valid = (count($this->_updated) > 0);
		return current($this->_updated);
	}
989471
public static function getCurrent()
    {
        if (empty(self::$current)) {
            Logger::get()->debug('Checking session for users...');
            self::$current = static::getInstance()->getFromSession();

            // Nothing there, new visitor then.
            if (empty(self::$current)) {
                throw new \RuntimeException('Unable to obtain a user');
            }

            // Update last seen time.
            self::$current->lastSeen = new \DateTime;

            Logger::get()->debug(
                'Current user is ' . self::$current->getId()
            );
        }

        return self::$current;
    }
1092774
public function reset(){
        if($this->status() !== self::ACTIVE){
            throw Exception\SessionException::notStarted();
        }

        session_reset();

        return $this;
    }
86758
public function actionRefresh()
    {
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['refresh']);
        }
        try{
            $model = new Route();
            $model->invalidate();
            Yii::$app->getResponse()->format = 'json';
            return $model->getRoutes();
        }catch(Exception $e){
            throw new Exception($e);
        }

    }
934346
public function session ()
	{
		
		if (!($this->session instanceof Session))
		{
			$this->session	= Session::singleton ($this->sessionID);
		}
		
		return $this->session;
		
	}
737150
public static function resetActiveSession()
    {
        // Strip '.'
        $appContext = rtrim($GLOBALS['app']->getConfiguration()->getApplicationContext(), '.');
        if (empty($appContext)) {
            $appContext = "/";
        } else {
            $appContext = "/".$appContext."/";
        }

        $category = $_SESSION[self::GLOBAL_PREFIX.'category'];
        session_unset();
        session_destroy();
        $sessionCookieName = $GLOBALS['app']->getConfiguration()->getApplicationContext()."-"."_n5_session"; 
        $sessionCookieName = preg_replace("/\./", "_",$sessionCookieName); 
        session_set_cookie_params(0, $appContext, null, false, true);
        session_name($sessionCookieName);
        session_start();
        session_regenerate_id();
        $_SESSION = array();
        $_SESSION[self::GLOBAL_PREFIX.'category']      = $category; 
        $_SESSION[self::GLOBAL_PREFIX.'last_accessed'] = time();

    }
1317807
public function reload()
    {
        $id = $this->getRecordIdent();
        $this->dataReset();
        $this->loadFromFlexiBee($id);
        return $this->lastResponseCode == 200;
    }
224594
public function restoreSession() {
	    $sessId = $this->getRequestParameter('session');
	    $url = $this->getRequestParameter('redirect');
	    if (session_id() != $sessId) {  
            common_Logger::i('Changing session to '.$sessId);
            session_unset();
            session_destroy();
            
            session_id($sessId);
            session_start();
            if (session_id() != $sessId) {
               $this->returnError(__('Unable to restore Session'));
            }
            session_regenerate_id(true);
            common_Logger::d('regenerated session to id \''.session_id().'\'');
	    } else {
	        common_Logger::w('Restore session called with correct session id \''.session_id().'\'');
	    }
	    $this->forwardUrl($url);
	}
1086382
public function init() {
        if (!$this->database->session_lock_supported()) {
            throw new exception('sessionhandlerproblem', 'error', '', null, 'Database does not support session locking');
        }

        $result = session_set_save_handler(array($this, 'handler_open'),
            array($this, 'handler_close'),
            array($this, 'handler_read'),
            array($this, 'handler_write'),
            array($this, 'handler_destroy'),
            array($this, 'handler_gc'));
        if (!$result) {
            throw new exception('dbsessionhandlerproblem', 'error');
        }
    }
831650
public function rewind()
    {
        $this->restoreServices();

        $db         = $this->getDbAdapter();
        $platform   = $db->getPlatform();
        $driver     = $db->getDriver();

        if ( $this->isMultisite() )
        {
            $query = $db->query( '
                SELECT *
                  FROM ' . $platform->quoteIdentifier( '_central' ) .
                     '.' . $platform->quoteIdentifier( 'fulldomain' ) . '
                 WHERE ' . $platform->quoteIdentifier( 'subdomain' ) . '
                     = ' . $driver->formatParameterName( 'subdomain' ) . '
            ' );
        }
        else
        {
            $query = $db->query( '
                SELECT *
                  FROM ' . $platform->quoteIdentifier( 'subdomain' ) . '
                 WHERE ' . $platform->quoteIdentifier( 'subdomain' ) . '
                     = ' . $driver->formatParameterName( 'subdomain' ) . '
            ' );
        }

        $this->queriedSchemas   = array();
        $this->queryResult      = $query->execute( array(
            'subdomain' => '',
        ) );

        $this->queryResult->rewind();
        return $this->createCurrentSiteInfo();
    }
611335
public function getCurrentSessionData()
    {
        $varName = $this->getCurrentVarName();

        return isset($_SESSION[$varName]) ? $_SESSION[$varName] : null;
    }
408285
public function getSession()
    {
        try {
            $session = \PagSeguro\Services\Session::create(
                $this->getPagSeguroCredentials()
            );
            return $session->getResult();
        } catch (\Exception $exception) {
            throw $exception;
        }
    }
1218299
public function getCurrentPlatformState()
    {
        $data = json_decode($this->getDriver()->get(self::PREFIX . self::LAST_MODE), true);
        if (! $data) {
            throw new \common_exception_NotFound();
        }
        return new MaintenanceState($data);
    }
696555
public function getAll()
    {
        if ($this->isRequestGet()) {
            try {
                $class = $this->getClassParameter();
                $classes = $this->getResourceService()->getAllClasses($class);
                $this->returnSuccess([$classes]);
            } catch (common_Exception $e) {
                $this->returnFailure($e);
            }
        } else {
            $this->returnFailure(new common_exception_MethodNotAllowed(__METHOD__ . ' only accepts GET method'));
        }
    }
124349
public function regenerate()
    {
        // we will regenerate session ID
        session_regenerate_id(true);

        session_write_close();

        if (isset($_SESSION)) {
            $data = $_SESSION;
            session_start();
            $_SESSION = $data;
        } else {
            session_start();
        }

        // we will store session global variable reference into storage property
        $this->storage = &$_SESSION;

        return $this;
    }