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