@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | if ($type === null) { |
24 | 24 | $type = 'STRING'; |
25 | 25 | } |
26 | - $frametype = @constant($a = get_class($this) .'::' . $type) ; |
|
26 | + $frametype = @constant($a = get_class($this) . '::' . $type); |
|
27 | 27 | if ($frametype === null) { |
28 | - Daemon::log(__METHOD__ . ' : Undefined frametype "' . $type . '"') ; |
|
28 | + Daemon::log(__METHOD__ . ' : Undefined frametype "' . $type . '"'); |
|
29 | 29 | } |
30 | - return $frametype ; |
|
30 | + return $frametype; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function onHandshake() { |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | public function sendFrame($data, $type) { |
38 | - $this->connection->write($this->encodeFrame($data, $type)) ; |
|
38 | + $this->connection->write($this->encodeFrame($data, $type)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function onRead() { |
42 | - $this->connection->buf = "" ; |
|
42 | + $this->connection->buf = ""; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -92,9 +92,9 @@ |
||
92 | 92 | ) { |
93 | 93 | continue; |
94 | 94 | } |
95 | - $ev = Event::signal($this->eventBase, $no, array($this,'eventSighandler'), array($no)); |
|
95 | + $ev = Event::signal($this->eventBase, $no, array($this, 'eventSighandler'), array($no)); |
|
96 | 96 | if (!$ev) { |
97 | - $this->log('Cannot event_set for '.$name.' signal'); |
|
97 | + $this->log('Cannot event_set for ' . $name . ' signal'); |
|
98 | 98 | } |
99 | 99 | $ev->add(); |
100 | 100 | $this->sigEvents[$no] = $ev; |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | class HTTPServerConnection extends Connection { |
11 | - protected $initialLowMark = 1; // initial value of the minimal amout of bytes in buffer |
|
12 | - protected $initialHighMark = 0xFFFFFF; // initial value of the maximum amout of bytes in buffer |
|
11 | + protected $initialLowMark = 1; // initial value of the minimal amout of bytes in buffer |
|
12 | + protected $initialHighMark = 0xFFFFFF; // initial value of the maximum amout of bytes in buffer |
|
13 | 13 | public $timeout = 45; |
14 | 14 | |
15 | 15 | public $req; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } else { |
80 | 80 | if (!$this->req) { |
81 | 81 | if ($buf !== '') { |
82 | - Daemon::log('Unexpected input (HTTP request): '.Debug::dump($buf)); |
|
82 | + Daemon::log('Unexpected input (HTTP request): ' . Debug::dump($buf)); |
|
83 | 83 | } |
84 | 84 | return; |
85 | 85 | } |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | if ($req instanceof stdClass) { |
158 | 158 | $this->endRequest($req, 0, 0); |
159 | 159 | } else { |
160 | - if ($this->pool->config->sendfile->value && (!$this->pool->config->sendfileonlybycommand->value || isset($req->attrs->server['USE_SENDFILE'])) |
|
160 | + if ($this->pool->config->sendfile->value && (!$this->pool->config->sendfileonlybycommand->value || isset($req->attrs->server['USE_SENDFILE'])) |
|
161 | 161 | && !isset($req->attrs->server['DONT_USE_SENDFILE']) |
162 | 162 | ) { |
163 | 163 | $fn = FS::tempnam($this->pool->config->sendfiledir->value, $this->pool->config->sendfileprefix->value); |
164 | - FS::open($fn, 'wb', function ($file) use ($req) { |
|
164 | + FS::open($fn, 'wb', function($file) use ($req) { |
|
165 | 165 | $req->sendfp = $file; |
166 | 166 | }); |
167 | 167 | $req->header('X-Sendfile: ' . $fn); |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | * @author Zorin Vasily <[email protected]> |
8 | 8 | */ |
9 | 9 | class FastCGIServerConnection extends Connection { |
10 | - protected $lowMark = 8; // initial value of the minimal amout of bytes in buffer |
|
11 | - protected $highMark = 0xFFFFFF; // initial value of the maximum amout of bytes in buffer |
|
10 | + protected $lowMark = 8; // initial value of the minimal amout of bytes in buffer |
|
11 | + protected $highMark = 0xFFFFFF; // initial value of the maximum amout of bytes in buffer |
|
12 | 12 | public $timeout = 180; |
13 | 13 | |
14 | 14 | protected $requests = array(); |
@@ -117,8 +117,7 @@ discard block |
||
117 | 117 | . ' (' . strlen($pad) . ')'); |
118 | 118 | |
119 | 119 | |
120 | - if ($type == self::FCGI_BEGIN_REQUEST) { |
|
121 | - ++Daemon::$process->reqCounter; |
|
120 | + if ($type == self::FCGI_BEGIN_REQUEST) {++Daemon::$process->reqCounter; |
|
122 | 121 | $u = unpack('nrole/Cflags', $this->content); |
123 | 122 | |
124 | 123 | $req = new stdClass(); |
@@ -130,7 +129,7 @@ discard block |
||
130 | 129 | $req->attrs->server = array(); |
131 | 130 | $req->attrs->files = array(); |
132 | 131 | $req->attrs->session = null; |
133 | - $req->attrs->role = self::$roles[$u['role']]; |
|
132 | + $req->attrs->role = self::$roles[$u['role']]; |
|
134 | 133 | $req->attrs->flags = $u['flags']; |
135 | 134 | $req->attrs->id = $this->header['reqid']; |
136 | 135 | $req->attrs->params_done = false; |
@@ -264,7 +263,7 @@ discard block |
||
264 | 263 | */ |
265 | 264 | // string bytes counter |
266 | 265 | $d = 0; |
267 | - while($d < $outlen){ |
|
266 | + while ($d < $outlen) { |
|
268 | 267 | |
269 | 268 | $ord_var_c = ord($output{$d}); |
270 | 269 | |
@@ -277,31 +276,31 @@ discard block |
||
277 | 276 | case (($ord_var_c & 0xE0) == 0xC0): |
278 | 277 | // characters U-00000080 - U-000007FF, mask 110XXXXX |
279 | 278 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
280 | - $d+=2; |
|
279 | + $d += 2; |
|
281 | 280 | break; |
282 | 281 | |
283 | 282 | case (($ord_var_c & 0xF0) == 0xE0): |
284 | 283 | // characters U-00000800 - U-0000FFFF, mask 1110XXXX |
285 | 284 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
286 | - $d+=3; |
|
285 | + $d += 3; |
|
287 | 286 | break; |
288 | 287 | |
289 | 288 | case (($ord_var_c & 0xF8) == 0xF0): |
290 | 289 | // characters U-00010000 - U-001FFFFF, mask 11110XXX |
291 | 290 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
292 | - $d+=4; |
|
291 | + $d += 4; |
|
293 | 292 | break; |
294 | 293 | |
295 | 294 | case (($ord_var_c & 0xFC) == 0xF8): |
296 | 295 | // characters U-00200000 - U-03FFFFFF, mask 111110XX |
297 | 296 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
298 | - $d+=5; |
|
297 | + $d += 5; |
|
299 | 298 | break; |
300 | 299 | |
301 | 300 | case (($ord_var_c & 0xFE) == 0xFC): |
302 | 301 | // characters U-04000000 - U-7FFFFFFF, mask 1111110X |
303 | 302 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
304 | - $d+=6; |
|
303 | + $d += 6; |
|
305 | 304 | break; |
306 | 305 | default: |
307 | 306 | $d++; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | "\xc5\xb8" => "\x9f" |
115 | 115 | ); |
116 | 116 | |
117 | - static function toUTF8($text){ |
|
117 | + static function toUTF8($text) { |
|
118 | 118 | /** |
119 | 119 | * Function Encoding::toUTF8 |
120 | 120 | * |
@@ -140,25 +140,25 @@ discard block |
||
140 | 140 | * |
141 | 141 | */ |
142 | 142 | |
143 | - if(is_array($text)) |
|
143 | + if (is_array($text)) |
|
144 | 144 | { |
145 | - foreach($text as $k => $v) |
|
145 | + foreach ($text as $k => $v) |
|
146 | 146 | { |
147 | 147 | $text[$k] = self::toUTF8($v); |
148 | 148 | } |
149 | 149 | return $text; |
150 | - } elseif(is_string($text)) { |
|
150 | + } elseif (is_string($text)) { |
|
151 | 151 | |
152 | 152 | $max = strlen($text); |
153 | 153 | $buf = ""; |
154 | - for($i = 0; $i < $max; $i++){ |
|
154 | + for ($i = 0; $i < $max; $i++) { |
|
155 | 155 | $c1 = $text{$i}; |
156 | - if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already |
|
157 | - $c2 = $i+1 >= $max? "\x00" : $text{$i+1}; |
|
158 | - $c3 = $i+2 >= $max? "\x00" : $text{$i+2}; |
|
159 | - $c4 = $i+3 >= $max? "\x00" : $text{$i+3}; |
|
160 | - if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8 |
|
161 | - if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already |
|
156 | + if ($c1 >= "\xc0") { //Should be converted to UTF8, if it's not UTF8 already |
|
157 | + $c2 = $i + 1 >= $max ? "\x00" : $text{$i + 1}; |
|
158 | + $c3 = $i + 2 >= $max ? "\x00" : $text{$i + 2}; |
|
159 | + $c4 = $i + 3 >= $max ? "\x00" : $text{$i + 3}; |
|
160 | + if ($c1 >= "\xc0" & $c1 <= "\xdf") { //looks like 2 bytes UTF8 |
|
161 | + if ($c2 >= "\x80" && $c2 <= "\xbf") { //yeah, almost sure it's UTF8 already |
|
162 | 162 | $buf .= $c1 . $c2; |
163 | 163 | $i++; |
164 | 164 | } else { //not valid UTF8. Convert it. |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | $cc2 = ($c1 & "\x3f") | "\x80"; |
167 | 167 | $buf .= $cc1 . $cc2; |
168 | 168 | } |
169 | - } elseif($c1 >= "\xe0" & $c1 <= "\xef"){ //looks like 3 bytes UTF8 |
|
170 | - if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf"){ //yeah, almost sure it's UTF8 already |
|
169 | + } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { //looks like 3 bytes UTF8 |
|
170 | + if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { //yeah, almost sure it's UTF8 already |
|
171 | 171 | $buf .= $c1 . $c2 . $c3; |
172 | 172 | $i = $i + 2; |
173 | 173 | } else { //not valid UTF8. Convert it. |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | $cc2 = ($c1 & "\x3f") | "\x80"; |
176 | 176 | $buf .= $cc1 . $cc2; |
177 | 177 | } |
178 | - } elseif($c1 >= "\xf0" & $c1 <= "\xf7"){ //looks like 4 bytes UTF8 |
|
179 | - if($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf"){ //yeah, almost sure it's UTF8 already |
|
178 | + } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { //looks like 4 bytes UTF8 |
|
179 | + if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { //yeah, almost sure it's UTF8 already |
|
180 | 180 | $buf .= $c1 . $c2 . $c3; |
181 | 181 | $i = $i + 2; |
182 | 182 | } else { //not valid UTF8. Convert it. |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | $cc2 = (($c1 & "\x3f") | "\x80"); |
190 | 190 | $buf .= $cc1 . $cc2; |
191 | 191 | } |
192 | - } elseif(($c1 & "\xc0") == "\x80"){ // needs conversion |
|
193 | - if(isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases |
|
192 | + } elseif (($c1 & "\xc0") == "\x80") { // needs conversion |
|
193 | + if (isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases |
|
194 | 194 | $buf .= self::$win1252ToUtf8[ord($c1)]; |
195 | 195 | } else { |
196 | 196 | $cc1 = (chr(ord($c1) / 64) | "\xc0"); |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | static function toWin1252($text) { |
211 | - if(is_array($text)) { |
|
212 | - foreach($text as $k => $v) { |
|
211 | + if (is_array($text)) { |
|
212 | + foreach ($text as $k => $v) { |
|
213 | 213 | $text[$k] = self::toWin1252($v); |
214 | 214 | } |
215 | 215 | return $text; |
216 | - } elseif(is_string($text)) { |
|
216 | + } elseif (is_string($text)) { |
|
217 | 217 | return utf8_decode(str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text))); |
218 | 218 | } else { |
219 | 219 | return $text; |
@@ -228,16 +228,16 @@ discard block |
||
228 | 228 | return self::toWin1252($text); |
229 | 229 | } |
230 | 230 | |
231 | - static function fixUTF8($text){ |
|
232 | - if(is_array($text)) { |
|
233 | - foreach($text as $k => $v) { |
|
231 | + static function fixUTF8($text) { |
|
232 | + if (is_array($text)) { |
|
233 | + foreach ($text as $k => $v) { |
|
234 | 234 | $text[$k] = self::fixUTF8($v); |
235 | 235 | } |
236 | 236 | return $text; |
237 | 237 | } |
238 | 238 | |
239 | 239 | $last = ""; |
240 | - while($last <> $text){ |
|
240 | + while ($last <> $text) { |
|
241 | 241 | $last = $text; |
242 | 242 | $text = self::toUTF8(utf8_decode(str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), $text))); |
243 | 243 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | return $text; |
246 | 246 | } |
247 | 247 | |
248 | - static function UTF8FixWin1252Chars($text){ |
|
248 | + static function UTF8FixWin1252Chars($text) { |
|
249 | 249 | // If you received an UTF-8 string that was converted from Windows-1252 as it was ISO8859-1 |
250 | 250 | // (ignoring Windows-1252 chars from 80 to 9F) use this function to fix it. |
251 | 251 | // See: http://en.wikipedia.org/wiki/Windows-1252 |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text); |
254 | 254 | } |
255 | 255 | |
256 | - static function removeBOM($str=""){ |
|
257 | - if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) { |
|
258 | - $str=substr($str, 3); |
|
256 | + static function removeBOM($str = "") { |
|
257 | + if (substr($str, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) { |
|
258 | + $str = substr($str, 3); |
|
259 | 259 | } |
260 | 260 | return $str; |
261 | 261 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return void |
152 | 152 | */ |
153 | 153 | public function prepareSystemEnv() { |
154 | - register_shutdown_function(array($this,'onShutdown')); |
|
154 | + register_shutdown_function(array($this, 'onShutdown')); |
|
155 | 155 | posix_setsid(); |
156 | 156 | proc_nice(Daemon::$config->masterpriority->value); |
157 | 157 | if (!Daemon::$config->verbosetty->value) { |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $this->shutdown = true; |
292 | 292 | $this->waitAll(true); |
293 | 293 | Daemon::$shm_wstate->delete(); |
294 | - file_put_contents(Daemon::$config->pidfile->value,''); |
|
294 | + file_put_contents(Daemon::$config->pidfile->value, ''); |
|
295 | 295 | exit(0); |
296 | 296 | } |
297 | 297 |
@@ -1,28 +1,28 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | class MySQLClientConnection extends NetworkClientConnection { |
3 | 3 | |
4 | - public $url; // Connection's URL. |
|
5 | - public $seq = 0; // Pointer of packet sequence. |
|
6 | - public $clientFlags = 239237; // Flags of this MySQL client. |
|
7 | - public $maxPacketSize = 0x1000000; // Maximum packet size. |
|
8 | - public $charsetNumber = 0x21; // Charset number. |
|
9 | - public $path = ''; // Default database name. |
|
10 | - public $user = 'root'; // Username |
|
11 | - public $password = ''; // Password |
|
12 | - public $state = 0; // Connection's state. 0 - start, 1 - got initial packet, 2 - auth. packet sent, 3 - auth. error, 4 - handshaked OK |
|
4 | + public $url; // Connection's URL. |
|
5 | + public $seq = 0; // Pointer of packet sequence. |
|
6 | + public $clientFlags = 239237; // Flags of this MySQL client. |
|
7 | + public $maxPacketSize = 0x1000000; // Maximum packet size. |
|
8 | + public $charsetNumber = 0x21; // Charset number. |
|
9 | + public $path = ''; // Default database name. |
|
10 | + public $user = 'root'; // Username |
|
11 | + public $password = ''; // Password |
|
12 | + public $state = 0; // Connection's state. 0 - start, 1 - got initial packet, 2 - auth. packet sent, 3 - auth. error, 4 - handshaked OK |
|
13 | 13 | const STATE_GOT_INIT = 1; |
14 | 14 | const STATE_AUTH_SENT = 2; |
15 | 15 | const STATE_AUTH_ERR = 3; |
16 | 16 | const STATE_HANDSHAKED = 4; |
17 | - public $instate = 0; // State of pointer of incoming data. 0 - Result Set Header Packet, 1 - Field Packet, 2 - Row Packet |
|
17 | + public $instate = 0; // State of pointer of incoming data. 0 - Result Set Header Packet, 1 - Field Packet, 2 - Row Packet |
|
18 | 18 | const INSTATE_HEADER = 0; |
19 | 19 | const INSTATE_FIELD = 1; |
20 | 20 | const INSTATE_ROW = 2; |
21 | - public $resultRows = array(); // Resulting rows |
|
22 | - public $resultFields = array(); // Resulting fields |
|
23 | - public $context; // Property holds a reference to user's object |
|
24 | - public $insertId; // INSERT_ID() |
|
25 | - public $affectedRows; // Affected rows number |
|
21 | + public $resultRows = array(); // Resulting rows |
|
22 | + public $resultFields = array(); // Resulting fields |
|
23 | + public $context; // Property holds a reference to user's object |
|
24 | + public $insertId; // INSERT_ID() |
|
25 | + public $affectedRows; // Affected rows number |
|
26 | 26 | public $protover = 0; |
27 | 27 | public $timeout = 120; |
28 | 28 | public $errno = 0; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $dec = 0; |
71 | 71 | $len = strlen($str); |
72 | 72 | |
73 | - for($i = 0; $i < $len; ++$i) { |
|
73 | + for ($i = 0; $i < $len; ++$i) { |
|
74 | 74 | $dec += ord(binarySubstr($str, $i, 1)) * pow(0x100, $len - $i - 1); |
75 | 75 | } |
76 | 76 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | if ($len === NULL) { |
91 | 91 | if (strlen($hexstr) % 2) { |
92 | - $hexstr = "0".$hexstr; |
|
92 | + $hexstr = "0" . $hexstr; |
|
93 | 93 | } |
94 | 94 | } else { |
95 | 95 | $hexstr = str_repeat('0', $len * 2 - strlen($hexstr)) . $hexstr; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $bytes = strlen($hexstr) / 2; |
99 | 99 | $bin = ''; |
100 | 100 | |
101 | - for($i = 0; $i < $bytes; ++$i) { |
|
101 | + for ($i = 0; $i < $bytes; ++$i) { |
|
102 | 102 | $bin .= chr(hexdec(substr($hexstr, $i * 2, 2))); |
103 | 103 | } |
104 | 104 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function sendPacket($packet) { |
114 | 114 | //Daemon::log('Client --> Server: ' . Debug::exportBytes($packet) . "\n\n"); |
115 | - return $this->write($this->int2bytes(3, strlen($packet)) . chr($this->seq++) . $packet);; |
|
115 | + return $this->write($this->int2bytes(3, strlen($packet)) . chr($this->seq++) . $packet); ; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | $o = $p; |
181 | - $p =+ 8; |
|
181 | + $p = + 8; |
|
182 | 182 | |
183 | 183 | return $this->bytes2int(binarySubstr($s, $o, 8)); |
184 | 184 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @param integer Reference to pointer |
190 | 190 | * @return integer Result |
191 | 191 | */ |
192 | - public function parseEncodedString(&$s,&$p) { |
|
192 | + public function parseEncodedString(&$s, &$p) { |
|
193 | 193 | $l = $this->parseEncodedBinary($s, $p); |
194 | 194 | |
195 | 195 | if ( |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | $this->onResponse->push($callback); |
297 | 297 | $this->seq = 0; |
298 | - $this->sendPacket(chr($cmd).$q); |
|
298 | + $this->sendPacket(chr($cmd) . $q); |
|
299 | 299 | |
300 | 300 | return TRUE; |
301 | 301 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | |
396 | 396 | $this->errno = $u[1]; |
397 | 397 | $state = binarySubstr($this->buf, $p, 6); |
398 | - $p =+ 6; |
|
398 | + $p = + 6; |
|
399 | 399 | |
400 | 400 | $this->errmsg = binarySubstr($this->buf, $p, $packet[0] + 4 - $p); |
401 | 401 | $this->onError(); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | $this->serverStatus = $u[1]; |
423 | 423 | |
424 | - $u = unpack('v',binarySubstr($this->buf, $p, 2)); |
|
424 | + $u = unpack('v', binarySubstr($this->buf, $p, 2)); |
|
425 | 425 | $p += 2; |
426 | 426 | |
427 | 427 | $this->warnCount = $u[1]; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | // Row Packet |
484 | 484 | $row = array(); |
485 | 485 | |
486 | - for ($i = 0,$nf = sizeof($this->resultFields); $i < $nf; ++$i) { |
|
486 | + for ($i = 0, $nf = sizeof($this->resultFields); $i < $nf; ++$i) { |
|
487 | 487 | $row[$this->resultFields[$i]['name']] = $this->parseEncodedString($this->buf, $p); |
488 | 488 | } |
489 | 489 |
@@ -53,7 +53,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -1,10 +1,10 @@ discard block |
||
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 |
||
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]) |