Completed
Push — 123 ( d13f38 )
by Vasily
05:11
created
lib/Daemon_ConfigSection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	public function toArray() {
39 39
 		$arr = array();
40 40
 		foreach ($this as $k => $entry) {
41
-			if (!$entry instanceof Daemon_ConfigEntry)	{
41
+			if (!$entry instanceof Daemon_ConfigEntry) {
42 42
 				continue;
43 43
 			}
44 44
 			$arr[$k] = $entry->value;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		return $this->{$this->getRealOffsetName($offset)}->value;
59 59
 	}
60 60
 
61
-	public function offsetSet($offset,$value) {
61
+	public function offsetSet($offset, $value) {
62 62
 		$this->{$this->getRealOffsetName($offset)} = $value;
63 63
 	}
64 64
 
Please login to merge, or discard this patch.
lib/Terminal.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function setStyle($c) {
55 55
 		if ($this->enable_color) {
56
-			echo "\033[".$c.'m';
56
+			echo "\033[" . $c . 'm';
57 57
 		}
58 58
 	}
59 59
 
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 
97 97
 		$leftcolumn = array();
98 98
 
99
-		$valstr = is_array($values) ? implode('|', array_keys($values)): $values;
99
+		$valstr = is_array($values) ? implode('|', array_keys($values)) : $values;
100 100
 
101 101
 		if ('' !== $valstr) {
102 102
 			$valstr = '=[' . $valstr . ']';
103 103
 		}
104 104
 
105
-		$paramstr = "  \033[1m--" . $name . $valstr. "\033[0m";
105
+		$paramstr = "  \033[1m--" . $name . $valstr . "\033[0m";
106 106
 
107 107
 		$pl = strlen($paramstr);
108 108
 		if ($pl + 2 >= $paramw) {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		$leftcolumn[] = $paramstr;
115 115
 
116 116
 		if (is_array($values)) {
117
-			foreach($values as $key => $value) {
117
+			foreach ($values as $key => $value) {
118 118
 				$leftcolumn[] = '    ' . $key . ' - ' . $value; 
119 119
 			}
120 120
 		}
Please login to merge, or discard this patch.
lib/MongoClientAsyncConnection.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class MongoClientAsyncConnection extends NetworkClientConnection {
3
-	public $url;               // url
4
-	public $user;              // Username
5
-	public $password;          // Password
6
-	public $dbname;            // Database name
7
-	public $busy = false;      // Is this session busy?
3
+	public $url; // url
4
+	public $user; // Username
5
+	public $password; // Password
6
+	public $dbname; // Database name
7
+	public $busy = false; // Is this session busy?
8 8
 
9 9
 	public function onReady() {
10 10
 		$conn = $this;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			$r['cursorId'] = binarySubstr($this->buf, 20, 8);
63 63
 			$id = (int) $h['responseTo'];
64 64
 			$flagBits = str_pad(strrev(decbin($r['flag'])), 8, '0', STR_PAD_LEFT);
65
-			$cur = ($r['cursorId'] !== "\x00\x00\x00\x00\x00\x00\x00\x00"?'c' . $r['cursorId'] : 'r' . $h['responseTo']);
65
+			$cur = ($r['cursorId'] !== "\x00\x00\x00\x00\x00\x00\x00\x00" ? 'c' . $r['cursorId'] : 'r' . $h['responseTo']);
66 66
 
67 67
 			if (
68 68
 				isset($this->pool->requests[$id][2]) 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@
 block discarded – undo
136 136
 						unset($this->pool->cursors[$cur]);
137 137
 					}
138 138
 				}
139
-			} 
140
-			elseif (isset($this->pool->cursors[$cur])) {
139
+			} elseif (isset($this->pool->cursors[$cur])) {
141 140
 				call_user_func($this->pool->cursors[$cur]->callback, $this->pool->cursors[$cur]);
142 141
 			}
143 142
 			
Please login to merge, or discard this patch.
lib/LockClient.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function job($name, $wait, $onRun, $onSuccess = NULL, $onFailure = NULL) {
37 37
 		$name = $this->prefix . $name;
38
-		$this->getConnectionByName($name, function ($conn) use ($name, $wait, $onRun, $onSuccess, $onFailure) {
38
+		$this->getConnectionByName($name, function($conn) use ($name, $wait, $onRun, $onSuccess, $onFailure) {
39 39
 			if (!$conn->connected) {
40 40
 				return;
41 41
 			}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @return void
51 51
 	 */
52 52
 	public function done($name) {
53
-		$this->getConnectionByName($name, function ($conn) use ($name) {
53
+		$this->getConnectionByName($name, function($conn) use ($name) {
54 54
 			if (!$conn->connected) {
55 55
 				return;
56 56
 			}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return void
65 65
 	 */
66 66
 	public function failed($name) {
67
-		$this->getConnectionByName($name, function ($conn) use ($name) {
67
+		$this->getConnectionByName($name, function($conn) use ($name) {
68 68
 			if (!$conn->connected) {
69 69
 				return;
70 70
 			}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			&& (($ep = strpos($name, ']')) !== FALSE) 
86 86
 			&& ($ep > $sp)
87 87
 		) {
88
-			$name = substr($name,$sp + 1, $ep - $sp - 1);
88
+			$name = substr($name, $sp + 1, $ep - $sp - 1);
89 89
 		}
90 90
 
91 91
 		srand(crc32($name));
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 					call_user_func($this->pool->jobs[$e[1]][2], $e[0], $e[1], $this->pool);
125 125
 				}
126 126
 			}
127
-			if($this->pool->config->protologging->value) {
127
+			if ($this->pool->config->protologging->value) {
128 128
 				Daemon::log('Lock client <-- Lock server: ' . Debug::exportBytes(implode(' ', $e)) . "\n");
129 129
 			}
130 130
 		}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -113,13 +113,11 @@
 block discarded – undo
113 113
 				if (isset($this->pool->jobs[$e[1]])) {
114 114
 					call_user_func($this->pool->jobs[$e[1]][0], $e[0], $e[1], $this->pool);
115 115
 				}
116
-			}
117
-			elseif ($e[0] === 'DONE') {
116
+			} elseif ($e[0] === 'DONE') {
118 117
 				if (isset($this->pool->jobs[$e[1]][1])) {
119 118
 					call_user_func($this->pool->jobs[$e[1]][1], $e[0], $e[1], $this->pool);
120 119
 				}
121
-			}
122
-			elseif ($e[0] === 'FAILED') {
120
+			} elseif ($e[0] === 'FAILED') {
123 121
 				if (isset($this->pool->jobs[$e[1]][2])) {
124 122
 					call_user_func($this->pool->jobs[$e[1]][2], $e[0], $e[1], $this->pool);
125 123
 				}
Please login to merge, or discard this patch.
lib/IPCManager.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		foreach ($instancesCount as $name => $num) {
64 64
 			$v = Daemon::$config->{$name}->limitinstances->value - $num;
65 65
 			foreach ($this->pool->workers as $worker) {
66
-					if ($v <= 0) {break;}
67
-					if ((isset($worker->instancesCount[$name])) && ($worker->instancesCount[$name] < $perWorker))	{
66
+					if ($v <= 0) {break; }
67
+					if ((isset($worker->instancesCount[$name])) && ($worker->instancesCount[$name] < $perWorker)) {
68 68
 						continue;
69 69
 					}
70 70
 					if (!isset($worker->instancesCount[$name])) {
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
 		if ($p['op'] === 'spawnInstance') {
249 249
 			$fullname = $p['appfullname'];
250 250
 			$fullname = str_replace('-', ':', $fullname);
251
-			if (strpos($fullname,':') === false) {
251
+			if (strpos($fullname, ':') === false) {
252 252
 				$fullname .= ':';
253 253
 			}
254 254
 			list($app, $name) = explode(':', $fullname, 2);
255
-			Daemon::$appResolver->appInstantiate($app,$name);
255
+			Daemon::$appResolver->appInstantiate($app, $name);
256 256
 		}
257 257
 		elseif ($p['op'] === 'importFile') {
258 258
 			if (!Daemon::$config->autoreimport->value) {
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
 					runkit_import($path, RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE);
269 269
 					//Daemon::log('--end runkit_import('.$path.')');
270 270
 				} else {
271
-					$this->appInstance->log('Cannot import \''.$path.'\': runkit_import is not callable.');
271
+					$this->appInstance->log('Cannot import \'' . $path . '\': runkit_import is not callable.');
272 272
 				}
273 273
 				
274 274
 				$event->finish();
275 275
 			}, 5);
276 276
 		}
277 277
 		elseif ($p['op'] === 'call') {
278
-			if (strpos($p['appfullname'],':') === false) {
278
+			if (strpos($p['appfullname'], ':') === false) {
279 279
 				$p['appfullname'] .= ':';
280 280
 			}
281 281
 			list($app, $name) = explode(':', $p['appfullname'], 2);
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -69,8 +69,7 @@  discard block
 block discarded – undo
69 69
 					}
70 70
 					if (!isset($worker->instancesCount[$name])) {
71 71
 						$worker->instancesCount[$name] = 1;
72
-					}
73
-					else {
72
+					} else {
74 73
 						++$worker->instancesCount[$name];
75 74
 					}
76 75
 					$worker->sendPacket(array('op' => 'spawnInstance', 'appfullname' => $name));
@@ -160,22 +159,19 @@  discard block
 block discarded – undo
160 159
 			$this->workerId = $p['workerId'];
161 160
 			$this->pool->workers[$this->workerId] = $this;
162 161
 			$this->pool->appInstance->updatedWorkers();
163
-		}
164
-		elseif ($p['op'] === 'broadcastCall') {
162
+		} elseif ($p['op'] === 'broadcastCall') {
165 163
 			$p['op'] = 'call';
166 164
 			foreach ($this->pool->workers as $worker) {
167 165
 				$worker->sendPacket($p);
168 166
 			}
169
-		}
170
-		elseif ($p['op'] === 'directCall') {
167
+		} elseif ($p['op'] === 'directCall') {
171 168
 			$p['op'] = 'call';
172 169
 			if (!isset($this->pool->workers[$p['workerId']])) {
173 170
 				Daemon::$process->log('directCall(). not sent.');
174 171
 				return;
175 172
 			}
176 173
 			$this->pool->workers[$p['workerId']]->sendPacket($p);
177
-		}
178
-		elseif ($p['op'] === 'singleCall') {
174
+		} elseif ($p['op'] === 'singleCall') {
179 175
 			$p['op'] = 'call';
180 176
 			$sent = false;
181 177
 			foreach ($this->pool->workers as $worker) {
@@ -186,8 +182,7 @@  discard block
 block discarded – undo
186 182
 			if (!$sent) {
187 183
 				Daemon::$process->log('singleCall(). not sent.');
188 184
 			}
189
-		}
190
-		elseif ($p['op'] === 'addIncludedFiles') {
185
+		} elseif ($p['op'] === 'addIncludedFiles') {
191 186
 			foreach ($p['files'] as $file) {
192 187
 				Daemon::$process->fileWatcher->addWatch($file, $this->workerId);
193 188
 			}
@@ -253,8 +248,7 @@  discard block
 block discarded – undo
253 248
 			}
254 249
 			list($app, $name) = explode(':', $fullname, 2);
255 250
 			Daemon::$appResolver->appInstantiate($app,$name);
256
-		}
257
-		elseif ($p['op'] === 'importFile') {
251
+		} elseif ($p['op'] === 'importFile') {
258 252
 			if (!Daemon::$config->autoreimport->value) {
259 253
 				Daemon::$process->sigusr2(); // graceful restart
260 254
 				return;
@@ -273,8 +267,7 @@  discard block
 block discarded – undo
273 267
 				
274 268
 				$event->finish();
275 269
 			}, 5);
276
-		}
277
-		elseif ($p['op'] === 'call') {
270
+		} elseif ($p['op'] === 'call') {
278 271
 			if (strpos($p['appfullname'],':') === false) {
279 272
 				$p['appfullname'] .= ':';
280 273
 			}
Please login to merge, or discard this patch.
lib/IRC.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
   		319 => 'RPL_WHOISCHANNELS',  321 => 'RPL_LISTSTART',
31 31
   		322 => 'RPL_LIST',  323 => 'RPL_LISTEND',
32 32
   		324 => 'RPL_CHANNELMODEIS',  325 => 'RPL_UNIQOPIS',
33
-      328 => 'RPL_CHANNEL_URL', 329 => 'RPL_CREATIONTIME',
33
+	  328 => 'RPL_CHANNEL_URL', 329 => 'RPL_CREATIONTIME',
34 34
   		331 => 'RPL_NOTOPIC',  332 => 'RPL_TOPIC',  333 => 'RPL_TOPIC_TS',
35 35
   		341 => 'RPL_INVITING',  342 => 'RPL_SUMMONING',
36 36
   		346 => 'RPL_INVITELIST',  347 => 'RPL_ENDOFINVITELIST',
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 	);
77 77
   public static $codesFlip;
78 78
   public static function getCommandByCode($code) {
79
-    if (isset(self::$codes[$code])) {
80
-      return self::$codes[$code];
81
-    }
82
-    return false;
79
+	if (isset(self::$codes[$code])) {
80
+	  return self::$codes[$code];
81
+	}
82
+	return false;
83 83
   }
84 84
   public static function getCodeByCommand($cmd) {
85
-    if (self::$codesFlip === null) {
86
-      self::$codesFlip = array_flip(self::$codes);
87
-    }
88
-    if (isset(self::$codesFlip[$cmd])) {
89
-      return sprintf('%03u', self::$codesFlip[$cmd]);
90
-    }
91
-    return $cmd;
85
+	if (self::$codesFlip === null) {
86
+	  self::$codesFlip = array_flip(self::$codes);
87
+	}
88
+	if (isset(self::$codesFlip[$cmd])) {
89
+	  return sprintf('%03u', self::$codesFlip[$cmd]);
90
+	}
91
+	return $cmd;
92 92
 
93 93
   }
94 94
 	public static function parseUsermask($mask) {
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,77 +1,77 @@
 block discarded – undo
1 1
 <?php
2 2
 class IRC {
3
-	public static $codes = array (
4
-  		'1' => 'RPL_WELCOME',  2 => 'RPL_YOURHOST',
3
+	public static $codes = array(
4
+  		'1' => 'RPL_WELCOME', 2 => 'RPL_YOURHOST',
5 5
 		3 => 'RPL_CREATED', 4 => 'RPL_MYINFO',
6 6
 		5 => 'RPL_BOUNCE', 200 => 'RPL_TRACELINK',
7
-		201 => 'RPL_TRACECONNECTING',  202 => 'RPL_TRACEHANDSHAKE',
8
-		203 => 'RPL_TRACEUNKNOWN',  204 => 'RPL_TRACEOPERATOR',
9
-		205 => 'RPL_TRACEUSER',  206 => 'RPL_TRACESERVER',
10
-		207 => 'RPL_TRACESERVICE',  208 => 'RPL_TRACENEWTYPE',
11
-		209 => 'RPL_TRACECLASS',  210 => 'RPL_TRACERECONNECT',
12
-		211 => 'RPL_STATSLINKINFO',  212 => 'RPL_STATSCOMMANDS',
13
-		219 => 'RPL_ENDOFSTATS',  221 => 'RPL_UMODEIS',
14
-		234 => 'RPL_SERVLIST',  235 => 'RPL_SERVLISTEND',
15
-		242 => 'RPL_STATSUPTIME',  243 => 'RPL_STATSOLINE',
7
+		201 => 'RPL_TRACECONNECTING', 202 => 'RPL_TRACEHANDSHAKE',
8
+		203 => 'RPL_TRACEUNKNOWN', 204 => 'RPL_TRACEOPERATOR',
9
+		205 => 'RPL_TRACEUSER', 206 => 'RPL_TRACESERVER',
10
+		207 => 'RPL_TRACESERVICE', 208 => 'RPL_TRACENEWTYPE',
11
+		209 => 'RPL_TRACECLASS', 210 => 'RPL_TRACERECONNECT',
12
+		211 => 'RPL_STATSLINKINFO', 212 => 'RPL_STATSCOMMANDS',
13
+		219 => 'RPL_ENDOFSTATS', 221 => 'RPL_UMODEIS',
14
+		234 => 'RPL_SERVLIST', 235 => 'RPL_SERVLISTEND',
15
+		242 => 'RPL_STATSUPTIME', 243 => 'RPL_STATSOLINE',
16 16
 		250 => 'RPL_STATSCONN',
17
-		251 => 'RPL_LUSERCLIENT',  252 => 'RPL_LUSEROP',
18
-		253 => 'RPL_LUSERUNKNOWN',  254 => 'RPL_LUSERCHANNELS',
19
-		255 => 'RPL_LUSERME',  256 => 'RPL_ADMINME',
20
-		257 => 'RPL_ADMINLOC1',  258 => 'RPL_ADMINLOC2',
21
-		259 => 'RPL_ADMINEMAIL',  261 => 'RPL_TRACELOG',
22
-		262 => 'RPL_TRACEEND',  263 => 'RPL_TRYAGAIN',
17
+		251 => 'RPL_LUSERCLIENT', 252 => 'RPL_LUSEROP',
18
+		253 => 'RPL_LUSERUNKNOWN', 254 => 'RPL_LUSERCHANNELS',
19
+		255 => 'RPL_LUSERME', 256 => 'RPL_ADMINME',
20
+		257 => 'RPL_ADMINLOC1', 258 => 'RPL_ADMINLOC2',
21
+		259 => 'RPL_ADMINEMAIL', 261 => 'RPL_TRACELOG',
22
+		262 => 'RPL_TRACEEND', 263 => 'RPL_TRYAGAIN',
23 23
 		265 => 'RRPL_LOCALUSERS', 266 => 'RPL_GLOBALUSERS',
24
-		301 => 'RPL_AWAY',  302 => 'RPL_USERHOST',
25
-		303 => 'RPL_ISON',  305 => 'RPL_UNAWAY',
26
-		306 => 'RPL_NOWAWAY',  311 => 'RPL_WHOISUSER',
27
-		312 => 'RPL_WHOISSERVER',  313 => 'RPL_WHOISOPERATOR',
28
-  		314 => 'RPL_WHOWASUSER',  315 => 'RPL_ENDOFWHO',
29
-  		317 => 'RPL_WHOISIDLE',  318 => 'RPL_ENDOFWHOIS',
30
-  		319 => 'RPL_WHOISCHANNELS',  321 => 'RPL_LISTSTART',
31
-  		322 => 'RPL_LIST',  323 => 'RPL_LISTEND',
32
-  		324 => 'RPL_CHANNELMODEIS',  325 => 'RPL_UNIQOPIS',
24
+		301 => 'RPL_AWAY', 302 => 'RPL_USERHOST',
25
+		303 => 'RPL_ISON', 305 => 'RPL_UNAWAY',
26
+		306 => 'RPL_NOWAWAY', 311 => 'RPL_WHOISUSER',
27
+		312 => 'RPL_WHOISSERVER', 313 => 'RPL_WHOISOPERATOR',
28
+  		314 => 'RPL_WHOWASUSER', 315 => 'RPL_ENDOFWHO',
29
+  		317 => 'RPL_WHOISIDLE', 318 => 'RPL_ENDOFWHOIS',
30
+  		319 => 'RPL_WHOISCHANNELS', 321 => 'RPL_LISTSTART',
31
+  		322 => 'RPL_LIST', 323 => 'RPL_LISTEND',
32
+  		324 => 'RPL_CHANNELMODEIS', 325 => 'RPL_UNIQOPIS',
33 33
       328 => 'RPL_CHANNEL_URL', 329 => 'RPL_CREATIONTIME',
34
-  		331 => 'RPL_NOTOPIC',  332 => 'RPL_TOPIC',  333 => 'RPL_TOPIC_TS',
35
-  		341 => 'RPL_INVITING',  342 => 'RPL_SUMMONING',
36
-  		346 => 'RPL_INVITELIST',  347 => 'RPL_ENDOFINVITELIST',
37
-  		348 => 'RPL_EXCEPTLIST',  349 => 'RPL_ENDOFEXCEPTLIST',
38
-  		351 => 'RPL_VERSION',  352 => 'RPL_WHOREPLY',
39
-  		353 => 'RPL_NAMREPLY',  364 => 'RPL_LINKS',
40
-  		365 => 'RPL_ENDOFLINKS',  366 => 'RPL_ENDOFNAMES',
41
-  		367 => 'RPL_BANLIST',  368 => 'RPL_ENDOFBANLIST',
42
-  		369 => 'RPL_ENDOFWHOWAS',  371 => 'RPL_INFO',
43
-  		372 => 'RPL_MOTD',  374 => 'RPL_ENDOFINFO',
44
-  		375 => 'RPL_MOTDSTART',  376 => 'RPL_ENDOFMOTD',
45
-  		381 => 'RPL_YOUREOPER',  382 => 'RPL_REHASHING',
46
-  		383 => 'RPL_YOURESERVICE',  391 => 'RPL_TIME',
47
-  		392 => 'RPL_USERSSTART',  393 => 'RPL_USERS',
48
-  		394 => 'RPL_ENDOFUSERS',  395 => 'RPL_NOUSERS',
49
-  		401 => 'ERR_NOSUCHNICK',  402 => 'ERR_NOSUCHSERVER',
50
-  		403 => 'ERR_NOSUCHCHANNEL',  404 => 'ERR_CANNOTSENDTOCHAN',
51
-  		405 => 'ERR_TOOMANYCHANNELS',  406 => 'ERR_WASNOSUCHNICK',
52
-  		407 => 'ERR_TOOMANYTARGETS',  408 => 'ERR_NOSUCHSERVICE',
53
-  		409 => 'ERR_NOORIGIN',  411 => 'ERR_NORECIPIENT',
54
-  		412 => 'ERR_NOTEXTTOSEND',  413 => 'ERR_NOTOPLEVEL',
55
-  		414 => 'ERR_WILDTOPLEVEL',  415 => 'ERR_BADMASK',
56
-  		421 => 'ERR_UNKNOWNCOMMAND',  422 => 'ERR_NOMOTD',
57
-  		423 => 'ERR_NOADMININFO',  424 => 'ERR_FILEERROR',
58
-  		431 => 'ERR_NONICKNAMEGIVEN',  432 => 'ERR_ERRONEUSNICKNAME',
59
-  		433 => 'ERR_NICKNAMEINUSE',  436 => 'ERR_NICKCOLLISION',
60
-  		437 => 'ERR_UNAVAILRESOURCE',  441 => 'ERR_USERNOTINCHANNEL',
61
-  		442 => 'ERR_NOTONCHANNEL',  443 => 'ERR_USERONCHANNEL',
62
-  		444 => 'ERR_NOLOGIN',  445 => 'ERR_SUMMONDISABLED',
63
-  		446 => 'ERR_USERSDISABLED',  451 => 'ERR_NOTREGISTERED',
64
-  		461 => 'ERR_NEEDMOREPARAMS',  462 => 'ERR_ALREADYREGISTRED',
65
-		463 => 'ERR_NOPERMFORHOST',  		464 => 'ERR_PASSWDMISMATCH',
66
-  		465 => 'ERR_YOUREBANNEDCREEP',  		466 => 'ERR_YOUWILLBEBANNED',
67
-  		467 => 'ERR_KEYSET',  		471 => 'ERR_CHANNELISFULL',
68
-  		472 => 'ERR_UNKNOWNMODE',  		473 => 'ERR_INVITEONLYCHAN',
69
-  		474 => 'ERR_BANNEDFROMCHAN',  		475 => 'ERR_BADCHANNELKEY',
70
-  		476 => 'ERR_BADCHANMASK',  		477 => 'ERR_NOCHANMODES',
71
-  		478 => 'ERR_BANLISTFULL',  		481 => 'ERR_NOPRIVILEGES',
72
-  		482 => 'ERR_CHANOPRIVSNEEDED',  		483 => 'ERR_CANTKILLSERVER',
73
-  		484 => 'ERR_RESTRICTED',  		485 => 'ERR_UNIQOPPRIVSNEEDED',
74
-  		491 => 'ERR_NOOPERHOST',  		501 => 'ERR_UMODEUNKNOWNFLAG',
34
+  		331 => 'RPL_NOTOPIC', 332 => 'RPL_TOPIC', 333 => 'RPL_TOPIC_TS',
35
+  		341 => 'RPL_INVITING', 342 => 'RPL_SUMMONING',
36
+  		346 => 'RPL_INVITELIST', 347 => 'RPL_ENDOFINVITELIST',
37
+  		348 => 'RPL_EXCEPTLIST', 349 => 'RPL_ENDOFEXCEPTLIST',
38
+  		351 => 'RPL_VERSION', 352 => 'RPL_WHOREPLY',
39
+  		353 => 'RPL_NAMREPLY', 364 => 'RPL_LINKS',
40
+  		365 => 'RPL_ENDOFLINKS', 366 => 'RPL_ENDOFNAMES',
41
+  		367 => 'RPL_BANLIST', 368 => 'RPL_ENDOFBANLIST',
42
+  		369 => 'RPL_ENDOFWHOWAS', 371 => 'RPL_INFO',
43
+  		372 => 'RPL_MOTD', 374 => 'RPL_ENDOFINFO',
44
+  		375 => 'RPL_MOTDSTART', 376 => 'RPL_ENDOFMOTD',
45
+  		381 => 'RPL_YOUREOPER', 382 => 'RPL_REHASHING',
46
+  		383 => 'RPL_YOURESERVICE', 391 => 'RPL_TIME',
47
+  		392 => 'RPL_USERSSTART', 393 => 'RPL_USERS',
48
+  		394 => 'RPL_ENDOFUSERS', 395 => 'RPL_NOUSERS',
49
+  		401 => 'ERR_NOSUCHNICK', 402 => 'ERR_NOSUCHSERVER',
50
+  		403 => 'ERR_NOSUCHCHANNEL', 404 => 'ERR_CANNOTSENDTOCHAN',
51
+  		405 => 'ERR_TOOMANYCHANNELS', 406 => 'ERR_WASNOSUCHNICK',
52
+  		407 => 'ERR_TOOMANYTARGETS', 408 => 'ERR_NOSUCHSERVICE',
53
+  		409 => 'ERR_NOORIGIN', 411 => 'ERR_NORECIPIENT',
54
+  		412 => 'ERR_NOTEXTTOSEND', 413 => 'ERR_NOTOPLEVEL',
55
+  		414 => 'ERR_WILDTOPLEVEL', 415 => 'ERR_BADMASK',
56
+  		421 => 'ERR_UNKNOWNCOMMAND', 422 => 'ERR_NOMOTD',
57
+  		423 => 'ERR_NOADMININFO', 424 => 'ERR_FILEERROR',
58
+  		431 => 'ERR_NONICKNAMEGIVEN', 432 => 'ERR_ERRONEUSNICKNAME',
59
+  		433 => 'ERR_NICKNAMEINUSE', 436 => 'ERR_NICKCOLLISION',
60
+  		437 => 'ERR_UNAVAILRESOURCE', 441 => 'ERR_USERNOTINCHANNEL',
61
+  		442 => 'ERR_NOTONCHANNEL', 443 => 'ERR_USERONCHANNEL',
62
+  		444 => 'ERR_NOLOGIN', 445 => 'ERR_SUMMONDISABLED',
63
+  		446 => 'ERR_USERSDISABLED', 451 => 'ERR_NOTREGISTERED',
64
+  		461 => 'ERR_NEEDMOREPARAMS', 462 => 'ERR_ALREADYREGISTRED',
65
+		463 => 'ERR_NOPERMFORHOST', 464 => 'ERR_PASSWDMISMATCH',
66
+  		465 => 'ERR_YOUREBANNEDCREEP', 466 => 'ERR_YOUWILLBEBANNED',
67
+  		467 => 'ERR_KEYSET', 471 => 'ERR_CHANNELISFULL',
68
+  		472 => 'ERR_UNKNOWNMODE', 473 => 'ERR_INVITEONLYCHAN',
69
+  		474 => 'ERR_BANNEDFROMCHAN', 475 => 'ERR_BADCHANNELKEY',
70
+  		476 => 'ERR_BADCHANMASK', 477 => 'ERR_NOCHANMODES',
71
+  		478 => 'ERR_BANLISTFULL', 481 => 'ERR_NOPRIVILEGES',
72
+  		482 => 'ERR_CHANOPRIVSNEEDED', 483 => 'ERR_CANTKILLSERVER',
73
+  		484 => 'ERR_RESTRICTED', 485 => 'ERR_UNIQOPPRIVSNEEDED',
74
+  		491 => 'ERR_NOOPERHOST', 501 => 'ERR_UMODEUNKNOWNFLAG',
75 75
   		502 => 'ERR_USERSDONTMATCH',
76 76
 	);
77 77
   public static $codesFlip;
Please login to merge, or discard this patch.
lib/BoundTCPSocket.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
    					return;
95 95
    				}
96 96
    			}
97
-			$conn->addr = $host.':'.$port;
97
+			$conn->addr = $host . ':' . $port;
98 98
 			$conn->host = $host;
99 99
 			$conn->port = $port;
100 100
 			$conn->parentSocket = $socket;
Please login to merge, or discard this patch.
lib/AppResolver.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	
19 19
 		foreach (Daemon::$config as $fullname => $section) {
20 20
 		
21
-			if (!$section instanceof Daemon_ConfigSection)	{
21
+			if (!$section instanceof Daemon_ConfigSection) {
22 22
 				continue;
23 23
 			}
24 24
 			if (isset($section->limitinstances)) {
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 					||
30 30
 					(!isset($section->enable) && !isset($section->disable))
31 31
 			) {
32
-				if (strpos($fullname,':') === false) {
32
+				if (strpos($fullname, ':') === false) {
33 33
 					$fullname .= ':';
34 34
 				}
35 35
 				list($appName, $instance) = explode(':', $fullname, 2);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		else {
122 122
 			$appName = $defaultApp;
123 123
 		}
124
-		if (strpos($appName,'-') === false) {
124
+		if (strpos($appName, '-') === false) {
125 125
 			$appName .= '-';
126 126
 		}
127 127
 		list($app, $instance) = explode('-', $appName, 2);
Please login to merge, or discard this patch.
Braces   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,9 +116,7 @@
 block discarded – undo
116 116
 	public function getRequest($req, $upstream, $defaultApp = NULL) {
117 117
 		if (isset($req->attrs->server['APPNAME'])) {
118 118
 			$appName = $req->attrs->server['APPNAME'];
119
-		}
120
-		elseif (($appName = $this->getRequestRoute($req, $upstream)) !== NULL) {}
121
-		else {
119
+		} elseif (($appName = $this->getRequestRoute($req, $upstream)) !== NULL) {} else {
122 120
 			$appName = $defaultApp;
123 121
 		}
124 122
 		if (strpos($appName,'-') === false) {
Please login to merge, or discard this patch.
lib/Binary.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@
 block discarded – undo
23 23
 				return $domain . Binary::parseLabels($ref);
24 24
 			}
25 25
 
26
-     		$p = substr($data, 1, $l);
27
-     		$domain .= $p.(($l !== 0)?'.':'');
28
-     		$data = substr($data, $l + 1);
29
-       		if ($l === 0) {
30
-     			break;
31
-     		}
32
-    	}
33
-    	return $domain;
26
+	 		$p = substr($data, 1, $l);
27
+	 		$domain .= $p.(($l !== 0)?'.':'');
28
+	 		$data = substr($data, $l + 1);
29
+	   		if ($l === 0) {
30
+	 			break;
31
+	 		}
32
+		}
33
+		return $domain;
34 34
 	}
35 35
 	public static function LV($string, $len = 1, $lrev = FALSE) {
36 36
 		$l = self::i2b($len, strlen($string));
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 			}
25 25
 
26 26
      		$p = substr($data, 1, $l);
27
-     		$domain .= $p.(($l !== 0)?'.':'');
27
+     		$domain .= $p . (($l !== 0) ? '.' : '');
28 28
      		$data = substr($data, $l + 1);
29 29
        		if ($l === 0) {
30 30
      			break;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		return $l . $string;
41 41
 	}
42 42
 	public static function LVnull($string) {
43
-		return self::LV($string."\x00",2,TRUE);
43
+		return self::LV($string . "\x00", 2, TRUE);
44 44
 	}
45 45
 	public static function byte($int) {
46 46
 		return chr($int);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	public static function dword($int) {
58
-		return self::i2b(4,$int);
58
+		return self::i2b(4, $int);
59 59
 	}
60 60
 
61 61
 	public static function dwordl($int) {
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 	
85 85
 	public static function getWord(&$p, $l = false) {
86
-		$r = self::bytes2int(binarySubstr($p,0,2),!!$l);
87
-		$p = binarySubstr($p,2);
86
+		$r = self::bytes2int(binarySubstr($p, 0, 2), !!$l);
87
+		$p = binarySubstr($p, 2);
88 88
 		return intval($r);
89 89
 	}
90 90
 
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 		return $r;
98 98
 	}
99 99
 
100
-	public static function getDWord(&$p,$l = false) {
101
-		$r = self::bytes2int(binarySubstr($p,0,4),!!$l);
102
-		$p = binarySubstr($p,4);
100
+	public static function getDWord(&$p, $l = false) {
101
+		$r = self::bytes2int(binarySubstr($p, 0, 4), !!$l);
102
+		$p = binarySubstr($p, 4);
103 103
 		return intval($r);
104 104
 	}
105 105
 	public static function getQword(&$p, $l = false) {
106
-		$r = self::bytes2int(binarySubstr($p,0,8),!!$l);
107
-		$p = binarySubstr($p,8);
106
+		$r = self::bytes2int(binarySubstr($p, 0, 8), !!$l);
107
+		$p = binarySubstr($p, 8);
108 108
 		return intval($r);
109 109
 	}
110
-	public static function getStrQWord(&$p,$l = false) {
110
+	public static function getStrQWord(&$p, $l = false) {
111 111
 		$r = binarySubstr($p, 0, 8);
112 112
 		if ($l) {
113 113
 			$r = strrev($r);
@@ -116,31 +116,31 @@  discard block
 block discarded – undo
116 116
 		return $r;
117 117
 	}
118 118
 	public static function getString(&$str) {
119
-		$p = strpos($str,"\x00");
119
+		$p = strpos($str, "\x00");
120 120
 		if ($p === FALSE) {
121 121
 			return '';
122 122
 		}
123
- 		$r = substr($str,0,$p);
124
- 		$str = substr($str, $p+1);
123
+ 		$r = substr($str, 0, $p);
124
+ 		$str = substr($str, $p + 1);
125 125
  		return $r;
126 126
 	}
127 127
 	public static function getLV(&$p, $l = 1, $nul = false, $lrev = false) {
128
- 		$s = self::b2i(binarySubstr($p,0,$l),!!$lrev);
128
+ 		$s = self::b2i(binarySubstr($p, 0, $l), !!$lrev);
129 129
  		//Daemon::log('s = '.$s. ' -- '.Debug::exportBytes(binarySubstr($p,0,$l), true));
130
- 		$p = binarySubstr($p,$l);
130
+ 		$p = binarySubstr($p, $l);
131 131
 		if ($s == 0) {
132 132
 			return '';
133 133
 		}
134 134
 		$r = '';
135 135
  		if (strlen($p) < $s) {
136
- 			echo("getLV error: buf length (".strlen($p)."): ".Debug::exportBytes($p).", must be >= string length (".$s.")\n");
136
+ 			echo("getLV error: buf length (" . strlen($p) . "): " . Debug::exportBytes($p) . ", must be >= string length (" . $s . ")\n");
137 137
  		}
138 138
  		elseif ($nul) {
139
-  			if ($p{$s-1} != "\x00") {
140
-  				echo("getLV error: Wrong end of NUL-string (".Debug::exportBytes($p{$s-1})."), len ".$s."\n");
139
+  			if ($p{$s - 1} != "\x00") {
140
+  				echo("getLV error: Wrong end of NUL-string (" . Debug::exportBytes($p{$s - 1}) . "), len " . $s . "\n");
141 141
   			}
142 142
   			else {
143
-  				$d = $s-1;
143
+  				$d = $s - 1;
144 144
   				if ($d < 0) {
145 145
   					$d = 0;
146 146
   				}
@@ -155,30 +155,30 @@  discard block
 block discarded – undo
155 155
  		return $r;
156 156
 	}
157 157
 
158
-	public static function int2bytes($len,$int = 1) {
158
+	public static function int2bytes($len, $int = 1) {
159 159
  		$hexstr = dechex($int);
160 160
  		if ($len === NULL) {
161 161
  			if (strlen($hexstr) % 2) {
162
- 				$hexstr = "0".$hexstr;
162
+ 				$hexstr = "0" . $hexstr;
163 163
  			}
164 164
  		}
165 165
  		else {
166 166
  			$hexstr = str_repeat('0', $len * 2 - strlen($hexstr)) . $hexstr;
167 167
  		}
168
- 		$bytes = strlen($hexstr)/2;
168
+ 		$bytes = strlen($hexstr) / 2;
169 169
  		$bin = '';
170
- 		for($i = 0; $i < $bytes; ++$i) {
171
- 			$bin .= chr(hexdec(binarySubstr($hexstr,$i*2,2)));
170
+ 		for ($i = 0; $i < $bytes; ++$i) {
171
+ 			$bin .= chr(hexdec(binarySubstr($hexstr, $i * 2, 2)));
172 172
  		}
173 173
  		return $bin;
174 174
 	}
175 175
 	
176 176
 	public static function flags2bitarray($flags, $len = 4) {
177 177
 		$ret = 0;
178
-		foreach($flags as $v) {
178
+		foreach ($flags as $v) {
179 179
 			$ret |= $v;
180 180
 		}
181
-		return self::i2b($len,$ret);
181
+		return self::i2b($len, $ret);
182 182
 	}
183 183
 	public static function i2b($bytes, $val = 0) {
184 184
 		return self::int2bytes($bytes, $val);
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
  		}
191 191
  		$dec = 0;
192 192
  		$len = strlen($str);
193
- 		for($i = 0; $i < $len; ++$i) {
194
- 			$dec += ord(binarySubstr($str,$i,1))*pow(256,$len-$i-1);
193
+ 		for ($i = 0; $i < $len; ++$i) {
194
+ 			$dec += ord(binarySubstr($str, $i, 1)) * pow(256, $len - $i - 1);
195 195
  		}
196 196
  		return $dec;
197 197
 	}
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 
203 203
 	public static function bitmap2bytes($bitmap, $check_len = 0) {
204 204
  		$r = '';
205
- 		$bitmap = str_pad($bitmap,ceil(strlen($bitmap)/8)*8,'0',STR_PAD_LEFT);
206
- 		for ($i = 0, $n = strlen($bitmap)/8; $i < $n; ++$i) {
207
-  			$r .= chr((int) bindec(binarySubstr($bitmap,$i*8,8)));
205
+ 		$bitmap = str_pad($bitmap, ceil(strlen($bitmap) / 8) * 8, '0', STR_PAD_LEFT);
206
+ 		for ($i = 0, $n = strlen($bitmap) / 8; $i < $n; ++$i) {
207
+  			$r .= chr((int) bindec(binarySubstr($bitmap, $i * 8, 8)));
208 208
  		}
209 209
  		if ($check_len && (strlen($r) != $check_len)) {
210 210
  			echo "Warning! Bitmap incorrect.\n";
@@ -212,6 +212,6 @@  discard block
 block discarded – undo
212 212
  		return $r;
213 213
 	}
214 214
 	public static function getbitmap($byte) {
215
- 		return sprintf('%08b',$byte);
215
+ 		return sprintf('%08b', $byte);
216 216
 	}
217 217
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -134,12 +134,10 @@  discard block
 block discarded – undo
134 134
 		$r = '';
135 135
  		if (strlen($p) < $s) {
136 136
  			echo("getLV error: buf length (".strlen($p)."): ".Debug::exportBytes($p).", must be >= string length (".$s.")\n");
137
- 		}
138
- 		elseif ($nul) {
137
+ 		} elseif ($nul) {
139 138
   			if ($p{$s-1} != "\x00") {
140 139
   				echo("getLV error: Wrong end of NUL-string (".Debug::exportBytes($p{$s-1})."), len ".$s."\n");
141
-  			}
142
-  			else {
140
+  			} else {
143 141
   				$d = $s-1;
144 142
   				if ($d < 0) {
145 143
   					$d = 0;
@@ -147,8 +145,7 @@  discard block
 block discarded – undo
147 145
   				$r = binarySubstr($p, 0, $d);
148 146
   				$p = binarySubstr($p, $s);
149 147
   			}
150
- 		}
151
- 		else {
148
+ 		} else {
152 149
  			$r = binarySubstr($p, 0, $s);
153 150
  			$p = binarySubstr($p, $s);
154 151
  		}
@@ -161,8 +158,7 @@  discard block
 block discarded – undo
161 158
  			if (strlen($hexstr) % 2) {
162 159
  				$hexstr = "0".$hexstr;
163 160
  			}
164
- 		}
165
- 		else {
161
+ 		} else {
166 162
  			$hexstr = str_repeat('0', $len * 2 - strlen($hexstr)) . $hexstr;
167 163
  		}
168 164
  		$bytes = strlen($hexstr)/2;
Please login to merge, or discard this patch.