Passed
Branch master (83aaac)
by Doug
02:35
created
MySQLColumnMeta.php 2 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.
MSSQLPDODatabase.php 1 patch
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.
MSSQLColumnMeta.php 2 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.
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.
DDLGeneration.php 2 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.
OraclePDODatabase.php 1 patch
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.
OracleColumnMeta.php 2 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.
MySQLPDODatabase.php 1 patch
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.
PDODatabase.php 1 patch
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.