Passed
Branch master (83aaac)
by Doug
02:35
created
MySQLColumnMeta.php 2 patches
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 1 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 2 patches
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 2 patches
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 1 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 2 patches
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 1 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.