Get session

If no session has been set, this method will
set and return a default session, if any such
value is available

@see getDefaultSession()

@return Session|null session or null if none session has been set
511815
public function getSession(): ?Session
    {
        if (!$this->hasSession()) {
            $this->setSession($this->getDefaultSession());
        }
        return $this->session;
    }
793172
public static function getSessionValue($key, $default=null) {
		if(!isset($_SESSION)){
			session_start();
		}
		return (isset($_SESSION[$key]) ? $_SESSION[$key] : $default);
	}
318632
public function getSession($varname, $default = false)
    {
        if(isset($this->sessionvars[$varname])) {
            if(in_array($varname, $this->delsession)) {
                unset($this->delsession[$varname]);
            }
            return $this->sessionvars[$varname];
        } else {
            return $default;
        }
    }
1008914
public function get($key, $default = null)
    {
        $session = $this->session['data'];

        // check first for the item in the general session data.
        if (null !== ($value = $this->isIn($key, $session))) {
            return $value;
        }

        // or find it in the new session data.
        if (null !== ($value = $this->isIn($key, $session[':new:']))) {
            return $value;
        }

        // or finally return the default value.
        if (null !== ($value = $this->isIn($key, $session[':old:']))) {
            return $value;
        }

        return $default;
    }
104411
protected function getSession()
    {
        if (isset($_SESSION[$this->key])) {
            $value = $_SESSION[$this->key];

            if ($value) {
                return unserialize($value);
            }
        }
    }
612016
public function getSession()
    {
        if (is_null($this->session)) {
            $this->session = $this->cluster->connect($this->getKeyspace());
        }

        return $this->session;
    }
792512
public function getSession()
    {
        $session = $this->session;
        if (!$session instanceof SessionInterface && null !== $session) {
            $this->setSession($session = $session());
        }

        if (null === $session) {
            @trigger_error(sprintf('Calling "%s()" when no session has been set is deprecated since Symfony 4.1 and will throw an exception in 5.0. Use "hasSession()" instead.', __METHOD__), E_USER_DEPRECATED);
            // throw new \BadMethodCallException('Session has not been set');
        }

        return $session;
    }
953380
public function getSession($key, $default_val = null)
    {

        if (isset($_SESSION[$key])) {
            return $_SESSION[$key];
        }

        return $default_val;
    }
166630
public function get( $key, $default = null ) {
		if ( ! $this->is_valid_session() ) {
			return $default;
		}
		$key = $this->get_session_key( $key );
		if ( array_key_exists( $key, $_SESSION ) ) {
			return $this->_get( $key, $_SESSION[ $key ], $default );
		}

		return $default;
	}
977908
public function getDefaultDomain()
    {
        if ($this->defaultDomain) {
            return $this->defaultDomain;
        } elseif ($first = $this->getDomains()->first()) {
            return $first->getDomain();
        } else {
            return null;
        }
    }
787465
public static function getSession()
    {
        if (!isset(self::$session)) {
            $session_factory = new SessionFactory();
            self::$session = $session_factory->newInstance($_COOKIE);
        }

        return self::$session;
    }
163327
function getUserFromPHPSession() {
		if ($this->user == null) {
            $sid = $this->request->session('usersid', '');
            if ($sid == '') {
                // try with a get key
                $sid = $this->request->get('sessionid', '');
            }
			$this->user = $this->getUserFromSession($sid);
		}
        return $this->user;
    }
1261088
public function getSession($name = null, $defaultValue = null)
    {
        if ($name === null) {
            return $_SESSION;
        }
        return (isset($_SESSION[$name])) ? $_SESSION[$name] : $defaultValue;
    }
931529
public function startSession()
  {
    if ($this->sessionState == self::SESSION_NOT_STARTED && !headers_sent()) {
      $this->sessionState = session_start();
    }
    return $this->sessionState;
  }
866814
public function getSession()
    {
        if ($this->session instanceof SessionEntity) {
            return $this->session;
        }

        $this->session = $this->server->getSessionStorage()->getByAuthCode($this);

        return $this->session;
    }
1302430
public function getUserRole() {
		return isset($_SESSION[$this->config->roleSessionVar]) ? $_SESSION[$this->config->roleSessionVar] : $this->config->defaultRole;
	}
328934
public static function Session() {
      if (is_null(self::$_Session))
         self::$_Session = self::Factory(self::AliasSession);
      return self::$_Session;
   }