@@ -12,7 +12,8 @@ |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | public function buildPacket() |
15 | - {} |
|
15 | + { |
|
16 | +} |
|
16 | 17 | |
17 | 18 | public function getSql() |
18 | 19 | { |
@@ -20,5 +20,6 @@ |
||
20 | 20 | * @inheritDoc |
21 | 21 | */ |
22 | 22 | public function buildPacket() |
23 | - {} |
|
23 | + { |
|
24 | +} |
|
24 | 25 | } |
@@ -20,7 +20,8 @@ |
||
20 | 20 | * @inheritDoc |
21 | 21 | */ |
22 | 22 | public function buildPacket() |
23 | - {} |
|
23 | + { |
|
24 | +} |
|
24 | 25 | |
25 | 26 | /** |
26 | 27 | * @override |
@@ -43,5 +43,6 @@ |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function buildPacket() |
46 | - {} |
|
46 | + { |
|
47 | +} |
|
47 | 48 | } |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | { |
21 | 21 | $r .= chr(strlen($e[$i])) . $e[$i]; |
22 | 22 | } |
23 | - if (static::binarySubstr($r, -1) !== "\x00") { |
|
23 | + if (static::binarySubstr($r, -1) !== "\x00") |
|
24 | + { |
|
24 | 25 | $r .= "\x00"; |
25 | 26 | } |
26 | 27 | return $r; |
@@ -40,7 +41,8 @@ discard block |
||
40 | 41 | { |
41 | 42 | $l = ord($data[0]); |
42 | 43 | |
43 | - if ($l >= 192) { |
|
44 | + if ($l >= 192) |
|
45 | + { |
|
44 | 46 | $pos = static::bytes2int(chr($l - 192) . static::binarySubstr($data, 1, 1)); |
45 | 47 | $data = static::binarySubstr($data, 2); |
46 | 48 | $ref = static::binarySubstr($orig, $pos); |
@@ -51,7 +53,8 @@ discard block |
||
51 | 53 | $p = substr($data, 1, $l); |
52 | 54 | $str .= $p . (($l !== 0) ? '.' : ''); |
53 | 55 | $data = substr($data, $l + 1); |
54 | - if ($l === 0) { |
|
56 | + if ($l === 0) |
|
57 | + { |
|
55 | 58 | break; |
56 | 59 | } |
57 | 60 | } |
@@ -68,7 +71,8 @@ discard block |
||
68 | 71 | public static function LV($str, $len = 1, $lrev = false) |
69 | 72 | { |
70 | 73 | $l = static::i2b($len, strlen($str)); |
71 | - if ($lrev) { |
|
74 | + if ($lrev) |
|
75 | + { |
|
72 | 76 | $l = strrev($l); |
73 | 77 | } |
74 | 78 | return $l . $str; |
@@ -216,7 +220,8 @@ discard block |
||
216 | 220 | { |
217 | 221 | $r = static::binarySubstr($p, 0, 2); |
218 | 222 | $p = static::binarySubstr($p, 2); |
219 | - if ($l) { |
|
223 | + if ($l) |
|
224 | + { |
|
220 | 225 | $r = strrev($r); |
221 | 226 | } |
222 | 227 | return $r; |
@@ -262,7 +267,8 @@ discard block |
||
262 | 267 | public static function getStrQWord(&$p, $l = false) |
263 | 268 | { |
264 | 269 | $r = static::binarySubstr($p, 0, 8); |
265 | - if ($l) { |
|
270 | + if ($l) |
|
271 | + { |
|
266 | 272 | $r = strrev($r); |
267 | 273 | } |
268 | 274 | $p = static::binarySubstr($p, 8); |
@@ -279,7 +285,8 @@ discard block |
||
279 | 285 | public static function getString(&$str) |
280 | 286 | { |
281 | 287 | $p = strpos($str, "\x00"); |
282 | - if ($p === false) { |
|
288 | + if ($p === false) |
|
289 | + { |
|
283 | 290 | return ''; |
284 | 291 | } |
285 | 292 | $r = static::binarySubstr($str, 0, $p); |
@@ -302,19 +309,26 @@ discard block |
||
302 | 309 | $s = static::b2i(static::binarySubstr($p, 0, $l), !!$lrev); |
303 | 310 | $p = static::binarySubstr($p, $l); |
304 | 311 | |
305 | - if ($s == 0) { |
|
312 | + if ($s == 0) |
|
313 | + { |
|
306 | 314 | return ''; |
307 | 315 | } |
308 | 316 | |
309 | 317 | $r = ''; |
310 | 318 | |
311 | - if (strlen($p) < $s) { |
|
319 | + if (strlen($p) < $s) |
|
320 | + { |
|
312 | 321 | echo("getLV error: buf length (" . strlen($p) . "): " . Debug::exportBytes($p) . ", must be >= string length (" . $s . ")\n"); |
313 | 322 | |
314 | - } else if ($nul) { |
|
315 | - if ($p{$s - 1} != "\x00") { |
|
323 | + } |
|
324 | + else if ($nul) |
|
325 | + { |
|
326 | + if ($p{$s - 1} != "\x00") |
|
327 | + { |
|
316 | 328 | echo("getLV error: Wrong end of NUL-string (" . Debug::exportBytes($p{$s - 1}) . "), len " . $s . "\n"); |
317 | - } else { |
|
329 | + } |
|
330 | + else |
|
331 | + { |
|
318 | 332 | $d = $s - 1; |
319 | 333 | if ($d < 0) |
320 | 334 | { |
@@ -324,7 +338,9 @@ discard block |
||
324 | 338 | $p = static::binarySubstr($p, $s); |
325 | 339 | } |
326 | 340 | |
327 | - } else { |
|
341 | + } |
|
342 | + else |
|
343 | + { |
|
328 | 344 | $r = static::binarySubstr($p, 0, $s); |
329 | 345 | $p = static::binarySubstr($p, $s); |
330 | 346 | } |
@@ -344,11 +360,15 @@ discard block |
||
344 | 360 | { |
345 | 361 | $hexstr = dechex($int); |
346 | 362 | |
347 | - if ($len === null) { |
|
348 | - if (strlen($hexstr) % 2) { |
|
363 | + if ($len === null) |
|
364 | + { |
|
365 | + if (strlen($hexstr) % 2) |
|
366 | + { |
|
349 | 367 | $hexstr = "0" . $hexstr; |
350 | 368 | } |
351 | - } else { |
|
369 | + } |
|
370 | + else |
|
371 | + { |
|
352 | 372 | $hexstr = str_repeat('0', $len * 2 - strlen($hexstr)) . $hexstr; |
353 | 373 | } |
354 | 374 | |
@@ -397,7 +417,8 @@ discard block |
||
397 | 417 | */ |
398 | 418 | public static function bytes2int($str, $l = false) |
399 | 419 | { |
400 | - if ($l) { |
|
420 | + if ($l) |
|
421 | + { |
|
401 | 422 | $str = strrev($str); |
402 | 423 | } |
403 | 424 | |
@@ -437,7 +458,8 @@ discard block |
||
437 | 458 | { |
438 | 459 | $r .= chr((int) bindec(static::binarySubstr($bitmap, $i * 8, 8))); |
439 | 460 | } |
440 | - if ($checkLen && (strlen($r) != $checkLen)) { |
|
461 | + if ($checkLen && (strlen($r) != $checkLen)) |
|
462 | + { |
|
441 | 463 | throw new Exception('Warning! Bitmap incorrect.'); |
442 | 464 | } |
443 | 465 | |
@@ -465,13 +487,17 @@ discard block |
||
465 | 487 | */ |
466 | 488 | protected static function binarySubstr($s, $p, $len = null) |
467 | 489 | { |
468 | - if ($len === null) { |
|
490 | + if ($len === null) |
|
491 | + { |
|
469 | 492 | $ret = substr($s, $p); |
470 | - } else { |
|
493 | + } |
|
494 | + else |
|
495 | + { |
|
471 | 496 | $ret = substr($s, $p, $len); |
472 | 497 | } |
473 | 498 | |
474 | - if ($ret === false) { |
|
499 | + if ($ret === false) |
|
500 | + { |
|
475 | 501 | $ret = ''; |
476 | 502 | } |
477 | 503 |
@@ -89,7 +89,8 @@ |
||
89 | 89 | break; |
90 | 90 | case 'array': |
91 | 91 | $nvalue = []; |
92 | - foreach ($value as $v) { |
|
92 | + foreach ($value as $v) |
|
93 | + { |
|
93 | 94 | $nvalue[] = $this->resolveValueForSql($v); |
94 | 95 | } |
95 | 96 | $value = implode(',', $nvalue); |