Completed
Push — master ( 0bd286...d09ab6 )
by Ingo
11s
created
code/SQLite3Query.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function seek($row)
44 44
     {
45 45
         $this->handle->reset();
46
-        $i=0;
46
+        $i = 0;
47 47
         while ($i < $row && $row = @$this->handle->fetchArray()) {
48 48
             $i++;
49 49
         }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function numRecords()
57 57
     {
58
-        $c=0;
58
+        $c = 0;
59 59
         while ($this->handle->fetchArray()) {
60 60
             $c++;
61 61
         }
Please login to merge, or discard this patch.
code/SQLiteDatabaseConfigurationHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                 self::create_db_dir($databaseConfig['path']);
27 27
                 self::secure_db_dir($databaseConfig['path']);
28 28
             }
29
-            $file = $databaseConfig['path'] . '/' . $databaseConfig['database'];
29
+            $file = $databaseConfig['path'].'/'.$databaseConfig['database'];
30 30
             $conn = null;
31 31
         
32 32
             switch ($databaseConfig['type']) {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public static function secure_db_dir($path)
214 214
     {
215
-        return (is_writeable($path)) ? file_put_contents($path . '/.htaccess', 'deny from all') : false;
215
+        return (is_writeable($path)) ? file_put_contents($path.'/.htaccess', 'deny from all') : false;
216 216
     }
217 217
     
218 218
     public function requireDatabaseAlterPermissions($databaseConfig)
Please login to merge, or discard this patch.
code/SQLite3SchemaManager.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
          
45 45
         // If using file based database ensure any existing file is removed
46 46
         $parameters = $this->database->getParameters();
47
-        $fullpath = $parameters['path'] . '/' . $name;
47
+        $fullpath = $parameters['path'].'/'.$name;
48 48
         if (is_writable($fullpath)) {
49 49
             unlink($fullpath);
50 50
         }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     public function alterField($tableName, $fieldName, $fieldSpec)
243 243
     {
244 244
         $oldFieldList = $this->fieldList($tableName);
245
-        $fieldNameList = '"' . implode('","', array_keys($oldFieldList)) . '"';
245
+        $fieldNameList = '"'.implode('","', array_keys($oldFieldList)).'"';
246 246
 
247 247
         if (!empty($_REQUEST['avoidConflict']) && Director::isDev()) {
248 248
             $fieldSpec = preg_replace('/\snot null\s/i', ' NOT NULL ON CONFLICT REPLACE ', $fieldSpec);
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
         // Update field spec
257 257
         $newColsSpec = array();
258 258
         foreach ($oldFieldList as $name => $oldSpec) {
259
-            $newColsSpec[] = "\"$name\" " . ($name == $fieldName ? $fieldSpec : $oldSpec);
259
+            $newColsSpec[] = "\"$name\" ".($name == $fieldName ? $fieldSpec : $oldSpec);
260 260
         }
261 261
 
262 262
         $queries = array(
263 263
             "BEGIN TRANSACTION",
264
-            "CREATE TABLE \"{$tableName}_alterfield_{$fieldName}\"(" . implode(',', $newColsSpec) . ")",
264
+            "CREATE TABLE \"{$tableName}_alterfield_{$fieldName}\"(".implode(',', $newColsSpec).")",
265 265
             "INSERT INTO \"{$tableName}_alterfield_{$fieldName}\" SELECT {$fieldNameList} FROM \"$tableName\"",
266 266
             "DROP TABLE \"$tableName\"",
267 267
             "ALTER TABLE \"{$tableName}_alterfield_{$fieldName}\" RENAME TO \"$tableName\"",
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
         $oldCols = array();
296 296
         $newColsSpec = array();
297 297
         foreach ($oldFieldList as $name => $spec) {
298
-            $oldCols[] = "\"$name\"" . (($name == $oldName) ? " AS $newName" : '');
299
-            $newColsSpec[] = "\"" . (($name == $oldName) ? $newName : $name) . "\" $spec";
298
+            $oldCols[] = "\"$name\"".(($name == $oldName) ? " AS $newName" : '');
299
+            $newColsSpec[] = "\"".(($name == $oldName) ? $newName : $name)."\" $spec";
300 300
         }
301 301
 
302 302
         // SQLite doesn't support direct renames through ALTER TABLE
303 303
         $queries = array(
304 304
             "BEGIN TRANSACTION",
305
-            "CREATE TABLE \"{$tableName}_renamefield_{$oldName}\" (" . implode(',', $newColsSpec) . ")",
306
-            "INSERT INTO \"{$tableName}_renamefield_{$oldName}\" SELECT " . implode(',', $oldCols) . " FROM \"$tableName\"",
305
+            "CREATE TABLE \"{$tableName}_renamefield_{$oldName}\" (".implode(',', $newColsSpec).")",
306
+            "INSERT INTO \"{$tableName}_renamefield_{$oldName}\" SELECT ".implode(',', $oldCols)." FROM \"$tableName\"",
307 307
             "DROP TABLE \"$tableName\"",
308 308
             "ALTER TABLE \"{$tableName}_renamefield_{$oldName}\" RENAME TO \"$tableName\"",
309 309
             "COMMIT"
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
      */
456 456
     public function boolean($values)
457 457
     {
458
-        $default = empty($values['default']) ? 0 : (int)$values['default'];
458
+        $default = empty($values['default']) ? 0 : (int) $values['default'];
459 459
         return "BOOL NOT NULL DEFAULT $default";
460 460
     }
461 461
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
      */
500 500
     public function enum($values)
501 501
     {
502
-        $tablefield = $values['table'] . '.' . $values['name'];
502
+        $tablefield = $values['table'].'.'.$values['name'];
503 503
         $enumValues = implode(',', $values['enums']);
504 504
         
505 505
         // Ensure the cache table exists
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
      */
570 570
     public function int($values, $asDbValue = false)
571 571
     {
572
-        return "INTEGER({$values['precision']}) " . strtoupper($values['null']) . " DEFAULT " . (int)$values['default'];
572
+        return "INTEGER({$values['precision']}) ".strtoupper($values['null'])." DEFAULT ".(int) $values['default'];
573 573
     }
574 574
 
575 575
     /**
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 
645 645
     public function hasTable($tableName)
646 646
     {
647
-        return (bool)$this->preparedQuery(
647
+        return (bool) $this->preparedQuery(
648 648
             'SELECT name FROM sqlite_master WHERE type = ? AND name = ?',
649 649
             array('table', $tableName)
650 650
         )->first();
Please login to merge, or discard this patch.
code/SQLite3QueryBuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             $rowParts[] = implode(', ', $parts);
50 50
         }
51 51
         $columnSQL = implode(', ', $columns);
52
-        $sql = "INSERT INTO {$into}{$nl}($columnSQL){$nl}SELECT " . implode("{$nl}UNION ALL SELECT ", $rowParts);
52
+        $sql = "INSERT INTO {$into}{$nl}($columnSQL){$nl}SELECT ".implode("{$nl}UNION ALL SELECT ", $rowParts);
53 53
         
54 54
         return $sql;
55 55
     }
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
         }
73 73
 
74 74
         // For literal values return this as the limit SQL
75
-        if (! is_array($limit)) {
75
+        if (!is_array($limit)) {
76 76
             return "{$nl}LIMIT $limit";
77 77
         }
78 78
 
79 79
         // Assert that the array version provides the 'limit' key
80
-        if (! array_key_exists('limit', $limit) || ($limit['limit'] !== null && ! is_numeric($limit['limit']))) {
80
+        if (!array_key_exists('limit', $limit) || ($limit['limit'] !== null && !is_numeric($limit['limit']))) {
81 81
             throw new InvalidArgumentException(
82
-                'SQLite3QueryBuilder::buildLimitSQL(): Wrong format for $limit: '. var_export($limit, true)
82
+                'SQLite3QueryBuilder::buildLimitSQL(): Wrong format for $limit: '.var_export($limit, true)
83 83
             );
84 84
         }
85 85
 
Please login to merge, or discard this patch.
code/SQLite3Database.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
         // Ensure database name is set
109 109
         if (empty($parameters['database'])) {
110
-            $parameters['database'] = 'database' . self::database_extension();
110
+            $parameters['database'] = 'database'.self::database_extension();
111 111
         }
112 112
         $dbName = $parameters['database'];
113 113
         if (!self::is_valid_database_name($dbName)) {
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
         } else {
124 124
             // Ensure path is given
125 125
             if (empty($parameters['path'])) {
126
-                $parameters['path'] = ASSETS_PATH . '/.sqlitedb';
126
+                $parameters['path'] = ASSETS_PATH.'/.sqlitedb';
127 127
             }
128 128
 
129 129
             //assumes that the path to dbname will always be provided:
130
-            $file = $parameters['path'] . '/' . $dbName;
130
+            $file = $parameters['path'].'/'.$dbName;
131 131
             if (!file_exists($parameters['path'])) {
132 132
                 SQLiteDatabaseConfigurationHelper::create_db_dir($parameters['path']);
133 133
                 SQLiteDatabaseConfigurationHelper::secure_db_dir($parameters['path']);
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
             $extraFilters['File'] .= " AND ShowInSearch <> 0";
287 287
         }
288 288
 
289
-        $limit = $start . ", " . (int) $pageLength;
289
+        $limit = $start.", ".(int) $pageLength;
290 290
 
291 291
         $notMatch = $invertedMatch ? "NOT " : "";
292 292
         if ($keywords) {
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         $queries = array();
312 312
         foreach ($classesToSearch as $class) {
313 313
             $queries[$class] = DataList::create($class)
314
-                ->where($notMatch . $match[$class] . $extraFilters[$class])
314
+                ->where($notMatch.$match[$class].$extraFilters[$class])
315 315
                 ->dataQuery()
316 316
                 ->query();
317 317
             $fromArr = $queries[$class]->getFrom();
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             $totalCount += $query->unlimitedRowCount();
377 377
         }
378 378
 
379
-        $fullQuery = implode(" UNION ", $querySQLs) . " ORDER BY $sortBy LIMIT $limit";
379
+        $fullQuery = implode(" UNION ", $querySQLs)." ORDER BY $sortBy LIMIT $limit";
380 380
         // Get records
381 381
         $records = $this->preparedQuery($fullQuery, $queryParameters);
382 382
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
                 $comp = 'LIKE';
464 464
             }
465 465
             if ($negate) {
466
-                $comp = 'NOT ' . $comp;
466
+                $comp = 'NOT '.$comp;
467 467
             }
468 468
         }
469 469
 
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         preg_match_all('/%(.)/', $format, $matches);
480 480
         foreach ($matches[1] as $match) {
481 481
             if (array_search($match, array('Y', 'm', 'd', 'H', 'i', 's', 'U')) === false) {
482
-                user_error('formattedDatetimeClause(): unsupported format character %' . $match, E_USER_WARNING);
482
+                user_error('formattedDatetimeClause(): unsupported format character %'.$match, E_USER_WARNING);
483 483
             }
484 484
         }
485 485
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
             $date = "'$date'";
505 505
         }
506 506
 
507
-        $modifier = empty($modifiers) ? '' : ", '" . implode("', '", $modifiers) . "'";
507
+        $modifier = empty($modifiers) ? '' : ", '".implode("', '", $modifiers)."'";
508 508
         return "strftime('$format', $date$modifier)";
509 509
     }
510 510
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
             $date = "'$date'";
522 522
         }
523 523
 
524
-        $modifier = empty($modifiers) ? '' : ", '" . implode("', '", $modifiers) . "'";
524
+        $modifier = empty($modifiers) ? '' : ", '".implode("', '", $modifiers)."'";
525 525
         return "datetime($date$modifier, '$interval')";
526 526
     }
527 527
 
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
             $date2 = "'$date2'";
550 550
         }
551 551
 
552
-        $modifier1 = empty($modifiers1) ? '' : ", '" . implode("', '", $modifiers1) . "'";
553
-        $modifier2 = empty($modifiers2) ? '' : ", '" . implode("', '", $modifiers2) . "'";
552
+        $modifier1 = empty($modifiers1) ? '' : ", '".implode("', '", $modifiers1)."'";
553
+        $modifier2 = empty($modifiers2) ? '' : ", '".implode("', '", $modifiers2)."'";
554 554
 
555 555
         return "strftime('%s', $date1$modifier1) - strftime('%s', $date2$modifier2)";
556 556
     }
Please login to merge, or discard this patch.