Passed
Branch master (83aaac)
by Doug
02:35
created
MySQLColumnMeta.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -137,18 +137,18 @@
 block discarded – undo
137 137
        * Metadata from the data stored
138 138
        */
139 139
       $query = sprintf("SELECT COUNT(*) AS COUNT FROM (SELECT %s FROM %s.%s GROUP BY %s) distinctvalues",
140
-                       $this->connection->quoteIdentifier($this->name),
141
-                       $this->connection->quoteIdentifier($this->database),
142
-                       $this->connection->quoteIdentifier($this->table),
143
-                       $this->connection->quoteIdentifier($this->name));
140
+                        $this->connection->quoteIdentifier($this->name),
141
+                        $this->connection->quoteIdentifier($this->database),
142
+                        $this->connection->quoteIdentifier($this->table),
143
+                        $this->connection->quoteIdentifier($this->name));
144 144
       $this->distinctValues = $this->connection->query($query)->fetchAssoc(false)['COUNT'];
145 145
 
146 146
       $query = sprintf("SELECT MIN(%s) AS ROWMIN, MAX(%s) AS ROWMAX FROM %s.%s WHERE %s IS NOT NULL",
147
-                       $this->connection->quoteIdentifier($this->name),
148
-                       $this->connection->quoteIdentifier($this->name),
149
-                       $this->connection->quoteIdentifier($this->database),
150
-                       $this->connection->quoteIdentifier($this->table),
151
-                       $this->connection->quoteIdentifier($this->name));
147
+                        $this->connection->quoteIdentifier($this->name),
148
+                        $this->connection->quoteIdentifier($this->name),
149
+                        $this->connection->quoteIdentifier($this->database),
150
+                        $this->connection->quoteIdentifier($this->table),
151
+                        $this->connection->quoteIdentifier($this->name));
152 152
       $data = $this->connection->query($query)->fetchAssoc(false);
153 153
       $this->maxValue = $data['ROWMAX'];
154 154
       $this->minValue = $data['ROWMIN'];
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@
 block discarded – undo
259 259
      * @return int
260 260
      */
