SimpleSAML_Configuration::getArray PHP Method

getArray() public method

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 getArray ( string $name, mixed $default = self::REQUIRED_OPTION ) : array | 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 array | mixed The option with the given name, or $default if the option isn't found and $default is specified.
    public function getArray($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 $ret;
    }

Usage Example

コード例 #1
0
ファイル: Language.php プロジェクト: mrvanes/simplesamlphp
 /**
  * Constructor
  *
  * @param \SimpleSAML_Configuration $configuration Configuration object
  */
 public function __construct(\SimpleSAML_Configuration $configuration)
 {
     $this->configuration = $configuration;
     $this->availableLanguages = $this->configuration->getArray('language.available', array('en'));
     $this->defaultLanguage = $this->configuration->getString('language.default', 'en');
     $this->languageParameterName = $this->configuration->getString('language.parameter.name', 'language');
     $this->customFunction = $this->configuration->getArray('language.get_language_function', null);
     $this->rtlLanguages = $this->configuration->getArray('language.rtl', array());
     if (isset($_GET[$this->languageParameterName])) {
         $this->setLanguage($_GET[$this->languageParameterName], $this->configuration->getBoolean('language.parameter.setcookie', true));
     }
 }
All Usage Examples Of SimpleSAML_Configuration::getArray