| @@ 69-79 (lines=11) @@ | ||
| 66 | protected static function getSetting($settings, $mandatory, $sectionName, $settingName) |
|
| 67 | { |
|
| 68 | // Test if the section exists. |
|
| 69 | if (!array_key_exists($sectionName, $settings)) |
|
| 70 | { |
|
| 71 | if ($mandatory) |
|
| 72 | { |
|
| 73 | throw new RuntimeException("Section '%s' not found in configuration file.", $sectionName); |
|
| 74 | } |
|
| 75 | else |
|
| 76 | { |
|
| 77 | return null; |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||
| 81 | // Test if the setting in the section exists. |
|
| 82 | if (!array_key_exists($settingName, $settings[$sectionName])) |
|
| @@ 82-94 (lines=13) @@ | ||
| 79 | } |
|
| 80 | ||
| 81 | // Test if the setting in the section exists. |
|
| 82 | if (!array_key_exists($settingName, $settings[$sectionName])) |
|
| 83 | { |
|
| 84 | if ($mandatory) |
|
| 85 | { |
|
| 86 | throw new RuntimeException("Setting '%s' not found in section '%s' configuration file.", |
|
| 87 | $settingName, |
|
| 88 | $sectionName); |
|
| 89 | } |
|
| 90 | else |
|
| 91 | { |
|
| 92 | return null; |
|
| 93 | } |
|
| 94 | } |
|
| 95 | ||
| 96 | return $settings[$sectionName][$settingName]; |
|
| 97 | } |
|