Get database runtime variables

@param string $varname Variable name
@param mixed  $default Default value if variable is not set

@return mixed Variable value or default
326066
public function get_variable($varname, $default = null)
    {
        if (!isset($this->variables)) {
            $this->variables = array();
        }

        if (array_key_exists($varname, $this->variables)) {
            return $this->variables[$varname];
        }

        // configured value has higher prio
        $conf_value = rcube::get_instance()->config->get('db_' . $varname);
        if ($conf_value !== null) {
            return $this->variables[$varname] = $conf_value;
        }

        $result = $this->query('SHOW VARIABLES LIKE ?', $varname);

        while ($row = $this->fetch_array($result)) {
            $this->variables[$row[0]] = $row[1];
        }

        // not found, use default
        if (!isset($this->variables[$varname])) {
            $this->variables[$varname] = $default;
        }

        return $this->variables[$varname];
    }
812365
public String lookupVariableDefaultValue(String variableName) {
        ConfigVariable cv = configVariables.get(variableName);
        return cv == null ? null : cv.getDefaultValue();
    }
8859
public function getDefaultEnvironment()
    {
        // if the user has configured a default database then use it,
        // providing it actually exists!
        if (isset($this->values['environments']['default_database'])) {
            if ($this->getEnvironment($this->values['environments']['default_database'])) {
                return $this->values['environments']['default_database'];
            }

            throw new \RuntimeException(sprintf(
                'The environment configuration for \'%s\' is missing',
                $this->values['environments']['default_database']
            ));
        }

        // else default to the first available one
        if (is_array($this->getEnvironments()) && count($this->getEnvironments()) > 0) {
            $names = array_keys($this->getEnvironments());

            return $names[0];
        }

        throw new \RuntimeException('Could not find a default environment');
    }
105216
static public function get($key = null, $default = null) {
        if (is_null($key)) return json_decode(json_encode(self::$_config));
        
        $config = &self::$_config;
        
        return Utils::arrayGet($config, $key, $default);
    }
632411
public function getDbAttribute($attribute, $default = null)
    {
        return isset($this->_dbAttributes[$attribute]) ? $this->_dbAttributes[$attribute] : $default;
    }
599066
public function ltiRawParameter($varname, $default=false) {
        $lti_post = $this->ltiRawPostArray('lti_post', false);
        if ( $lti_post === false ) return $default;
        if ( ! isset($lti_post[$varname]) ) return $default;
        return $lti_post[$varname];
    }
405764
public static function get($name, $default = null)
    {
        $coID = Coroutine::getuid();
        if(!isset(static::$context[$coID]))
        {
            throw new \RuntimeException('get context data failed, current context is not found');
        }
        if(isset(static::$context[$coID][$name]))
        {
            return static::$context[$coID][$name];
        }
        else
        {
            return $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;
        }
    }
335791
public function getVar($varName)
    {
        if (!isset($this->variableList[$varName])) {
            trigger_error('Variable "' . $varName . '" isn\'t defined in View.', E_USER_WARNING);
            return false;
        }
        return $this->variableList[$varName];
    }
37049
public function post($varname, $default = false)
	{
		if(isset($this->postvars[$varname])) {
			return $this->postvars[$varname];
		} else {
			return $default;
		}
	}
1074373
public function getDatabase($databaseName = null) {
		if ($databaseName === null) {
			$databaseName = $this->dbname;
		}

		if (! isset($this->databases[$databaseName])) {
			$this->databases[$databaseName] = $this->getClient()->selectDB($databaseName);
		}

		return $this->databases[$databaseName];
	}
384386
public function get($index, $default = null)
	{
		if ($this->has($index)) {
			return $this->offsetGet($index);
		} elseif (! (func_num_args() > 1)) {
			throw new \RuntimeException('No such offset.');
		}

		return $default;
	}
619093
public static function getDefaultDB()
    {
        if (self::$defaultDBName === null) {
            // Determine default database name.
            self::$defaultDBName = isset(self::$configuration['datasources']['default']) && is_scalar(self::$configuration['datasources']['default']) ? self::$configuration['datasources']['default'] : self::DEFAULT_NAME;
        }

        return self::$defaultDBName;
    }
1369989
public function ltiParameter($varname, $default=false) {
        $row = $this->session_get('lti', false);
        if ( ! $row ) return $default;
        if ( ! array_key_exists($varname, $row) ) return $default;
        return $row[$varname];
    }
543815
public function sessionGet($var = null, $default = null)
    {
        if ($this->stateless) {
            return $default;
        }

        return $this->getRequest()->session()->get(
            $this->makeSessionVarName($var),
            $default
        );
    }
1200868
public function get(string $variableName = null, int $type = Variables::TYPE_ARRAY)
    {
        if ($variableName === null) {
            throw new BadMethodCallException('Variable name must be specified');
        }
        if (isset($this->variables['MFVARS'][$variableName])) {
            return $this->variables['MFVARS'][$variableName];
        }
        if (isset($this->variables[$variableName])) {
            return $this->variables[$variableName];
        }
        return [];
    }
502217
public function getSqlFileByName($fileName)
    {
        $sqlFinder = $this->getFinder();

        $files = $sqlFinder->files()
            ->in($this->sqlFilesDir)
            ->name($fileName)
        ;

        if ($files->count() !== 1) {
            throw new RuntimeException('cannot find File:' . $fileName);
        }

        foreach ($files as $file){
            return $file;
        }
    }