Test Failed
Push — master ( 68b8b4...8b6eb2 )
by Joe
16:28
created
src/Mysqli/Db.php 1 patch
Braces   +24 added lines, -48 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
 *
18 18
 * @access public
19 19
 */
20
-class Db extends Generic implements Db_Interface
21
-{
20
+class Db extends Generic implements Db_Interface {
22 21
     /**
23 22
     * @var string
24 23
     */
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
     * @param string $database the name of the database to use
34 33
     * @return void
35 34
     */
36
-    public function useDb($database)
37
-    {
35
+    public function useDb($database) {
38 36
         $this->selectDb($database);
39 37
     }
40 38
 
@@ -44,8 +42,7 @@  discard block
 block discarded – undo
44 42
     * @param string $database the name of the database to use
45 43
     * @return void
46 44
     */
47
-    public function selectDb($database)
48
-    {
45
+    public function selectDb($database) {
49 46
         $this->connect();
50 47
         mysqli_select_db($this->linkId, $database);
51 48
     }
@@ -60,8 +57,7 @@  discard block
 block discarded – undo
60 57
     * @param string $password
61 58
     * @return int|\mysqli
62 59
     */
63
-    public function connect($database = '', $host = '', $user = '', $password = '', $port = '')
64
-    {
60
+    public function connect($database = '', $host = '', $user = '', $password = '', $port = '') {
65 61
         /* Handle defaults */
66 62
         if ($database == '') {
67 63
             $database = $this->database;
@@ -109,8 +105,7 @@  discard block
 block discarded – undo
109 105
     * Db::disconnect()
110 106
     * @return bool
111 107
     */
112
-    public function disconnect()
113
-    {
108
+    public function disconnect() {
114 109
         $return = !is_int($this->linkId) && method_exists($this->linkId, 'close') ? $this->linkId->close() : false;
115 110
         $this->linkId = 0;
116 111
         return $return;
@@ -120,8 +115,7 @@  discard block
 block discarded – undo
120 115
     * @param $string
121 116
     * @return string
122 117
     */
123
-    public function real_escape($string = '')
124
-    {
118
+    public function real_escape($string = '') {
125 119
         if ((!is_resource($this->linkId) || $this->linkId == 0) && !$this->connect()) {
126 120
             return $this->escape($string);
127 121
         }
@@ -132,8 +126,7 @@  discard block
 block discarded – undo
132 126
     * discard the query result
133 127
     * @return void
134 128
     */
135
-    public function free()
136
-    {
129
+    public function free() {
137 130
         if (is_resource($this->queryId)) {
138 131
             @mysqli_free_result($this->queryId);
139 132
         }
@@ -151,8 +144,7 @@  discard block
 block discarded – undo
151 144
     * @param string $file optionally pass __FILE__ calling the query for logging
152 145
     * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only
153 146
     */
154
-    public function queryReturn($query, $line = '', $file = '')
155
-    {
147
+    public function queryReturn($query, $line = '', $file = '') {
156 148
         $this->query($query, $line, $file);
157 149
         if ($this->num_rows() == 0) {
158 150
             return false;
@@ -178,8 +170,7 @@  discard block
 block discarded – undo
178 170
     * @param string $file optionally pass __FILE__ calling the query for logging
179 171
     * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only
180 172
     */
181
-    public function qr($query, $line = '', $file = '')
182
-    {
173
+    public function qr($query, $line = '', $file = '') {
183 174
         return $this->queryReturn($query, $line, $file);
184 175
     }
185 176
 
@@ -191,8 +182,7 @@  discard block
 block discarded – undo
191 182
     * @param string $line
192 183
     * @param string $file
193 184
     */
194
-    public function prepare($query, $line = '', $file = '')
195
-    {
185
+    public function prepare($query, $line = '', $file = '') {
196 186
         if (!$this->connect()) {
197 187
             return 0;
198 188
         }
@@ -252,8 +242,7 @@  discard block
 block discarded – undo
252 242
     * @param bool $log
253 243
     * @return mixed 0 if no query or query id handler, safe to ignore this return
254 244
     */
255
-    public function query($queryString, $line = '', $file = '', $log = false)
256
-    {
245
+    public function query($queryString, $line = '', $file = '', $log = false) {
257 246
         /* No empty queries, please, since PHP4 chokes on them. */
258 247
         /* The empty query string is passed on from the constructor,
259 248
         * when calling the class without a query, e.g. in situations
@@ -345,8 +334,7 @@  discard block
 block discarded – undo
345 334
     /**
346 335
     * @return array|null|object
347 336
     */
348
-    public function fetchObject()
349
-    {
337
+    public function fetchObject() {
350 338
         $this->Record = @mysqli_fetch_object($this->queryId);
351 339
         return $this->Record;
352 340
     }
@@ -359,8 +347,7 @@  discard block
 block discarded – undo
359 347
     * @param mixed $resultType
360 348
     * @return bool
361 349
     */
362
-    public function next_record($resultType = MYSQLI_BOTH)
363
-    {
350
+    public function next_record($resultType = MYSQLI_BOTH) {
364 351
         if ($this->queryId === false) {
365 352
             $this->haltmsg('next_record called with no query pending.');
366 353
             return 0;
@@ -384,8 +371,7 @@  discard block
 block discarded – undo
384 371
     * @param integer $pos the row numbe starting at 0 to switch to
385 372
     * @return bool whetherit was successfu or not.
386 373
     */
387
-    public function seek($pos = 0)
388
-    {
374
+    public function seek($pos = 0) {
389 375
         $status = @mysqli_data_seek($this->queryId, $pos);
390 376
         if ($status) {
391 377
             $this->Row = $pos;
@@ -405,8 +391,7 @@  discard block
 block discarded – undo
405 391
     *
406 392
     * @return bool
407 393
     */
408
-    public function transactionBegin()
409
-    {
394
+    public function transactionBegin() {
410 395
         if (version_compare(PHP_VERSION, '5.5.0') < 0) {
411 396
             return true;
412 397
         }
@@ -421,8 +406,7 @@  discard block
 block discarded – undo
421 406
     *
422 407
     * @return bool
423 408
     */
424
-    public function transactionCommit()
425
-    {
409
+    public function transactionCommit() {
426 410
         if (version_compare(PHP_VERSION, '5.5.0') < 0 || $this->linkId === 0) {
427 411
             return true;
428 412
         }
@@ -434,8 +418,7 @@  discard block
 block discarded – undo
434 418
     *
435 419
     * @return bool
436 420
     */
437
-    public function transactionAbort()
438
-    {
421
+    public function transactionAbort() {
439 422
         if (version_compare(PHP_VERSION, '5.5.0') < 0 || $this->linkId === 0) {
440 423
             return true;
441 424
         }
@@ -451,8 +434,7 @@  discard block
 block discarded – undo
451 434
     * @param string $field
452 435
     * @return int|string
453 436
     */
454
-    public function getLastInsertId($table, $field)
455
-    {
437
+    public function getLastInsertId($table, $field) {
456 438
         if (!isset($table) || $table == '' || !isset($field) || $field == '') {
457 439
             return -1;
458 440
         }
@@ -468,8 +450,7 @@  discard block
 block discarded – undo
468 450
     * @param string $mode
469 451
     * @return bool|int|\mysqli_result
470 452
     */
471
-    public function lock($table, $mode = 'write')
472
-    {
453
+    public function lock($table, $mode = 'write') {
473 454
         $this->connect();
474 455
         $query = 'lock tables ';
475 456
         if (is_array($table)) {
@@ -497,8 +478,7 @@  discard block
 block discarded – undo
497 478
     * @param bool $haltOnError optional, defaults to TRUE, whether or not to halt on error
498 479
     * @return bool|int|\mysqli_result
499 480
     */
500
-    public function unlock($haltOnError = true)
501
-    {
481
+    public function unlock($haltOnError = true) {
502 482
         $this->connect();
503 483
 
504 484
         $res = @mysqli_query($this->linkId, 'unlock tables');
@@ -515,8 +495,7 @@  discard block
 block discarded – undo
515 495
     * Db::affectedRows()
516 496
     * @return int
517 497
     */
518
-    public function affectedRows()
519
-    {
498
+    public function affectedRows() {
520 499
         return @mysqli_affected_rows($this->linkId);
521 500
     }
522 501
 
@@ -524,8 +503,7 @@  discard block
 block discarded – undo
524 503
     * Db::num_rows()
525 504
     * @return int
526 505
     */
527
-    public function num_rows()
528
-    {
506
+    public function num_rows() {
529 507
         return @mysqli_num_rows($this->queryId);
530 508
     }
531 509
 
@@ -533,8 +511,7 @@  discard block
 block discarded – undo
533 511
     * Db::num_fields()
534 512
     * @return int
535 513
     */
536
-    public function num_fields()
537
-    {
514
+    public function num_fields() {
538 515
         return @mysqli_num_fields($this->queryId);
539 516
     }
540 517
 
@@ -543,8 +520,7 @@  discard block
 block discarded – undo
543 520
     *
544 521
     * @return array
545 522
     */
546
-    public function tableNames()
547
-    {
523
+    public function tableNames() {
548 524
         $return = [];
549 525
         $this->query('SHOW TABLES');
550 526
         $i = 0;
Please login to merge, or discard this patch.