Completed
Push — 123 ( d13f38 )
by Vasily
05:11
created
lib/MongoClientAsync.php 1 patch
Braces   +4 added lines, -10 removed lines patch added patch discarded remove patch
@@ -176,9 +176,7 @@  discard block
 block discarded – undo
176 176
 			
177 177
 				if ($k === 'sort') {
178 178
 					$o['orderby'] = $v;
179
-				}
180
-				elseif ($k === 'parse_oplog') {}
181
-				else {
179
+				} elseif ($k === 'parse_oplog') {} else {
182 180
 					$o[$k] = $v;
183 181
 				}
184 182
 			}
@@ -277,9 +275,7 @@  discard block
 block discarded – undo
277 275
 		
278 276
 				if ($k === 'sort') {
279 277
 					$o['orderby'] = $v;
280
-				}
281
-				elseif ($k === 'parse_oplog') {}
282
-				else {
278
+				} elseif ($k === 'parse_oplog') {} else {
283 279
 					$o[$k] = $v;
284 280
 				}
285 281
 			}
@@ -340,8 +336,7 @@  discard block
 block discarded – undo
340 336
 
341 337
 		if (is_string($p['where'])) {
342 338
 			$query['where'] = new MongoCode($p['where']);
343
-		}
344
-		elseif (
339
+		} elseif (
345 340
 			is_object($p['where']) 
346 341
 			|| sizeof($p['where'])
347 342
 		) {
@@ -481,8 +476,7 @@  discard block
 block discarded – undo
481 476
 		
482 477
 		if (is_string($p['where'])) {
483 478
 			$query['where'] = new MongoCode($p['where']);
484
-		}
485
-		elseif (
479
+		} elseif (
486 480
 			is_object($p['where']) 
487 481
 			|| sizeof($p['where'])
488 482
 		) {
Please login to merge, or discard this patch.
lib/RedisClientConnection.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,21 +51,18 @@
 block discarded – undo
51 51
 						$this->result = array((int) binarySubstr($l, 1));
52 52
 					}
53 53
 					goto start;
54
-				}
55
-				elseif (($char == '+') || ($char == '-')) { // inline string
54
+				} elseif (($char == '+') || ($char == '-')) { // inline string
56 55
 					$this->resultLength = 1;
57 56
 					$this->resultSize = 1;
58 57
 					$this->error = ($char == '-');
59 58
 					$this->result = array(binarySubstr($l, 1));
60 59
 					goto start;
61
-				}
62
-				elseif ($char == '*') { // defines number of elements of incoming array
60
+				} elseif ($char == '*') { // defines number of elements of incoming array
63 61
 					$this->resultLength = (int) substr($l, 1);
64 62
 					$this->resultSize = 0;
65 63
 					$this->result = array();
66 64
 					goto start;
67
-				}
68
-				elseif ($char == '$') { // defines size of the data block
65
+				} elseif ($char == '$') { // defines size of the data block
69 66
 					$this->valueLength = (int) substr($l, 1);
70 67
 					$this->state = self::STATE_BINARY; // binary data block
71 68
 					break; // stop reading line-by-line
Please login to merge, or discard this patch.
lib/Connection.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -162,8 +162,7 @@  discard block
 block discarded – undo
162 162
 			socket_set_option($fd, SOL_SOCKET, SO_SNDTIMEO, array('sec' => $this->timeout, 'usec' => 0));
163 163
 			socket_set_option($fd, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $this->timeout, 'usec' => 0));
164 164
 			@socket_connect($fd, $e[1], 0);
165
-		} 
166
-		elseif (stripos($addr, 'raw:') === 0) {
165
+		} elseif (stripos($addr, 'raw:') === 0) {
167 166
 			$this->type = 'raw';
168 167
 			// Raw-socket
169 168
 			$this->addr = $addr;
@@ -200,8 +199,7 @@  discard block
 block discarded – undo
200 199
 			socket_set_option($fd, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $this->timeout, 'usec' => 0));
201 200
 			socket_set_nonblock($fd);
