SimpleSAML_Configuration::getConfigList PHP Method

getConfigList() public method

This function will retrieve an option containing an array of arrays, and create an array of SimpleSAML_Configuration objects from that array. The indexes in the new array will be the same as the original indexes, but the values will be SimpleSAML_Configuration objects. An exception will be thrown if this option isn't an array of arrays, or if this option isn't found, and no default value is given.
public getConfigList ( 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 getConfigList($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.');
        }
        $out = array();
        foreach ($ret as $index => $config) {
            $newLoc = $this->location . '[' . var_export($name, true) . '][' . var_export($index, true) . ']';
            if (!is_array($config)) {
                throw new Exception($newLoc . ': The value of this element was expected to be an array.');
            }
            $out[$index] = self::loadFromArray($config, $newLoc);
        }
        return $out;
    }