SimpleSAML_Configuration::getConfigItem PHP Method

getConfigItem() public method

This function will load the value of an option into a SimpleSAML_Configuration object. The option must contain an array. An exception will be thrown if this option isn't an array, or if this option isn't found, and no default value is given.
public getConfigItem ( string $name, mixed $default = self::REQUIRED_OPTION ) : mixed
$name string The name of the option.
$default mixed A default value which will be returned if the option isn't found. The option will be required if this parameter isn't given. The default value can be any value, including null.
return mixed The option with the given name, or $default if the option isn't found and $default is specified.
    public function getConfigItem($name, $default = self::REQUIRED_OPTION)
    {
        assert('is_string($name)');
        $ret = $this->getValue($name, $default);
        if ($ret === $default) {
            // the option wasn't found, or it matches the default value. In any case, return this value
            return $ret;
        }
        if (!is_array($ret)) {
            throw new Exception($this->location . ': The option ' . var_export($name, true) . ' is not an array.');
        }
        return self::loadFromArray($ret, $this->location . '[' . var_export($name, true) . ']');
    }