202 201
 			@socket_connect($fd, $host, 0);
203
-		}
204
-		elseif (stripos($addr, 'udp:') === 0) {
202
+		} elseif (stripos($addr, 'udp:') === 0) {
205 203
 			$this->type = 'udp';
206 204
 			// UDP-socket
207 205
 			$this->addr = $addr;
@@ -308,8 +306,7 @@  discard block
 block discarded – undo
308 306
 			if (!$this->bevConnectEnabled) {
309 307
 				@socket_connect($fd, $host, $port);
310 308
 				socket_getsockname($fd, $this->locAddr, $this->locPort);
311
-			}
312
-			else {
309
+			} else {
313 310
 				$this->bevConnect = true;
314 311
 			}
315 312
 		}
Please login to merge, or discard this patch.
lib/IOStream.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -401,8 +401,7 @@
 block discarded – undo
401 401
 	public function onStateEvent($bev, $events) {
402 402
 		if ($events & EventBufferEvent::CONNECTED) {
403 403
 			$this->onWriteEvent($bev);
404
-		}
405
-  		elseif ($events & (EventBufferEvent::ERROR | EventBufferEvent::EOF)) {
404
+		} elseif ($events & (EventBufferEvent::ERROR | EventBufferEvent::EOF)) {
406 405
 			try {
407 406
 				$this->close();
408 407
 				if ($this->finished) {
Please login to merge, or discard this patch.
lib/FlashPolicyServer.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@
 block discarded – undo
60 60
 				$this->write("<error/>\x00");
61 61
 			}
62 62
 			$this->finish();
63
-		}
64
-		else {
63
+		} else {
65 64
 			$this->finish();
66 65
 		}
67 66
 	}
Please login to merge, or discard this patch.
lib/Daemon_Bootstrap.php 1 patch
Braces   +19 added lines, -38 removed lines patch added patch discarded remove patch
@@ -90,8 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 			self::printUsage();
92 92
 			exit;
93
-		}
94
-		elseif ('help' === $runmode) {
93
+		} elseif ('help' === $runmode) {
95 94
 			self::printHelp();
96 95
 			exit;
97 96
 		}
@@ -193,17 +192,14 @@  discard block
 block discarded – undo
193 192
 			}
194 193
 
195 194
 			Daemon_Bootstrap::$pid = 0;
