SimpleSAML_Configuration::getValue PHP Method

getValue() public method

Retrieve a configuration option set in config.php.
public getValue ( string $name, mixed $default = null ) : mixed
$name string Name of the configuration option.
$default mixed Default value of the configuration option. This parameter will default to null if not specified. This can be set to SimpleSAML_Configuration::REQUIRED_OPTION, which will cause an exception to be thrown if the option isn't found.
return mixed The configuration option with name $name, or $default if the option was not found.
    public function getValue($name, $default = null)
    {
        // return the default value if the option is unset
        if (!array_key_exists($name, $this->configuration)) {
            if ($default === self::REQUIRED_OPTION) {
                throw new Exception($this->location . ': Could not retrieve the required option ' . var_export($name, true));
            }
            return $default;
        }
        return $this->configuration[$name];
    }

Usage Example

コード例 #1
0
 /**
  * instantiate the postman
  *
  * @since Method available since Release 1.2.0
  */
 public function __construct()
 {
     $this->_config = SimpleSAML_Configuration::getConfig('module_janus.php');
     // Send DB config to parent class
     parent::__construct($this->_config->getValue('store'));
     $this->_paginate = $this->_config->getValue('dashboard.inbox.paginate_by', 20);
 }
All Usage Examples Of SimpleSAML_Configuration::getValue