Get session-variable.

@param string $name
@param mixed $defaultValue Default null.
@param string $namespace Default '*'.
@return mixed
432212
public static function get(string $name, $defaultValue = null, string $namespace = '*')
    {
        self::initialize();
        if (self::has($name, $namespace)) {
            return $_SESSION[$namespace][$name];
        }
        return $defaultValue;
    }
107140
public function read(string $key, $defaultValue = null)
    {
        return isset($_SESSION[$key]) ? $_SESSION[$key] : $defaultValue;
    }
401183
public static function getDefault($keys, $defaultValue) {
    try {
      $value = self::req($keys);
    } catch (MissingConfigVariableException $e) {
      return $defaultValue;
    }
    
    return $value;
  }
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;
        }
    }
1312381
public function getArg($name, $defaultValue = false)
    {
        if (parent::getArg($name) !== false) {
            return parent::getArg($name);
        }

        if ($this->_action && isset($this->_actionArgsMap[$this->_action][$name])) {
            $value = parent::getArg($this->_actionArgsMap[$this->_action][$name]);
            if ($value === false) {
                return $defaultValue;
            }
            return $value;
        }

        return $defaultValue;
    }
153470
public function getVariable($name, $default = null)
    {
        if (isset($this->container[$name])) {
            return $this->container[$name];
        }

        return $default;
    }
367742
public static function get(string $name): ?string
    {
        $data = Session::get($name, null, self::$namespace);
        if (is_array($data) && array_key_exists('token', $data)) {
            return $data['token'];
        }
        return null;
    }
71187
public static function get($name = null, $default = null)
    {
        self::init();

        if (!$name) {
            return self::$config;
        } else {
            if (isset(self::$config[$name])) {
                return self::$config[$name];
            } else {
                return $default;
            }
        }
    }
501793
public function value($name, $default = null)
    {
        if (! is_null($value = $this->valueFromOld($name))) {
            return $value;
        }

        if (! is_null($value = $this->valueFromModel($name))) {
            return $value;
        }
        return $default;
    }
359185
public static function get($name, $options = [])
    {
        RequestSession::_start();

        $default = isset($options["default"]) ? $options["default"] : null;

        return isset($_SESSION[$name]) ? $_SESSION[$name] : $default;
    }
943039
public function getVariable(string $name)
    {
        switch (true) {
            case array_key_exists($name, $_ENV):
                return $_ENV[$name];
            case array_key_exists($name, $_SERVER):
                return $_SERVER[$name];
            default:
                $value = getenv($name);

                return $value === false ? null : $value;
        }
    }
159385
protected function option($name, $defaultValue = null)
    {
        $value = $this->getInput()->getOption($name);

        if (null === $value) {
            return $defaultValue;
        }

        return $value;
    }
757765
public function getValue(string $name, $default = null)
    {
        if ($this->hasValue($name)) {
            return $this->data[$name];
        }

        return $default;
    }
1002376
protected function getMultipleRawOptionValue($name, $value, $defaultValue)
    {
        $modelVariable = $this->getSingularVariable($this->modelName);
        $valueString = 'null';

        if (!is_null($value)) {
            $valueString = starts_with($value, '$') ? sprintf("%s", $value) : sprintf("'%s'", $value);
        }

        $defaultValueString = '[]';

        if (!empty($defaultValue)) {
            $joinedValues = implode(',', Helpers::wrapItems((array) $defaultValue));
            $defaultValueString = sprintf('[%s]', $joinedValues);
        }

        $accessor = $this->getDefaultValueAccessor($modelVariable, $name, $defaultValueString);

        return sprintf("in_array(%s, old('%s', %s) ?: [])", $valueString, $name, $accessor);
    }
913339
final public function get($varname, $namespace = 'default')
    {
        //gets a registry var, stored in a namespace of this session id
        $session = $this;

        if (!isset($namespace) || empty($namespace)) {
            //@TODO Throw an exception, we need a name or use the default;
            return false;
        }

        //@TODO, check if the regitry is not locked before adding
        $registry = $session->getNamespace($namespace);

        return $registry->get($varname);
    }
841536
protected static function & _namespaceGet($namespace, $name = null)
    {
        if (self::$_readable === false) {
            /**
             * @see Zend_Session_Exception
             */
            require_once 'Zend/Session/Exception.php';
            throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG);
        }

        if ($name === null) {
            if (isset($_SESSION[$namespace])) { // check session first for data requested
                return $_SESSION[$namespace];
            } elseif (isset(self::$_expiringData[$namespace])) { // check expiring data for data reqeusted
                return self::$_expiringData[$namespace];
            } else {
                return $_SESSION[$namespace]; // satisfy return by reference
            }
        } else {
            if (isset($_SESSION[$namespace][$name])) { // check session first
                return $_SESSION[$namespace][$name];
            } elseif (isset(self::$_expiringData[$namespace][$name])) { // check expiring data
                return self::$_expiringData[$namespace][$name];
            } else {
                return $_SESSION[$namespace][$name]; // satisfy return by reference
            }
        }
    }
421351
protected function locateSession($name = null)
    {
        $name = strtolower($name) ?: $this->defaultSessionName;

        if (null === $name) {
            throw new \InvalidArgumentException('Specify session name to get');
        }

        if (!isset($this->sessions[$name])) {
            throw new \InvalidArgumentException(sprintf('Session "%s" is not registered.', $name));
        }

        $session = $this->sessions[$name];

        return $session;
    }