@@ -132,8 +132,9 @@ discard block |
||
| 132 | 132 | $configuration = parse_ini_file($configFile, true); |
| 133 | 133 | |
| 134 | 134 | // Check that the file was parsed |
| 135 | - if ($configuration === false) |
|
| 136 | - throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
|
| 135 | + if ($configuration === false) { |
|
| 136 | + throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
|
| 137 | + } |
|
| 137 | 138 | |
| 138 | 139 | $instances = []; |
| 139 | 140 | |
@@ -149,8 +150,9 @@ discard block |
||
| 149 | 150 | } |
| 150 | 151 | |
| 151 | 152 | // Validate the configuration. We need at least one instance. |
| 152 | - if (empty($instances)) |
|
| 153 | - throw new InvalidConfigurationException('No instances defined, you need to specify at least one instance'); |
|
| 153 | + if (empty($instances)) { |
|
| 154 | + throw new InvalidConfigurationException('No instances defined, you need to specify at least one instance'); |
|
| 155 | + } |
|
| 154 | 156 | |
| 155 | 157 | // Create the configuration object |
| 156 | 158 | $config = new Configuration($databaseFile, $instances); |
@@ -180,14 +182,16 @@ discard block |
||
| 180 | 182 | $databasePath = $input->getArgument('databaseFile'); |
| 181 | 183 | |
| 182 | 184 | // Check that the configuration file exists |
| 183 | - if (!file_exists($configFile)) |
|
| 184 | - throw new InvalidConfigurationException('The specified configuration file does not exist'); |
|
| 185 | + if (!file_exists($configFile)) { |
|
| 186 | + throw new InvalidConfigurationException('The specified configuration file does not exist'); |
|
| 187 | + } |
|
| 185 | 188 | |
| 186 | 189 | // Check that the database exists and is writable |
| 187 | - if (!file_exists($databasePath)) |
|
| 188 | - throw new InvalidConfigurationException('The specified database path does not exist'); |
|
| 189 | - else if (!is_writable($databasePath)) |
|
| 190 | - throw new InvalidConfigurationException('The specified database path is not writable'); |
|
| 190 | + if (!file_exists($databasePath)) { |
|
| 191 | + throw new InvalidConfigurationException('The specified database path does not exist'); |
|
| 192 | + } else if (!is_writable($databasePath)) { |
|
| 193 | + throw new InvalidConfigurationException('The specified database path is not writable'); |
|
| 194 | + } |
|
| 191 | 195 | } |
| 192 | 196 | |
| 193 | 197 | |
@@ -206,12 +210,14 @@ discard block |
||
| 206 | 210 | $instance = new Instance($name, $address, $port); |
| 207 | 211 | |
| 208 | 212 | // Optionally set ignored users |
| 209 | - if (isset($values['ignoredUsers'])) |
|
| 210 | - $instance->setIgnoredUsers($values['ignoredUsers']); |
|
| 213 | + if (isset($values['ignoredUsers'])) { |
|
| 214 | + $instance->setIgnoredUsers($values['ignoredUsers']); |
|
| 215 | + } |
|
| 211 | 216 | |
| 212 | 217 | // Optionally set credentials |
| 213 | - if (isset($values['username']) && isset($values['password'])) |
|
| 214 | - $instance->setCredentials($values['username'], $values['password']); |
|
| 218 | + if (isset($values['username']) && isset($values['password'])) { |
|
| 219 | + $instance->setCredentials($values['username'], $values['password']); |
|
| 220 | + } |
|
| 215 | 221 | |
| 216 | 222 | return $instance; |
| 217 | 223 | } |
@@ -227,8 +233,9 @@ discard block |
||
| 227 | 233 | */ |
| 228 | 234 | private static function getSectionType($section) |
| 229 | 235 | { |
| 230 | - if (substr($section, 0, 8) === 'instance') |
|
| 231 | - return Configuration::SECTION_TYPE_INSTANCE; |
|
| 236 | + if (substr($section, 0, 8) === 'instance') { |
|
| 237 | + return Configuration::SECTION_TYPE_INSTANCE; |
|
| 238 | + } |
|
| 232 | 239 | |
| 233 | 240 | throw new InvalidConfigurationException('Unknown section "' . $section . '"'); |
| 234 | 241 | } |