@@ -131,9 +131,11 @@ discard block |
||
| 131 | 131 | $this->icingaAPI = new Icinga2API($host,$port); |
| 132 | 132 | $this->icingaAPI->setCredentials($user, $pass); |
| 133 | 133 | list($ret,$message) = $this->icingaAPI->test($this->getModuleConfig()->getapiUserPermissions()); |
| 134 | - if ($ret === TRUE) // On error, switch to ido DB |
|
| 134 | + if ($ret === TRUE) { |
|
| 135 | + // On error, switch to ido DB |
|
| 135 | 136 | { |
| 136 | 137 | $this->apiMode = FALSE; |
| 138 | + } |
|
| 137 | 139 | return $this->getUIDatabase(); |
| 138 | 140 | } |
| 139 | 141 | $this->apiMode = TRUE; |
@@ -213,7 +215,9 @@ discard block |
||
| 213 | 215 | if ($this->MIBData == null) |
| 214 | 216 | { |
| 215 | 217 | $dbConn = $this->getUIDatabase()->getDbConn(); |
| 216 | - if ($dbConn === null) throw new \ErrorException('uncatched db error'); |
|
| 218 | + if ($dbConn === null) { |
|
| 219 | + throw new \ErrorException('uncatched db error'); |
|
| 220 | + } |
|
| 217 | 221 | $this->MIBData=new MIBLoader( |
| 218 | 222 | $this->Config()->get('config', 'snmptranslate'), |
| 219 | 223 | $this->Config()->get('config', 'snmptranslate_dirs'), |
@@ -283,7 +287,9 @@ discard block |
||
| 283 | 287 | $catString=''; |
| 284 | 288 | foreach ($catArray as $index => $value) |
| 285 | 289 | { |
| 286 | - if ($catString != '' ) $catString .= '!'; |
|
| 290 | + if ($catString != '' ) { |
|
| 291 | + $catString .= '!'; |
|
| 292 | + } |
|
| 287 | 293 | $catString .= $index . ':' . $value; |
| 288 | 294 | } |
| 289 | 295 | $this->getUIDatabase()->setDBConfigValue('handler_categories', $catString); |
@@ -293,8 +299,12 @@ discard block |
||
| 293 | 299 | { |
| 294 | 300 | $catArray = $this->getHandlersCategory(); |
| 295 | 301 | $i=1; |
| 296 | - while (isset($catArray[$i]) && $i < 100) $i++; |
|
| 297 | - if ($i == 100) throw new ProgrammingError('Category array error'); |
|
| 302 | + while (isset($catArray[$i]) && $i < 100) { |
|
| 303 | + $i++; |
|
| 304 | + } |
|
| 305 | + if ($i == 100) { |
|
| 306 | + throw new ProgrammingError('Category array error'); |
|
| 307 | + } |
|
| 298 | 308 | $catArray[$i] = $catName; |
| 299 | 309 | $this->setHandlerCategory($catArray); |
| 300 | 310 | } |