Bart\Configuration\Configuration::getValue PHP Method

getValue() protected method

protected getValue ( string $section, string $key, mixed $default = null, boolean $required = true ) : mixed
$section string Configuration section in file
$key string Configuration key in section
$default mixed If not required, the default to use
$required boolean If an exception should be raised when value is missing
return mixed Configured value or default
    protected function getValue($section, $key, $default = null, $required = true)
    {
        if (array_key_exists($section, $this->configurations)) {
            $sectionValues = $this->configurations[$section];
            if (array_key_exists($key, $sectionValues)) {
                return $sectionValues[$key];
            }
        }
        // Complain when the value is required and no default passed
        // ...Provides path for non-required when the default is literally null
        if ($default === null && $required) {
            throw new ConfigurationException("No value set for required {$section}.{$key}");
        }
        return $default;
    }