protected static function getSetting(array $settings,
                                       bool $mandatory,
                                       string $sectionName,
                                       string $settingName)
  {
    // Test if the section exists.
    if (!array_key_exists($sectionName, $settings))
    {
      if ($mandatory)
      {
        throw new RuntimeException("Section '%s' not found in configuration file.", $sectionName);
      }
      else
      {
        return null;
      }
    }

    // Test if the setting in the section exists.
    if (!array_key_exists($settingName, $settings[$sectionName]))
    {
      if ($mandatory)
      {
        throw new RuntimeException("Setting '%s' not found in section '%s' configuration file.",
                                   $settingName,
                                   $sectionName);
      }
      else
      {
        return null;
      }
    }

    return $settings[$sectionName][$settingName];
  }
protected static function getSetting(array $settings,
                                       bool $mandatory,
                                       string $sectionName,
                                       string $settingName)
  {
    // Test if the section exists.
    if (!array_key_exists($sectionName, $settings))
    {
      if ($mandatory)
      {
        throw new RuntimeException("Section '%s' not found in configuration file.", $sectionName);
      }
      else
      {
        return null;
      }
    }

    // Test if the setting in the section exists.
    if (!array_key_exists($settingName, $settings[$sectionName]))
    {
      if ($mandatory)
      {
        throw new RuntimeException("Setting '%s' not found in section '%s' configuration file.",
                                   $settingName,
                                   $sectionName);
      }
      else
      {
        return null;
      }
    }

    return $settings[$sectionName][$settingName];
  }
protected static function getSetting ( array $ settings , bool $ mandatory , string $ sectionName , string $ settingName ) { // Test if the section exists. if ( ! array_key_exists ( $ sectionName , $ settings ) ) { if ( $ mandatory ) { throw new RuntimeException ( "Section '%s' not found in configuration file." , $ sectionName ) ; } else { return null ; } } // Test if the setting in the section exists. if ( ! array_key_exists ( $ settingName , $ settings [ $ sectionName ] ) ) { if ( $ mandatory ) { throw new RuntimeException ( "Setting '%s' not found in section '%s' configuration file." , $ settingName , $ sectionName ) ; } else { return null ; } } return $ settings [ $ sectionName ] [ $ settingName ] ; }
Returns the value of a setting.

@param array  $settings    The settings as returned by parse_ini_file.
@param bool   $mandatory   If set and setting $settingName is not found in section $sectionName an exception
will be thrown.
@param string $sectionName The name of the section of the requested setting.
@param string $settingName The name of the setting of the requested setting.

@return mixed
Returns the value of a setting .