196
-		}
197
-		elseif (!is_file(Daemon::$config->pidfile->value)) {
195
+		} elseif (!is_file(Daemon::$config->pidfile->value)) {
198 196
 			Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be a regular file.');
199 197
 			Daemon_Bootstrap::$pid = FALSE;
200 198
 			$error = true;
201
-		}
202
-		elseif (!is_writable(Daemon::$config->pidfile->value)) {
199
+		} elseif (!is_writable(Daemon::$config->pidfile->value)) {
203 200
 			Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be writable.');
204 201
 			$error = true;
205
-		}
206
-		elseif (!is_readable(Daemon::$config->pidfile->value)) {
202
+		} elseif (!is_readable(Daemon::$config->pidfile->value)) {
207 203
 			Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be readable.');
208 204
 			Daemon_Bootstrap::$pid = FALSE;
209 205
 			$error = true;
@@ -238,8 +234,7 @@  discard block
 block discarded – undo
238 234
 			if (($sg = posix_getgrnam(Daemon::$config->group->value)) === FALSE) {
239 235
 				Daemon::log('Unexisting group \'' . Daemon::$config->group->value . '\'. You have to replace config-variable \'group\' with existing group-name.');
240 236
 				$error = true;
241
-			}
242
-			elseif (($sg['gid'] != posix_getgid()) && (posix_getuid() != 0)) {
237
+			} elseif (($sg['gid'] != posix_getgid()) && (posix_getuid() != 0)) {
243 238
 				Daemon::log('You must have the root privileges to change group.');
244 239
 				$error = true;
245 240
 			}
@@ -252,8 +247,7 @@  discard block
 block discarded – undo
252 247
 			if (($su = posix_getpwnam(Daemon::$config->user->value)) === FALSE) {
253 248
 				Daemon::log('Unexisting user \'' . Daemon::$config->user->value . '\', user not found. You have to replace config-variable \'user\' with existing username.');
254 249
 				$error = true;
255
-			}
256
-			elseif (
250
+			} elseif (
257 251
 				($su['uid'] != posix_getuid()) 
258 252
 				&& (posix_getuid() != 0)
259 253
 			) {
@@ -284,12 +278,10 @@  discard block
 block discarded – undo
284 278
 		if ($runmode == 'start') {
285 279
 			if ($error === FALSE) {
286 280
 				Daemon_Bootstrap::start();
287
-			}
288
-			else {
281
+			} else {
289 282
 				exit(6);
290 283
 			}
291
-		}
292
-		elseif (
284
+		} elseif (
293 285
 			$runmode == 'status' 
294 286
 			|| $runmode == 'fullstatus'
295 287
 		) {
@@ -317,42 +309,36 @@  discard block
 block discarded – undo
317 309
 			}
318 310
 
319 311
 			echo "\n";
320
-		}
321
-		elseif ($runmode == 'update') {
312
+		} elseif ($runmode == 'update') {
322 313
 			if (
323 314
 				(!Daemon_Bootstrap::$pid) 
324 315
 				|| (!posix_kill(Daemon_Bootstrap::$pid, SIGHUP))
325 316
 			) {
326 317
 				echo '[UPDATE] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n";
327 318
 			}
328
-		}
329
-		elseif ($runmode == 'reopenlog') {
319
+		} elseif ($runmode == 'reopenlog') {
330 320
 			if (
331 321
 				(!Daemon_Bootstrap::$pid) 
332 322
 				|| (!posix_kill(Daemon_Bootstrap::$pid,SIGUSR1))
333 323
 			) {
334 324
 				echo '[REOPEN-LOG] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n";
335 325
 			}
336
-		}
337
-		elseif ($runmode == 'reload') {
326
+		} elseif ($runmode == 'reload') {
338 327
 			if (
339 328
 				(!Daemon_Bootstrap::$pid) 
340 329
 				|| (!posix_kill(Daemon_Bootstrap::$pid,SIGUSR2))
341 330
 			) {
342 331
 				echo '[RELOAD] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n";
343 332
 			}
344
-		}
345
-		elseif ($runmode == 'restart') {
333
+		} elseif ($runmode == 'restart') {
346 334
 			if ($error === FALSE) {
347 335
 				Daemon_Bootstrap::stop(2);
348 336
 				Daemon_Bootstrap::start();
349 337
 			}
350
-		}
351
-		elseif ($runmode == 'hardrestart') {
338
+		} elseif ($runmode == 'hardrestart') {
352 339
 			Daemon_Bootstrap::stop(3);
353 340
 			Daemon_Bootstrap::start();
354
-		}
355
-		elseif ($runmode == 'configtest') {
341
+		} elseif ($runmode == 'configtest') {
356 342
 			$term = new Terminal;
357 343
 			$term->enable_color = true;
358 344
 
@@ -385,11 +371,9 @@  discard block
 block discarded – undo
385 371
 			$term->drawtable($rows);
386 372
 
387 373
 			echo "\n";
388
-		}
389
-		elseif ($runmode == 'stop') {
374
+		} elseif ($runmode == 'stop') {
390 375
 			Daemon_Bootstrap::stop();
391
-		}
392
-		elseif ($runmode == 'hardstop') {
376
+		} elseif ($runmode == 'hardstop') {
393 377
 			echo '[HARDSTOP] Sending SIGINT to ' . Daemon_Bootstrap::$pid . '... ';
394 378
 
395 379
 			$ok = Daemon_Bootstrap::$pid && posix_kill(Daemon_Bootstrap::$pid,SIGINT);
@@ -440,8 +424,7 @@  discard block
 block discarded – undo
440 424
 		foreach(self::$params as $name => $desc) {
441 425
 			if (empty($desc)) {
442 426
 				continue;
443
-			} 
444
-			elseif (!is_array($desc)) {
427
+			} elseif (!is_array($desc)) {
445 428
 				$term->drawParam($name, $desc);
446 429
 			} else {
447 430
 				$term->drawParam(
@@ -518,16 +501,14 @@  discard block
 block discarded – undo
518 501
 				}
519 502
 
520 503
 				$last_arg = $key;
521
-			}
522
-			elseif (preg_match('~^-([a-zA-Z0-9]+)~', $args[$i], $match)) {
504
+			} elseif (preg_match('~^-([a-zA-Z0-9]+)~', $args[$i], $match)) {
523 505
 				for ($j = 0, $jl = strlen($match[1]); $j < $jl; ++$j) {
524 506
 					$key = $match[1]{$j};
525 507
 					$out[$key] = true;
526 508
 				}
527 509
 		
528 510
 				$last_arg = $key;
529
-			}
530
-			elseif ($last_arg !== NULL) {
511
+			} elseif ($last_arg !== NULL) {
531 512
 				$out[$last_arg] = $args[$i];
532 513
 			}
533 514
 		}
Please login to merge, or discard this patch.
lib/AppInstance.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@
 block discarded – undo
179 179
 				}
180 180
 			} elseif ($v instanceof Daemon_ConfigSection) {
181 181
 			// @todo
182
-			}	else {
182
+			} else {
183 183
 				$current = $this->config->{$k};
184 184
 			  if (is_scalar($v))	{
185 185
 					$this->config->{$k} = new Daemon_ConfigEntry($v);
Please login to merge, or discard this patch.
lib/Request.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,8 +83,7 @@  discard block
 block discarded – undo
83 83
 				$ret = $this->run(); 
84 84
 				if (($ret === Request::STATE_FINISHED) || ($ret === null)) {
85 85
 					$this->finish();
86
-				}
87
-				elseif ($ret === Request::STATE_WAITING) {
86
+				} elseif ($ret === Request::STATE_WAITING) {
88 87
 					$this->state = $ret;
89 88
 				}
90 89
 			} catch (RequestSleepException $e) {
@@ -110,8 +109,7 @@  discard block
 block discarded – undo
110 109
 		handleStatus:
111 110
 		if ($this->state === Request::STATE_FINISHED) {		
112 111
 			$this->free();
113
-		}
114
-		elseif ($this->state === REQUEST::STATE_WAITING) {
112
+		} elseif ($this->state === REQUEST::STATE_WAITING) {
115 113
 			$this->ev->add($this->sleepTime);
116 114
 		}
117 115
 	}
@@ -271,8 +269,7 @@  discard block
 block discarded – undo
271 269
  
272 270
 		if (!$set) {
273 271
 			throw new RequestSleepException;
274
-		}
275
-		else {
272
+		} else {
276 273
 			$this->ev->del();
277 274
 			$this->ev->add($this->sleepTime);
278 275
 		}
Please login to merge, or discard this patch.
lib/FileWatcher.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@  discard block
 block discarded – undo
66 66
 		foreach ($this->files[$path] as $k => $subscriber) {
67 67
 			if (is_callable($subscriber) || is_array($subscriber)) {
68 68
 				call_user_func($subscriber, $path);
69
-			}
70
-			elseif (!Daemon::$process->IPCManager->importFile($subscriber, $path)) {
69
+			} elseif (!Daemon::$process->IPCManager->importFile($subscriber, $path)) {
71 70
 				$this->rmWatch($path, $subscriber);
72 71
 			}
73 72
 		}
@@ -85,8 +84,7 @@  discard block
 block discarded – undo
85 84
 				}
86 85
 				$this->onFileChanged($path);
87 86
 			}
88
-		}
89
-		else {
87
+		} else {
90 88
 		 	static $hash = array();
91 89
 	
92 90
 			foreach (array_keys($this->files) as $path) {
Please login to merge, or discard this patch.