Test Failed
Push — master ( e35e3f...92cb25 )
by Joe
13:20
created
src/Generic.php 1 patch
Braces   +20 added lines, -40 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Class Generic
14 14
  */
15
-abstract class Generic
16
-{
15
+abstract class Generic {
17 16
     /* public: connection parameters */
18 17
     public $host = 'localhost';
19 18
     public $database = '';
@@ -71,8 +70,7 @@  discard block
 block discarded – undo
71 70
      * @param string $query Optional query to perform immediately
72 71
      * @param string $port optional port for the connection
73 72
      */
74
-    public function __construct($database = '', $user = '', $password = '', $host = 'localhost', $query = '', $port = '')
75
-    {
73
+    public function __construct($database = '', $user = '', $password = '', $host = 'localhost', $query = '', $port = '') {
76 74
         $this->database = $database;
77 75
         $this->user = $user;
78 76
         $this->password = $password;
@@ -90,24 +88,21 @@  discard block
 block discarded – undo
90 88
      * @param string $file
91 89
      * @return void
92 90
      */
93
-    public function log($message, $line = '', $file = '', $level = 'info')
94
-    {
91
+    public function log($message, $line = '', $file = '', $level = 'info') {
95 92
         error_log($message);
96 93
     }
97 94
 
98 95
     /**
99 96
      * @return int|object
100 97
      */
101
-    public function linkId()
102
-    {
98
+    public function linkId() {
103 99
         return $this->linkId;
104 100
     }
105 101
 
106 102
     /**
107 103
      * @return int|object
108 104
      */
109
-    public function queryId()
110
-    {
105
+    public function queryId() {
111 106
         return $this->queryId;
112 107
     }
113 108
 
@@ -115,8 +110,7 @@  discard block
 block discarded – undo
115 110
      * @param $string
116 111
      * @return string
117 112
      */
118
-    public function real_escape($string = '')
119
-    {
113
+    public function real_escape($string = '') {
120 114
         if ((!is_resource($this->linkId) || $this->linkId == 0) && !$this->connect()) {
121 115
             return $this->escape($string);
122 116
         }
@@ -127,8 +121,7 @@  discard block
 block discarded – undo
127 121
      * @param $string
128 122
      * @return string
129 123
      */
130
-    public function escape($string = '')
131
-    {
124
+    public function escape($string = '') {
132 125
         //if (function_exists('mysql_escape_string'))
133 126
         //return mysql_escape_string($string);
134 127
         return str_replace(['\\', "\0", "\n", "\r", "'", '"', "\x1a"], ['\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'], $string);
@@ -138,8 +131,7 @@  discard block
 block discarded – undo
138 131
      * @param mixed $str
139 132
      * @return string
140 133
      */
141
-    public function dbAddslashes($str = '')
142
-    {
134
+    public function dbAddslashes($str = '') {
143 135
         if (!isset($str) || $str == '') {
144 136
             return '';
145 137
         }
@@ -151,8 +143,7 @@  discard block
 block discarded – undo
151 143
      * @param mixed $epoch
152 144
      * @return bool|string
153 145
      */
154
-    public function toTimestamp($epoch)
155
-    {
146
+    public function toTimestamp($epoch) {
156 147
         return date('Y-m-d H:i:s', is_float($epoch) ? intval($epoch) : $epoch);
157 148
     }
158 149
 
@@ -161,8 +152,7 @@  discard block
 block discarded – undo
161 152
      * @param mixed $timestamp
162 153
      * @return bool|int|mixed
163 154
      */
164
-    public function fromTimestamp($timestamp)
165
-    {
155
+    public function fromTimestamp($timestamp) {
166 156
         if (preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/', $timestamp, $parts)) {
167 157
             $time = mktime($parts[4], $parts[5], $parts[6], $parts[2], $parts[3], $parts[1]);
168 158
         } elseif (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $timestamp, $parts)) {
@@ -188,8 +178,7 @@  discard block
 block discarded – undo
188 178
      * @param string $file
189 179
      * @return mixed
190 180
      */
191
-    public function limitQuery($queryString, $numRows = '', $offset = 0, $line = '', $file = '')
192
-    {
181
+    public function limitQuery($queryString, $numRows = '', $offset = 0, $line = '', $file = '') {
193 182
         if (!$numRows) {
194 183
             $numRows = $this->maxMatches;
195 184
         }
@@ -216,8 +205,7 @@  discard block
 block discarded – undo
216 205
      * @param string $file optionally pass __FILE__ calling the query for logging
217 206
      * @return mixed FALSE if no rows, if a single row it returns that, if multiple it returns an array of rows, associative responses only
218 207
      */
219
-    public function qr($query, $line = '', $file = '')
220
-    {
208
+    public function qr($query, $line = '', $file = '') {
221 209
         return $this->queryReturn($query, $line, $file);
222 210
     }
223 211
 
@@ -228,8 +216,7 @@  discard block
 block discarded – undo
228 216
      * @param string $stripSlashes
229 217
      * @return string
230 218
      */
231
-    public function f($name, $stripSlashes = '')
232
-    {
219
+    public function f($name, $stripSlashes = '') {
233 220
         if (is_null($this->Record)) {
234 221
             return null;
235 222
         } elseif ($stripSlashes || ($this->autoStripslashes && !$stripSlashes)) {
@@ -247,8 +234,7 @@  discard block
 block discarded – undo
247 234
      * @param string $file
248 235
      * @return void
249 236
      */
250
-    public function halt($msg, $line = '', $file = '')
251
-    {
237
+    public function halt($msg, $line = '', $file = '') {
252 238
         $this->unlock(false);
253 239
         /* Just in case there is a table currently locked */
254 240
 
@@ -275,8 +261,7 @@  discard block
 block discarded – undo
275 261
      * @param string $file
276 262
      * @return mixed|void
277 263
      */
278
-    public function logBackTrace($msg, $line = '', $file = '')
279
-    {
264
+    public function logBackTrace($msg, $line = '', $file = '') {
280 265
         $backtrace = (function_exists('debug_backtrace') ? debug_backtrace() : []);
281 266
         $this->log(
282 267
             ('' !== getenv('REQUEST_URI') ? ' '.getenv('REQUEST_URI') : '').
@@ -307,8 +292,7 @@  discard block
 block discarded – undo
307 292
         }
308 293
     }
309 294
 
310
-    public function emailError($queryString, $error, $line, $file)
311
-    {
295
+    public function emailError($queryString, $error, $line, $file) {
312 296
         $subject = php_uname('n').' MySQLi Error '.$queryString;
313 297
         if (class_exists('\\TFSmarty')) {
314 298
             $smarty = new \TFSmarty();
@@ -337,8 +321,7 @@  discard block
 block discarded – undo
337 321
      * @param string $file
338 322
      * @return mixed|void
339 323
      */
340
-    public function haltmsg($msg, $line = '', $file = '')
341
-    {
324
+    public function haltmsg($msg, $line = '', $file = '') {
342 325
         $email = "DB Error {$msg} {$file}:{$line}";
343 326
         if (class_exists('\\MyAdmin\Mail')) {
344 327
             \MyAdmin\Mail::failsafeMail($email, $email, ['[email protected]', '[email protected]']);
@@ -355,8 +338,7 @@  discard block
 block discarded – undo
355 338
     /**
356 339
      * @return array
357 340
      */
358
-    public function indexNames()
359
-    {
341
+    public function indexNames() {
360 342
         return [];
361 343
     }
362 344
 
@@ -368,8 +350,7 @@  discard block
 block discarded – undo
368 350
      * @param string|int $line Line Number
369 351
      * @param string $file File Name
370 352
      */
371
-    public function addLog($statement, $time, $line = '', $file = '')
372
-    {
353
+    public function addLog($statement, $time, $line = '', $file = '') {
373 354
         $query = [
374 355
             'statement' => $statement,
375 356
             'time' => $time * 1000
@@ -391,8 +372,7 @@  discard block
 block discarded – undo
391 372
      * Return logged queries.
392 373
      * @return array Logged queries
393 374
      */
394
-    public function getLog()
395
-    {
375
+    public function getLog() {
396 376
         return $this->log;
397 377
     }
398 378
 }
Please login to merge, or discard this patch.