@@ -138,8 +138,9 @@ discard block |
||
| 138 | 138 | $configuration = parse_ini_file($configFile, true); |
| 139 | 139 | |
| 140 | 140 | // Check that the file was parsed |
| 141 | - if ($configuration === false) |
|
| 142 | - throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
|
| 141 | + if ($configuration === false) { |
|
| 142 | + throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
|
| 143 | + } |
|
| 143 | 144 | |
| 144 | 145 | $instances = []; |
| 145 | 146 | |
@@ -155,8 +156,9 @@ discard block |
||
| 155 | 156 | } |
| 156 | 157 | |
| 157 | 158 | // Validate the configuration. We need at least one instance. |
| 158 | - if (empty($instances)) |
|
| 159 | - throw new InvalidConfigurationException('No instances defined, you need to specify at least one instance'); |
|
| 159 | + if (empty($instances)) { |
|
| 160 | + throw new InvalidConfigurationException('No instances defined, you need to specify at least one instance'); |
|
| 161 | + } |
|
| 160 | 162 | |
| 161 | 163 | // Create the configuration object |
| 162 | 164 | $config = new Configuration($databaseFile, $instances); |
@@ -189,18 +191,21 @@ discard block |
||
| 189 | 191 | $logFile = $input->getArgument('logFile'); |
| 190 | 192 | |
| 191 | 193 | // Check that the configuration file exists |
| 192 | - if (!file_exists($configFile)) |
|
| 193 | - throw new InvalidConfigurationException('The specified configuration file does not exist'); |
|
| 194 | + if (!file_exists($configFile)) { |
|
| 195 | + throw new InvalidConfigurationException('The specified configuration file does not exist'); |
|
| 196 | + } |
|
| 194 | 197 | |
| 195 | 198 | // Check that the database exists and is writable |
| 196 | - if (!file_exists($databasePath)) |
|
| 197 | - throw new InvalidConfigurationException('The specified database path does not exist'); |
|
| 198 | - else if (!is_writable($databasePath)) |
|
| 199 | - throw new InvalidConfigurationException('The specified database path is not writable'); |
|
| 199 | + if (!file_exists($databasePath)) { |
|
| 200 | + throw new InvalidConfigurationException('The specified database path does not exist'); |
|
| 201 | + } else if (!is_writable($databasePath)) { |
|
| 202 | + throw new InvalidConfigurationException('The specified database path is not writable'); |
|
| 203 | + } |
|
| 200 | 204 | |
| 201 | 205 | // Check that the directory of the log file path is writable |
| 202 | - if ($logFile !== null && !is_writable(dirname($logFile))) |
|
| 203 | - throw new InvalidConfigurationException('The specified log file path is not writable'); |
|
| 206 | + if ($logFile !== null && !is_writable(dirname($logFile))) { |
|
| 207 | + throw new InvalidConfigurationException('The specified log file path is not writable'); |
|
| 208 | + } |
|
| 204 | 209 | } |
| 205 | 210 | |
| 206 | 211 | |
@@ -219,12 +224,14 @@ discard block |
||
| 219 | 224 | $instance = new Instance($name, $address, $port); |
| 220 | 225 | |
| 221 | 226 | // Optionally set ignored users |
| 222 | - if (isset($values['ignoredUsers'])) |
|
| 223 | - $instance->setIgnoredUsers($values['ignoredUsers']); |
|
| 227 | + if (isset($values['ignoredUsers'])) { |
|
| 228 | + $instance->setIgnoredUsers($values['ignoredUsers']); |
|
| 229 | + } |
|
| 224 | 230 | |
| 225 | 231 | // Optionally set credentials |
| 226 | - if (isset($values['username']) && isset($values['password'])) |
|
| 227 | - $instance->setCredentials($values['username'], $values['password']); |
|
| 232 | + if (isset($values['username']) && isset($values['password'])) { |
|
| 233 | + $instance->setCredentials($values['username'], $values['password']); |
|
| 234 | + } |
|
| 228 | 235 | |
| 229 | 236 | return $instance; |
| 230 | 237 | } |
@@ -240,8 +247,9 @@ discard block |
||
| 240 | 247 | */ |
| 241 | 248 | private static function getSectionType($section) |
| 242 | 249 | { |
| 243 | - if (substr($section, 0, 8) === 'instance') |
|
| 244 | - return Configuration::SECTION_TYPE_INSTANCE; |
|
| 250 | + if (substr($section, 0, 8) === 'instance') { |
|
| 251 | + return Configuration::SECTION_TYPE_INSTANCE; |
|
| 252 | + } |
|
| 245 | 253 | |
| 246 | 254 | throw new InvalidConfigurationException('Unknown section "' . $section . '"'); |
| 247 | 255 | } |