261 261
     public function getLength() {
262
-      switch($this->getOriginalType()) {
262
+      switch ($this->getOriginalType()) {
263 263
         case 'BIT':
264 264
         case 'TINYINT':
265 265
         case 'TINYINT UNSIGNED':
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -213,8 +213,7 @@
 block discarded – undo
213 213
         case 'DATETIME':
214 214
           if ($this->precision) {
215 215
             return 'TIMESTAMP';
216
-          }
217
-          else {
216
+          } else {
218 217
             return 'DATE';
219 218
           }
220 219
 
Please login to merge, or discard this patch.
MSSQLPDODatabase.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
     }
98 98
 
99 99
       /**
100
-     * Primary key column(s)
101
-     * @param string $aDatabase database/schema name
102
-     * @param string $aTable table name
103
-     * @return array
104
-     */
100
+       * Primary key column(s)
101
+       * @param string $aDatabase database/schema name
102
+       * @param string $aTable table name
103
+       * @return array
104
+       */
105 105
     public function getPrimaryKey($aDatabase, $aTable) {
106 106
       $columns = array();
107 107
       $SQL = "SELECT ind.name AS INDEX_NAME,
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      * @param string $aDatabase database/schema name
151 151
      * @param string $aTable table name
152 152
      * @return array
153
-    */
153
+     */
154 154
     public function getIndexes($aDatabase, $aTable) {
155 155
 
156 156
       $indexes = array();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@
 block discarded – undo
59 59
         $statement = $this->prepare("SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = :database ORDER BY TABLE_NAME ASC");
60 60
         $statement->bindParamToValue(':database', $aDatabase);
61 61
         $statement->execute();
62
-      }
63
-      else {
62
+      } else {
64 63
         $statement = $this->query("SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES");
65 64
       }
66 65
 
Please login to merge, or discard this patch.
MSSQLColumnMeta.php 4 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
        */
134 134
       if (!in_array($this->type, array('TEXT', 'NTEXT', 'IMAGE'))) {
135 135
         $query = sprintf("SELECT COUNT(*) AS COUNT FROM (SELECT %s FROM %s.%s GROUP BY %s) distinctvalues",
136
-                         $this->connection->quoteIdentifier($this->name),
137
-                         $this->connection->quoteIdentifier($this->database),
138
-                         $this->connection->quoteIdentifier($this->table),
139
-                         $this->connection->quoteIdentifier($this->name));
136
+                          $this->connection->quoteIdentifier($this->name),
137
+                          $this->connection->quoteIdentifier($this->database),
138
+                          $this->connection->quoteIdentifier($this->table),
139
+                          $this->connection->quoteIdentifier($this->name));
140 140
         $this->distinctValues = $this->connection->query($query)->fetchAssoc(false)['COUNT'];
141 141
       }
142 142
 
143 143
       if (!in_array($this->type, array('BIT', 'TEXT', 'NTEXT', 'IMAGE', 'UNIQUEIDENTIFIER'))) {
144 144
         $query = sprintf("SELECT MIN(%s) AS ROWMIN, MAX(%s) AS ROWMAX FROM %s.%s WHERE %s IS NOT NULL",
145
-                         $this->connection->quoteIdentifier($this->name),
146
-                         $this->connection->quoteIdentifier($this->name),
147
-                         $this->connection->quoteIdentifier($this->database),
148
-                         $this->connection->quoteIdentifier($this->table),
149
-                         $this->connection->quoteIdentifier($this->name));
145
+                          $this->connection->quoteIdentifier($this->name),
146
+                          $this->connection->quoteIdentifier($this->name),
147
+                          $this->connection->quoteIdentifier($this->database),
148
+                          $this->connection->quoteIdentifier($this->table),
149
+                          $this->connection->quoteIdentifier($this->name));
150 150
         $data = $this->connection->query($query)->fetchAssoc(false);
151 151
         $this->maxValue = $data['ROWMAX'];
152 152
         $this->minValue = $data['ROWMIN'];
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
          * Work out whether date or datetime
222 222
         */
223 223
         $query = sprintf("SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL AND CONVERT(VARCHAR(8), %s, 108) != '00:00:00'",
224
-                         $this->connection->quoteIdentifier($this->database),
225
-                         $this->connection->quoteIdentifier($this->table),
226
-                         $this->connection->quoteIdentifier($this->name),
227
-                         $this->connection->quoteIdentifier($this->name));
224
+                          $this->connection->quoteIdentifier($this->database),
225
+                          $this->connection->quoteIdentifier($this->table),
226
+                          $this->connection->quoteIdentifier($this->name),
227
+                          $this->connection->quoteIdentifier($this->name));
228 228
         $rows = $this->connection->query($query)->fetchAssoc(false);
229 229
 
230 230
         if ($rows['COUNT'] > 0) {
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
       case 'SMALLDATETIME':
341 341
       case 'DATETIMEOFFSET':
342 342
         if ($this->precision) {
343
-           return 'TIMESTAMP';
343
+            return 'TIMESTAMP';
344 344
         }
345 345
         else {
346 346
           return 'DATE';
Please login to merge, or discard this patch.
Switch Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -311,74 +311,74 @@  discard block
 block discarded – undo
311 311
     public function getOracleType() {
312 312
       switch ($this->type) {
313 313
 
314
-      case 'BIT':
315
-      case 'TINYINT':
316
-      case 'SMALLINT':
317
-      case 'INT':
318
-      case 'BIGINT':
319
-      case 'DECIMAL':
320
-      case 'NUMERIC':
321
-      case 'MONEY':
322
-      case 'SMALLMONEY':
323
-        return 'NUMBER';
324
-        break;
325
-
326
-      case 'FLOAT':
327
-        return 'BINARY_FLOAT';
328
-        break;
314
+        case 'BIT':
315
+        case 'TINYINT':
316
+        case 'SMALLINT':
317
+        case 'INT':
318
+        case 'BIGINT':
319
+        case 'DECIMAL':
320
+        case 'NUMERIC':
321
+        case 'MONEY':
322
+        case 'SMALLMONEY':
323
+          return 'NUMBER';
324
+          break;
329 325
 
330
-      case 'REAL':
331
-        return 'BINARY_DOUBLE';
332
-        break;
326
+        case 'FLOAT':
327
+          return 'BINARY_FLOAT';
328
+          break;
333 329
 
334
-      case 'DATE':
335
-        return 'DATE';
336
-        break;
330
+        case 'REAL':
331
+          return 'BINARY_DOUBLE';
332
+          break;
337 333
 
338
-      case 'DATETIME':
339
-      case 'DATETIME2':
340
-      case 'SMALLDATETIME':
341
-      case 'DATETIMEOFFSET':
342
-        if ($this->precision) {
343
-           return 'TIMESTAMP';
344
-        }
345
-        else {
334
+        case 'DATE':
346 335
           return 'DATE';
347
-        }
348
-        break;
336
+          break;
349 337
 
350
-      case 'TIME':
351
-        return 'TIME';
352
-        break;
338
+        case 'DATETIME':
339
+        case 'DATETIME2':
340
+        case 'SMALLDATETIME':
341
+        case 'DATETIMEOFFSET':
342
+          if ($this->precision) {
343
+             return 'TIMESTAMP';
344
+          }
345
+          else {
346
+            return 'DATE';
347
+          }
348
+          break;
353 349
 
354
-      case 'CHAR':
355
-      case 'NCHAR':
356
-        return 'NCHAR';
357
-        break;
350
+        case 'TIME':
351
+          return 'TIME';
352
+          break;
358 353
 
359
-      case 'VARCHAR':
360
-      case 'NVARCHAR':
361
-      case 'TEXT':
362
-      case 'NTEXT':
363
-        return 'NVARCHAR';
364
-        break;
354
+        case 'CHAR':
355
+        case 'NCHAR':
356
+          return 'NCHAR';
357
+          break;
365 358
 
366
-      case 'BINARY':
367
-      case 'VARBINARY':
368
-      case 'IMAGE':
369
-        return 'BLOB';
370
-        break;
359
+        case 'VARCHAR':
360
+        case 'NVARCHAR':
361
+        case 'TEXT':
362
+        case 'NTEXT':
363
+          return 'NVARCHAR';
364
+          break;
371 365
 
372
-      case 'ROWVERSION':
373
-      case 'TIMESTAMP': //XXX rowversion, not a time
374
-      case 'HIERARCHYID':
375
-      case 'XML':
376
-        return 'NVARCHAR';
377
-        break;
366
+        case 'BINARY':
367
+        case 'VARBINARY':
368
+        case 'IMAGE':
369
+          return 'BLOB';
370
+          break;
378 371
 
379
-      case 'UNIQUEIDENTIFIER':
380
-        return 'CHAR';
381
-        break;
372
+        case 'ROWVERSION':
373
+        case 'TIMESTAMP': //XXX rowversion, not a time
374
+        case 'HIERARCHYID':
375
+        case 'XML':
376
+          return 'NVARCHAR';
377
+          break;
378
+
379
+        case 'UNIQUEIDENTIFIER':
380
+          return 'CHAR';
381
+          break;
382 382
 
383 383
         default:
384 384
           throw new \Exception("Unknown conversion for column type {$this->type}");
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
           return 36;
419 419
           break;
420 420
 
421
-      default:
422
-          return 0;
421
+        default:
422
+            return 0;
423 423
       }
424 424
     }
425 425
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@
 block discarded – undo
391 391
      * @return int
392 392
      */
393 393
     public function getLength() {
394
-      switch($this->getOriginalType()) {
394
+      switch ($this->getOriginalType()) {
395 395
         case 'TINYINT':
396 396
         case 'SMALLINT':
397 397
         case 'INT':
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -229,8 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
         if ($rows['COUNT'] > 0) {
231 231
           return 'DATETIME';
232
-        }
233
-        else {
232
+        } else {
234 233
           return 'DATE';
235 234
         }
236 235
         break;
@@ -238,8 +237,7 @@  discard block
 block discarded – undo
238 237
       case 'DATETIMEOFFSET':
239 238
         if ($this->minValue >= '1970-01-01 00:00:01' && $this->maxValue <= '2038-01-19 03:14:07') {
240 239
           return 'TIMESTAMP';
241
-        }
242
-        else {
240
+        } else {
243 241
           return 'DATETIME';
244 242
         }
245 243
         break;
@@ -257,8 +255,7 @@  discard block
 block discarded – undo
257 255
       case 'NVARCHAR':
258 256
         if ($this->getLength() == -1) {
259 257
           return 'LONGTEXT';
260
-        }
261
-        else {
258
+        } else {
262 259
           return 'VARCHAR';
263 260
         }
264 261
         break;
@@ -275,8 +272,7 @@  discard block
 block discarded – undo
275 272
       case 'VARBINARY':
276 273
         if ($this->getLength() == -1) {
277 274
           return 'LONGBLOB';
278
-        }
279
-        else {
275
+        } else {
280 276
           return 'VARBINARY';
281 277
         }
282 278
         break;
@@ -341,8 +337,7 @@  discard block
 block discarded – undo
341 337
       case 'DATETIMEOFFSET':
342 338
         if ($this->precision) {
343 339
            return 'TIMESTAMP';
344
-        }
345
-        else {
340
+        } else {
346 341
           return 'DATE';
347 342
         }
348 343
         break;
Please login to merge, or discard this patch.
DDLGeneration.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
       if (in_array($MySQLType, array('ENUM', 'SET'))) {
31 31
         $query = sprintf("SHOW COLUMNS FROM %s.%s LIKE %s",
32
-                         $this->connection->quoteIdentifier($this->database),
33
-                         $this->connection->quoteIdentifier($this->table),
34
-                         $this->connection->escape($this->name));
32
+                          $this->connection->quoteIdentifier($this->database),
33
+                          $this->connection->quoteIdentifier($this->table),
34
+                          $this->connection->escape($this->name));
35 35
 
36 36
         $statement = $this->connection->query($query);
37 37
         $values = $statement->fetchAssoc(false)['Type'];
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
       }
45 45
       else if (in_array($MySQLType, array('CHAR', 'VARCHAR')) && $this->getLength() < 64 && $this->getDistinctValueCount() <= 16) {
46 46
         $query = sprintf("SELECT DISTINCT %s FROM %s.%s WHERE %s IS NOT NULL ORDER BY %s ASC",
47
-                         $this->connection->quoteIdentifier($this->name),
48
-                         $this->connection->quoteIdentifier($this->database),
49
-                         $this->connection->quoteIdentifier($this->table),
50
-                         $this->connection->quoteIdentifier($this->name),
51
-                         $this->connection->quoteIdentifier($this->name));
47
+                          $this->connection->quoteIdentifier($this->name),
48
+                          $this->connection->quoteIdentifier($this->database),
49
+                          $this->connection->quoteIdentifier($this->table),
50
+                          $this->connection->quoteIdentifier($this->name),
51
+                          $this->connection->quoteIdentifier($this->name));
52 52
         $values = array();
53 53
         foreach ($this->connection->query($query) as $value) {
54 54
           $values[] = trim($value[$this->name]);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
         $statement = $this->connection->query($query);
37 37
         $values = $statement->fetchAssoc(false)['Type'];
38 38
         $values = explode("','", substr($values, strpos($values, '(') + 2, -2));
39
-        $values = array_intersect_key($values,array_unique(array_map("strtolower",$values)));
39
+        $values = array_intersect_key($values, array_unique(array_map("strtolower", $values)));
40 40
         asort($values);
41 41
 
42 42
         $def .= $MySQLType;
43
-        $def .= '(' . join(', ', array_map(function($c) {return "'".addslashes($c)."'";}, $values)) . ')';
43
+        $def .= '(' . join(', ', array_map(function($c) {return "'" . addslashes($c) . "'"; }, $values)) . ')';
44 44
       }
45 45
       else if (in_array($MySQLType, array('CHAR', 'VARCHAR')) && $this->getLength() < 64 && $this->getDistinctValueCount() <= 16) {
46 46
         $query = sprintf("SELECT DISTINCT %s FROM %s.%s WHERE %s IS NOT NULL ORDER BY %s ASC",
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
         foreach ($this->connection->query($query) as $value) {
54 54
           $values[] = trim($value[$this->name]);
55 55
         }
56
-        $values = array_intersect_key($values,array_unique(array_map("strtolower",$values)));
56
+        $values = array_intersect_key($values, array_unique(array_map("strtolower", $values)));
57 57
         asort($values);
58 58
 
59 59
         if ($values) {
60 60
           $def .= 'ENUM';
61
-          $def .= '(' . join(', ', array_map(function($c) {return "'".addslashes($c)."'";}, $values)) . ')';
61
+          $def .= '(' . join(', ', array_map(function($c) {return "'" . addslashes($c) . "'"; }, $values)) . ')';
62 62
         }
63 63
         else {
64 64
           $def .= $MySQLType;
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
       if (strpos($MySQLType, 'UNSIGNED') !== false) {
23 23
         $unsigned = true;
24 24
         $MySQLType = substr($MySQLType, 0, -9);
25
-      }
26
-      else {
25
+      } else {
27 26
         $unsigned = false;
28 27
       }
29 28
 
@@ -41,8 +40,7 @@  discard block
 block discarded – undo
41 40
 
42 41
         $def .= $MySQLType;
43 42
         $def .= '(' . join(', ', array_map(function($c) {return "'".addslashes($c)."'";}, $values)) . ')';
44
-      }
45
-      else if (in_array($MySQLType, array('CHAR', 'VARCHAR')) && $this->getLength() < 64 && $this->getDistinctValueCount() <= 16) {
43
+      } else if (in_array($MySQLType, array('CHAR', 'VARCHAR')) && $this->getLength() < 64 && $this->getDistinctValueCount() <= 16) {
46 44
         $query = sprintf("SELECT DISTINCT %s FROM %s.%s WHERE %s IS NOT NULL ORDER BY %s ASC",
47 45
                          $this->connection->quoteIdentifier($this->name),
48 46
                          $this->connection->quoteIdentifier($this->database),
@@ -59,28 +57,23 @@  discard block
 block discarded – undo
59 57
         if ($values) {
60 58
           $def .= 'ENUM';
61 59
           $def .= '(' . join(', ', array_map(function($c) {return "'".addslashes($c)."'";}, $values)) . ')';
62
-        }
63
-        else {
60
+        } else {
64 61
           $def .= $MySQLType;
65 62
           if ($this->getLength() > 0) {
66 63
             $def .= '(' . $this->getLength() . ')';
67 64
           }
68 65
         }
69
-      }
70
-      else if (in_array($MySQLType, array('DATETIME', 'TIMESTAMP', 'TIME'))) {
66
+      } else if (in_array($MySQLType, array('DATETIME', 'TIMESTAMP', 'TIME'))) {
71 67
         $def .= $MySQLType;
72 68
         $def .= '(' . (int)$this->getScale() . ')';
73
-      }
74
-      else {
69
+      } else {
75 70
         $def .= $MySQLType;
76 71
 
77 72
         if ($this->getScale() && !in_array($MySQLType, array('DATE'))) {
78 73
           $def .= '(' . $this->getPrecision() . ',' . $this->getScale() . ')';
79
-        }
80
-        else if ($this->getPrecision() && !in_array($MySQLType, array('TINYINT', 'SMALLINT', 'MEDIUMINT', 'INT', 'BIGINT'))) {
74
+        } else if ($this->getPrecision() && !in_array($MySQLType, array('TINYINT', 'SMALLINT', 'MEDIUMINT', 'INT', 'BIGINT'))) {
81 75
           $def .= '(' . $this->getPrecision() . ')';
82
-        }
83
-        else if ($this->getLength() > 0 && !in_array($MySQLType, array('TINYINT', 'SMALLINT', 'MEDIUMINT', 'INT', 'BIGINT'))) {
76
+        } else if ($this->getLength() > 0 && !in_array($MySQLType, array('TINYINT', 'SMALLINT', 'MEDIUMINT', 'INT', 'BIGINT'))) {
84 77
           $def .= '(' . $this->getLength() . ')';
85 78
         }
86 79
 
@@ -91,8 +84,7 @@  discard block
 block discarded – undo
91 84
 
92 85
       if ($this->isNullable()) {
93 86
         $def .= ' NULL';
94
-      }
95
-      else {
87
+      } else {
96 88
         $def .= ' NOT NULL';
97 89
       }
98 90
 
@@ -109,18 +101,15 @@  discard block
 block discarded – undo
109 101
 
110 102
       if ($this->getScale()) {
111 103
         $def .= '(' . $this->getPrecision() . ',' . $this->getScale() . ')';
112
-      }
113
-      else if ($this->getPrecision()) {
104
+      } else if ($this->getPrecision()) {
114 105
         $def .= '(' . $this->getPrecision() . ')';
115
-      }
116
-      else if ($this->getLength()) {
106
+      } else if ($this->getLength()) {
117 107
         $def .= '(' . $this->getLength() . ')';
118 108
       }
119 109
 
120 110
       if ($this->isNullable()) {
121 111
         $def .= ' NULL';
122
-      }
123
-      else {
112
+      } else {
124 113
         $def .= ' NOT NULL';
125 114
       }
126 115
 
Please login to merge, or discard this patch.
OraclePDODatabase.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
      * @param string $aDatabase database/schema name
108 108
      * @param string $aTable table name
109 109
      * @return array
110
-    */
110
+     */
111 111
     public function getIndexes($aDatabase, $aTable) {
112 112
 
113 113
       $indexes = array();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
         $statement = $this->prepare("SELECT OWNER, TABLE_NAME FROM ALL_TABLES WHERE OWNER = :owner ORDER BY TABLE_NAME ASC");
36 36
         $statement->bindParamToValue(':owner', $aDatabase);
37 37
         $statement->execute();
38
-      }
39
-      else {
38
+      } else {
40 39
         $statement = $this->query("SELECT OWNER, TABLE_NAME FROM ALL_TABLES");
41 40
       }
42 41
 
Please login to merge, or discard this patch.
OracleColumnMeta.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -134,18 +134,18 @@  discard block
 block discarded – undo
134 134
        */
135 135
       try {
136 136
         $query = sprintf("SELECT COUNT(*) AS COUNT FROM (SELECT %s FROM %s.%s GROUP BY %s) distinctvalues",
137
-                         $this->connection->quoteIdentifier($this->name),
138
-                         $this->connection->quoteIdentifier($this->database),
139
-                         $this->connection->quoteIdentifier($this->table),
140
-                         $this->connection->quoteIdentifier($this->name));
137
+                          $this->connection->quoteIdentifier($this->name),
138
+                          $this->connection->quoteIdentifier($this->database),
139
+                          $this->connection->quoteIdentifier($this->table),
140
+                          $this->connection->quoteIdentifier($this->name));
141 141
         $this->distinctValues = $this->connection->query($query)->fetchAssoc(false)['COUNT'];
142 142
 
143 143
         $query = sprintf("SELECT MIN(%s) AS ROWMIN, MAX(%s) AS ROWMAX FROM %s.%s WHERE %s IS NOT NULL",
144
-                         $this->connection->quoteIdentifier($this->name),
145
-                         $this->connection->quoteIdentifier($this->name),
146
-                         $this->connection->quoteIdentifier($this->database),
147
-                         $this->connection->quoteIdentifier($this->table),
148
-                         $this->connection->quoteIdentifier($this->name));
144
+                          $this->connection->quoteIdentifier($this->name),
145
+                          $this->connection->quoteIdentifier($this->name),
146
+                          $this->connection->quoteIdentifier($this->database),
147
+                          $this->connection->quoteIdentifier($this->table),
148
+                          $this->connection->quoteIdentifier($this->name));
149 149
         $data = $this->connection->query($query)->fetchAssoc(false);
150 150
         $this->maxValue = $data['ROWMAX'];
151 151
         $this->minValue = $data['ROWMIN'];
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
       catch (\Exception $e) { //LONG column has restrictions on querying, so just get total value count
155 155
         if (strpos($e->getMessage(), 'ORA-00997: illegal use of LONG datatype') !== false) {
156 156
           $query = sprintf("SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL",
157
-                           $this->connection->quoteIdentifier($this->database),
158
-                           $this->connection->quoteIdentifier($this->table),
159
-                           $this->connection->quoteIdentifier($this->name));
157
+                            $this->connection->quoteIdentifier($this->database),
158
+                            $this->connection->quoteIdentifier($this->table),
159
+                            $this->connection->quoteIdentifier($this->name));
160 160
           $this->distinctValues = $this->connection->query($query)->fetchAssoc(false)['COUNT'] ?: 1;
161 161
         }
162 162
       }
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
            * Work out whether date or datetime
264 264
            */
265 265
           $query = sprintf("SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL AND TO_CHAR(%s, 'SSSSS') > 0",
266
-                           $this->connection->quoteIdentifier($this->database),
267
-                           $this->connection->quoteIdentifier($this->table),
268
-                           $this->connection->quoteIdentifier($this->name),
269
-                           $this->connection->quoteIdentifier($this->name));
266
+                            $this->connection->quoteIdentifier($this->database),
267
+                            $this->connection->quoteIdentifier($this->table),
268
+                            $this->connection->quoteIdentifier($this->name),
269
+                            $this->connection->quoteIdentifier($this->name));
270 270
           $rows = $this->connection->query($query)->fetchAssoc(false);
271 271
 
272 272
           if ($rows['COUNT'] > 0) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -317,7 +317,7 @@
 block discarded – undo
317 317
      * @return int
318 318
      */
319 319
     public function getLength() {
320
-      switch($this->getOriginalType()) {
320
+      switch ($this->getOriginalType()) {
321 321
         case 'NUMBER':
322 322
         case 'CHAR':
323 323
         case 'NCHAR':
Please login to merge, or discard this patch.
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -150,8 +150,7 @@  discard block
 block discarded – undo
150 150
         $this->maxValue = $data['ROWMAX'];
151 151
         $this->minValue = $data['ROWMIN'];
152 152
 
153
-      }
154
-      catch (\Exception $e) { //LONG column has restrictions on querying, so just get total value count
153
+      } catch (\Exception $e) { //LONG column has restrictions on querying, so just get total value count
155 154
         if (strpos($e->getMessage(), 'ORA-00997: illegal use of LONG datatype') !== false) {
156 155
           $query = sprintf("SELECT COUNT(*) AS COUNT FROM %s.%s WHERE %s IS NOT NULL",
157 156
                            $this->connection->quoteIdentifier($this->database),
@@ -192,45 +191,33 @@  discard block
 block discarded – undo
192 191
             if ($this->minValue >= 0) { //unsigned
193 192
               if (bccomp($this->maxValue, '256') === -1) {
194 193
                 return 'TINYINT UNSIGNED';
195
-              }
196
-              else if (bccomp($this->maxValue, '65536') === -1) {
194
+              } else if (bccomp($this->maxValue, '65536') === -1) {
197 195
                 return 'SMALLINT UNSIGNED';
198
-              }
199
-              else if (bccomp($this->maxValue, '16777216') === -1) {
196
+              } else if (bccomp($this->maxValue, '16777216') === -1) {
200 197
                 return 'MEDIUMINT UNSIGNED';
201
-              }
202
-              else if (bccomp($this->maxValue, '4294967296') === -1) {
198
+              } else if (bccomp($this->maxValue, '4294967296') === -1) {
203 199
                 return 'INT UNSIGNED';
204
-              }
205
-              else if (bccomp($this->maxValue, '18446744073709551616') === -1) {
200
+              } else if (bccomp($this->maxValue, '18446744073709551616') === -1) {
206 201
                 return 'BIGINT UNSIGNED';
207
-              }
208
-              else {
202
+              } else {
209 203
                 return 'NUMERIC';
210 204
               }
211
-            }
212
-            else { //signed
205
+            } else { //signed
213 206
               if (bccomp(max(abs($this->minValue), $this->maxValue), '128') === -1) {
214 207
                 return 'TINYINT';
215
-              }
216
-              else if (bccomp(max(abs($this->minValue), $this->maxValue), '32768') === -1) {
208
+              } else if (bccomp(max(abs($this->minValue), $this->maxValue), '32768') === -1) {
217 209
                 return 'SMALLINT';
218
-              }
219
-              else if (bccomp(max(abs($this->minValue), $this->maxValue), '8388608') === -1) {
210
+              } else if (bccomp(max(abs($this->minValue), $this->maxValue), '8388608') === -1) {
220 211
                 return 'MEDIUMINT';
221
-              }
222
-              else if (bccomp(max(abs($this->minValue), $this->maxValue), '2147483648') === -1) {
212
+              } else if (bccomp(max(abs($this->minValue), $this->maxValue), '2147483648') === -1) {
223 213
                 return 'INT';
224
-              }
225
-              else if (bccomp(max(abs($this->minValue), $this->maxValue), '9223372036854775808') === -1) {
214
+              } else if (bccomp(max(abs($this->minValue), $this->maxValue), '9223372036854775808') === -1) {
226 215
                 return 'BIGINT';
227
-              }
228
-              else {
216
+              } else {
229 217
                 return 'DECIMAL';
230 218
               }
231 219
             }
232
-          }
233
-          else {
220
+          } else {
234 221
             return 'DECIMAL';
235 222
           }
236 223
           break;
@@ -252,8 +239,7 @@  discard block
 block discarded – undo
252 239
         case 'TIMESTAMP WITH LOCAL TIME ZONE':
253 240
           if ($this->minValue >= '1970-01-01 00:00:01' && $this->maxValue <= '2038-01-19 03:14:07') {
254 241
             return 'TIMESTAMP';
255
-          }
256
-          else {
242
+          } else {
257 243
             return 'DATETIME';
258 244
           }
259 245
 
@@ -271,8 +257,7 @@  discard block
 block discarded – undo
271 257
 
272 258
           if ($rows['COUNT'] > 0) {
273 259
             return 'DATETIME';
274
-          }
275
-          else {
260
+          } else {
276 261
             return 'DATE';
277 262
           }
278 263
           break;
Please login to merge, or discard this patch.
MySQLPDODatabase.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
     }
104 104
 
105 105
       /**
106
-     * Primary key column(s)
107
-     * @param string $aDatabase database/schema name
108
-     * @param string $aTable table name
109
-     * @return array
110
-     */
106
+       * Primary key column(s)
107
+       * @param string $aDatabase database/schema name
108
+       * @param string $aTable table name
109
+       * @return array
110
+       */
111 111
     public function getPrimaryKey($aDatabase, $aTable) {
112 112
       $columns = array();
113 113
       $SQL = "SELECT ORDINAL_POSITION, COLUMN_NAME
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      * @param string $aDatabase database/schema name
134 134
      * @param string $aTable table name
135 135
      * @return array
136
-    */
136
+     */
137 137
     public function getIndexes($aDatabase, $aTable) {
138 138
 
139 139
       $indexes = array();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@
 block discarded – undo
65 65
         $statement = $this->prepare("SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = :database ORDER BY TABLE_NAME ASC");
66 66
         $statement->bindParamToValue(':database', $aDatabase);
67 67
         $statement->execute();
68
-      }
69
-      else {
68
+      } else {
70 69
         $statement = $this->query("SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES");
71 70
       }
72 71
 
Please login to merge, or discard this patch.
PDOStatement.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,12 +30,10 @@  discard block
 block discarded – undo
30 30
       if ($aAllRows) {
31 31
         if ($aGroupByFirstCol) {
32 32
           return $this->fetchAll(\PDO::FETCH_ASSOC | \PDO::FETCH_GROUP);
33
-        }
34
-        else {
33
+        } else {
35 34
           return $this->fetchAll(\PDO::FETCH_ASSOC);
36 35
         }
37
-      }
38
-      else {
36
+      } else {
39 37
         return $this->fetch(\PDO::FETCH_ASSOC);
40 38
       }
41 39
     }
@@ -50,12 +48,10 @@  discard block
 block discarded – undo
50 48
       if ($aAllRows) {
51 49
         if ($aGroupByFirstCol) {
52 50
           return $this->fetchAll(\PDO::FETCH_KEY_PAIR | \PDO::FETCH_GROUP);
53
-        }
54
-        else {
51
+        } else {
55 52
           return $this->fetchAll(\PDO::FETCH_KEY_PAIR);
56 53
         }
57
-      }
58
-      else {
54
+      } else {
59 55
         return $this->fetch(\PDO::FETCH_KEY_PAIR);
60 56
       }
61 57
     }
@@ -72,20 +68,17 @@  discard block
 block discarded – undo
72 68
     public function fetchObj($aClassName = 'stdClass', $aConstructorArguments = array(), $aRunConstructorFirst = true, $aAllRows = true, $aGroupByFirstCol = false) {
73 69
       if ($aRunConstructorFirst) {
74 70
         $this->setFetchMode(\PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE, $aClassName, $aConstructorArguments);
75
-      }
76
-      else {
71
+      } else {
77 72
         $this->setFetchMode(\PDO::FETCH_CLASS, $aClassName, $aConstructorArguments);
78 73
       }
79 74
 
80 75
       if ($aAllRows) {
81 76
         if ($aGroupByFirstCol) {
82 77
           return $this->fetchAll(\PDO::FETCH_CLASS | \PDO::FETCH_GROUP);
83
-        }
84
-        else {
78
+        } else {
85 79
           return $this->fetchAll(\PDO::FETCH_CLASS);
86 80
         }
87
-      }
88
-      else {
81
+      } else {
89 82
         return $this->fetch(\PDO::FETCH_CLASS);
90 83
       }
91 84
     }
Please login to merge, or discard this patch.
PDODatabase.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         if ($length <= 191) { //skip index if too long for MySQL
128 128
           $tableDef .= ',' . PHP_EOL . PHP_EOL;
129 129
           $tableDef .= 'PRIMARY KEY (';
130
-          $tableDef .= join(', ' . PHP_EOL, array_map(function($c) {return '`'.strtolower($c).'`';}, $primaryKey));
130
+          $tableDef .= join(', ' . PHP_EOL, array_map(function($c) {return '`' . strtolower($c) . '`'; }, $primaryKey));
131 131
           $tableDef .= ')';
132 132
         }
133 133
       }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
           }
152 152
           $tableDef .= ',' . PHP_EOL;
153 153
           $tableDef .= 'KEY `' . strtolower($indexName) . '` (';
154
-          $tableDef .= join(", ", array_map(function($c) {return '`'.strtolower($c).'`';}, $indexColumns));
154
+          $tableDef .= join(", ", array_map(function($c) {return '`' . strtolower($c) . '`'; }, $indexColumns));
155 155
           $tableDef .= ')';
156 156
         }
157 157
       }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
       if ($primaryKey) {
194 194
         $tableDef .= ',' . PHP_EOL . PHP_EOL;
195 195
         $tableDef .= 'PRIMARY KEY (';
196
-        $tableDef .= join(', ' . PHP_EOL, array_map(function($c) {return '"'.strtolower($c).'"';}, $primaryKey));
196
+        $tableDef .= join(', ' . PHP_EOL, array_map(function($c) {return '"' . strtolower($c) . '"'; }, $primaryKey));
197 197
         $tableDef .= ')';
198 198
       }
199 199
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
           }
207 207
           $tableDef .= ',' . PHP_EOL;
208 208
           $tableDef .= 'KEY `' . strtolower($indexName) . '` (';
209
-          $tableDef .= join(', ', array_map(function($c) {return '"'.strtolower($c).'"';}, $indexColumns));
209
+          $tableDef .= join(', ', array_map(function($c) {return '"' . strtolower($c) . '"'; }, $indexColumns));
210 210
           $tableDef .= ')';
211 211
         }
212 212
       }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,7 @@
 block discarded – undo
69 69
         case self::PARAM_IS_INT:
70 70
           if (is_int($aParam) || ctype_digit($aParam)) {
71 71
             return (int)$aParam;
72
-          }
73
-          else {
72
+          } else {
74 73
             throw new \RuntimeException("Parameter {$aParam} is not an integer");
75 74
           }
76 75
           break;
Please login to merge, or discard this patch.