SimpleSAML_Configuration::getString PHP Method

getString() public method

An exception will be thrown if this option isn't a string, or if this option isn't found, and no default value is given.
public getString ( string $name, mixed $default = self::REQUIRED_OPTION ) : string | 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 string | mixed The option with the given name, or $default if the option isn't found and $default is specified.
    public function getString($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_string($ret)) {
            throw new Exception($this->location . ': The option ' . var_export($name, true) . ' is not a valid string value.');
        }
        return $ret;
    }

Usage Example

コード例 #1
0
 /**
  * Constructor
  *
  * @param \SimpleSAML_Configuration $configuration Configuration object
  */
 public function __construct(\SimpleSAML_Configuration $configuration)
 {
     $this->configuration = $configuration;
     $this->localeDir = $this->configuration->resolvePath('locales');
     $this->language = new Language($configuration);
     $this->langcode = $this->language->getPosixLanguage($this->language->getLanguage());
     $this->i18nBackend = $this->configuration->getString('language.i18n.backend', self::SSP_I18N_BACKEND);
     $this->setupL10N();
 }
All Usage Examples Of SimpleSAML_Configuration::getString