@@ -61,8 +61,7 @@ |
||
| 61 | 61 | $conn->bind('disconnect', function() use ($app) { |
| 62 | 62 | $app->connect(); |
| 63 | 63 | }); |
| 64 | - } |
|
| 65 | - else { |
|
| 64 | + } else { |
|
| 66 | 65 | Daemon::log('IRCBot: unable to connect ('.$this->config->url->value.')'); |
| 67 | 66 | } |
| 68 | 67 | }); |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | if ($cmd === 'ping') { |
| 43 | 43 | $this->writeln('pong'); |
| 44 | - } |
|
| 45 | - elseif ( |
|
| 44 | + } elseif ( |
|
| 46 | 45 | ($cmd === 'exit') |
| 47 | 46 | || ($cmd === 'quit') |
| 48 | 47 | ) { |
@@ -57,8 +57,7 @@ |
||
| 57 | 57 | $conn->addEventHandler('disconnect', function() use ($app) { |
| 58 | 58 | $app->connect(); |
| 59 | 59 | }); |
| 60 | - } |
|
| 61 | - else { |
|
| 60 | + } else { |
|
| 62 | 61 | Daemon::log('Jabberbot: unable to connect ('.$this->config->url->value.')'); |
| 63 | 62 | } |
| 64 | 63 | }); |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | $req->wakeup(); |
| 43 | 43 | $event->finish(); |
| 44 | 44 | }, pow(10,6) * 1); |
| 45 | - } |
|
| 46 | - else { |
|
| 45 | + } else { |
|
| 47 | 46 | $req->out(':-('); |
| 48 | 47 | $req->wakeup(); |
| 49 | 48 | } |
@@ -38,15 +38,13 @@ |
||
| 38 | 38 | $this->result = ''; |
| 39 | 39 | $this->state = self::STATE_DATA; |
| 40 | 40 | break; |
| 41 | - } |
|
| 42 | - elseif ($e[0] == 'STAT') { |
|
| 41 | + } elseif ($e[0] == 'STAT') { |
|
| 43 | 42 | if ($this->result === NULL) { |
| 44 | 43 | $this->result = array(); |
| 45 | 44 | } |
| 46 | 45 | |
| 47 | 46 | $this->result[$e[1]] = $e[2]; |
| 48 | - } |
|
| 49 | - elseif ( |
|
| 47 | + } elseif ( |
|
| 50 | 48 | ($e[0] === 'STORED') |
| 51 | 49 | || ($e[0] === 'END') |
| 52 | 50 | || ($e[0] === 'DELETED') |
@@ -91,8 +91,7 @@ |
||
| 91 | 91 | if ($this->acquireOnGet) { |
| 92 | 92 | $free->detach($conn); |
| 93 | 93 | } |
| 94 | - } |
|
| 95 | - elseif ($storage->count() >= $this->maxConnPerServ) { |
|
| 94 | + } elseif ($storage->count() >= $this->maxConnPerServ) { |
|
| 96 | 95 | if (!isset($this->pending[$url])) { |
| 97 | 96 | $this->pending[$url] = new PriorityQueueCallbacks; |
| 98 | 97 | } |
@@ -282,8 +282,7 @@ discard block |
||
| 282 | 282 | if (posix_getuid() != 0) { |
| 283 | 283 | Daemon::log('You must have the root privileges to change root.'); |
| 284 | 284 | exit(0); |
| 285 | - } |
|
| 286 | - elseif (!chroot(Daemon::$config->chroot->value)) { |
|
| 285 | + } elseif (!chroot(Daemon::$config->chroot->value)) { |
|
| 287 | 286 | Daemon::log('Couldn\'t change root to \'' . Daemon::$config->chroot->value . '\'.'); |
| 288 | 287 | exit(0); |
| 289 | 288 | } |
@@ -293,8 +292,7 @@ discard block |
||
| 293 | 292 | if ($sg === FALSE) { |
| 294 | 293 | Daemon::log('Couldn\'t change group to \'' . Daemon::$config->group->value . '\'. You must replace config-variable \'group\' with existing group.'); |
| 295 | 294 | exit(0); |
| 296 | - } |
|
| 297 | - elseif ( |
|
| 295 | + } elseif ( |
|
| 298 | 296 | ($sg['gid'] != posix_getgid()) |
| 299 | 297 | && (!posix_setgid($sg['gid'])) |
| 300 | 298 | ) { |
@@ -307,8 +305,7 @@ discard block |
||
| 307 | 305 | if ($su === FALSE) { |
| 308 | 306 | Daemon::log('Couldn\'t change user to \'' . Daemon::$config->user->value . '\', user not found. You must replace config-variable \'user\' with existing username.'); |
| 309 | 307 | exit(0); |
| 310 | - } |
|
| 311 | - elseif ( |
|
| 308 | + } elseif ( |
|
| 312 | 309 | ($su['uid'] != posix_getuid()) |
| 313 | 310 | && (!posix_setuid($su['uid'])) |
| 314 | 311 | ) { |
@@ -476,8 +473,7 @@ discard block |
||
| 476 | 473 | } |
| 477 | 474 | if (!$self->reloadReady) { |
| 478 | 475 | $event->timeout(); |
| 479 | - } |
|
| 480 | - else { |
|
| 476 | + } else { |
|
| 481 | 477 | $self->eventBase->exit(); |
| 482 | 478 | } |
| 483 | 479 | }, 1e6, 'checkReloadReady'); |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | public static function prepareUrl($mixed) { |
| 54 | 54 | if (is_string($mixed)) { |
| 55 | 55 | $url = $mixed; |
| 56 | - } |
|
| 57 | - elseif (is_array($mixed)) { |
|
| 56 | + } elseif (is_array($mixed)) { |
|
| 58 | 57 | $url = ''; |
| 59 | 58 | $buf = array(); |
| 60 | 59 | $queryDelimiter = '?'; |
@@ -71,8 +70,7 @@ discard block |
||
| 71 | 70 | $buf[$k] = $v; |
| 72 | 71 | } |
| 73 | 72 | } |
| 74 | - } |
|
| 75 | - else { |
|
| 73 | + } else { |
|
| 76 | 74 | return false; |
| 77 | 75 | } |
| 78 | 76 | $u = parse_url($url); |
@@ -141,12 +139,10 @@ discard block |
||
| 141 | 139 | if (is_numeric($key)) { |
| 142 | 140 | if (is_string($item)) { |
| 143 | 141 | $this->writeln($item); |
| 144 | - } |
|
| 145 | - elseif (is_array($item)) { |
|
| 142 | + } elseif (is_array($item)) { |
|
| 146 | 143 | $this->writeln($item[0].': '.$item[1]); // @TODO: prevent injections? |
| 147 | 144 | } |
| 148 | - } |
|
| 149 | - else { |
|
| 145 | + } else { |
|
| 150 | 146 | $this->writeln($key.': '.$item); |
| 151 | 147 | } |
| 152 | 148 | } |
@@ -134,18 +134,14 @@ discard block |
||
| 134 | 134 | $type = Binary::getChar($this->buf); |
| 135 | 135 | if (($type === ValveClient::S2A_INFO) || ($type === ValveClient::S2A_INFO_SOURCE)) { |
| 136 | 136 | $result = $this->parseInfo($this->buf, $type); |
| 137 | - } |
|
| 138 | - elseif ($type === ValveClient::S2A_PLAYER) { |
|
| 137 | + } elseif ($type === ValveClient::S2A_PLAYER) { |
|
| 139 | 138 | $result = $this->parsePlayers($this->buf); |
| 140 | - } |
|
| 141 | - elseif ($type === ValveClient::S2A_SERVERQUERY_GETCHALLENGE) { |
|
| 139 | + } elseif ($type === ValveClient::S2A_SERVERQUERY_GETCHALLENGE) { |
|
| 142 | 140 | $result = binarySubstr($this->buf, 0, 4); |
| 143 | 141 | $this->buf = binarySubstr($this->buf, 5); |
| 144 | - } |
|
| 145 | - elseif ($type === ValveClient::S2A_PONG) { |
|
| 142 | + } elseif ($type === ValveClient::S2A_PONG) { |
|
| 146 | 143 | $result = true; |
| 147 | - } |
|
| 148 | - else { |
|
| 144 | + } else { |
|
| 149 | 145 | $result = null; |
| 150 | 146 | } |
| 151 | 147 | $this->onResponse->executeOne($this, $result); |
@@ -196,8 +192,7 @@ discard block |
||
| 196 | 192 | $info['serveros'] = Binary::getChar($st); |
| 197 | 193 | $info['passworded'] = Binary::getByte($st); |
| 198 | 194 | $info['secure'] = Binary::getByte($st); |
| 199 | - } |
|
| 200 | - elseif ($type === ValveClient::S2A_INFO_SOURCE) { |
|
| 195 | + } elseif ($type === ValveClient::S2A_INFO_SOURCE) { |
|
| 201 | 196 | $info['srvaddress'] = Binary::getString($st); |
| 202 | 197 | $info['hostname'] = Binary::getString($st); |
| 203 | 198 | $info['map'] = Binary::getString($st); |