Passed
Push — main ( e2fa8b...75aa7b )
by Thierry
39:25 queued 27:26
created
src/Service/DbAdmin/ConnectionTrait.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @var int|null
19 19
      */
20
-    private int|null $ownerId = null;
20
+    private int | null $ownerId = null;
21 21
 
22 22
     /**
23 23
      * @var ConnectionInterface
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @return bool|StatementInterface
58 58
      */
59
-    private function executeQuery(string $query, array $values): bool|StatementInterface
59
+    private function executeQuery(string $query, array $values): bool | StatementInterface
60 60
     {
61 61
         $st = $this->connection->prepareStatement($query);
62 62
         return $this->connection->executeStatement($st, $values) ?? false;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $query = "select id from dbadmin_owners where username=:username limit 1";
78 78
         $statement = $this->executeQuery($query, ['username' => $username]);
79
-        return !$statement || !($row = $statement->fetchAssoc()) ? 0 : (int)$row['id'];
79
+        return !$statement || !($row = $statement->fetchAssoc()) ? 0 : (int) $row['id'];
80 80
     }
81 81
 
82 82
     /**
@@ -108,8 +108,7 @@  discard block
 block discarded – undo
108 108
     private function getOwnerId(bool $canCreate = true): int
109 109
     {
110 110
         // Todo: use match
111
-        return $this->ownerId !== null ? $this->ownerId :
112
-            ($this->readOwnerId($this->user()) ?: ($canCreate ?
111
+        return $this->ownerId !== null ? $this->ownerId : ($this->readOwnerId($this->user()) ?: ($canCreate ?
113 112
                 $this->newOwnerId($this->user()) : 0));
114 113
     }
115 114
 }
Please login to merge, or discard this patch.
src/Db/Facades/Traits/TableDumpTrait.php 1 patch
Spacing   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -110,8 +110,7 @@  discard block
 block discarded – undo
110 110
             $key = $this->driver->escapeId($field->name());
111 111
             $values[] = "$key = VALUES($key)";
112 112
         }
113
-        $dump->suffix = $this->options['data_style'] !== 'INSERT+UPDATE' ? ';' :
114
-            "\nON DUPLICATE KEY UPDATE " . implode(', ', $values) . ';';
113
+        $dump->suffix = $this->options['data_style'] !== 'INSERT+UPDATE' ? ';' : "\nON DUPLICATE KEY UPDATE " . implode(', ', $values) . ';';
115 114
 
116 115
         return $keys;
117 116
     }
@@ -137,7 +136,7 @@  discard block
 block discarded – undo
137 136
 
138 137
         if ($dump->insert === '') {
139 138
             $dump->insert = 'INSERT INTO ' . $this->driver->escapeTableName($dump->table) . ' (' .
140
-                implode(', ', array_map(function ($key) {
139
+                implode(', ', array_map(function($key) {
141 140
                     return $this->driver->escapeId($key);
142 141
                 }, $keys)) . ') VALUES';
143 142
         }
@@ -163,8 +162,7 @@  discard block
 block discarded – undo
163 162
         $fields = $this->options['format'] !== 'sql' ? [] : $this->driver->fields($dump->table);
164 163
         $keys = [];
165 164
         $fetchFunction = $dump->table !== '' ?
166
-            fn($statement) => $statement->fetchAssoc() :
167
-            fn($statement) => $statement->fetchRow();
165
+            fn($statement) => $statement->fetchAssoc() : fn($statement) => $statement->fetchRow();
168 166
         while ($row = $fetchFunction($statement)) {
169 167
             if (empty($keys)) {
170 168
                 $keys = $this->getDataRowKeys($dump, $row, $statement);
Please login to merge, or discard this patch.
src/Db/Facades/Traits/TableExportTrait.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@
 block discarded – undo
30 30
     public function getSelectDataValues(): array
31 31
     {
32 32
         //! use insertOrUpdate() in all drivers
33
-        return $this->driver->jush() !== 'sql' ? ['', 'TRUNCATE+INSERT', 'INSERT'] :
34
-            ['', 'TRUNCATE+INSERT', 'INSERT', 'INSERT+UPDATE'];
33
+        return $this->driver->jush() !== 'sql' ? ['', 'TRUNCATE+INSERT', 'INSERT'] : ['', 'TRUNCATE+INSERT', 'INSERT', 'INSERT+UPDATE'];
35 34
     }
36 35
 
37 36
     private function getDataRowOptions(string $database, string $table): array
Please login to merge, or discard this patch.
src/Db/Facades/ImportFacade.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
         // ignore post_max_size because it is for all form fields
30 30
         // together and bytes computing would be necessary.
31 31
         $contents = $this->admin->iniBool('file_uploads') ?
32
-            ['upload' => "SQL$gz (< " . ini_get('upload_max_filesize') . 'B)'] :
33
-            ['upload_disabled' => $this->utils->trans->lang('File uploads are disabled.')];
32
+            ['upload' => "SQL$gz (< " . ini_get('upload_max_filesize') . 'B)'] : ['upload_disabled' => $this->utils->trans->lang('File uploads are disabled.')];
34 33
         if (($importServerPath = $this->admin->importServerPath())) {
35 34
             $contents['path'] = $this->utils->str->html($importServerPath) . $gz;
36 35
         }
Please login to merge, or discard this patch.
src/Db/Facades/ExportFacade.php 2 patches
Spacing   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -94,12 +94,10 @@  discard block
 block discarded – undo
94 94
         // From dump.inc.php create_routine()
95 95
         $routineName = $this->driver->escapeId(trim($routine->name));
96 96
         $routineParams = $this->getRoutineParams($routineInfo->params);
97
-        $routineReturns = $routine->type !== 'FUNCTION' ? '' :
98
-            ' RETURNS' . $this->driver->processType($routineInfo->return, 'CHARACTER SET');
97
+        $routineReturns = $routine->type !== 'FUNCTION' ? '' : ' RETURNS' . $this->driver->processType($routineInfo->return, 'CHARACTER SET');
99 98
         $routineLanguage = $routineInfo->language ? " LANGUAGE {$routineInfo->language}" : '';
100 99
         $definition = rtrim($routineInfo->definition, ';');
101
-        $routineDefinition = $this->driver->jush() !== 'pgsql' ? "\n$definition;" :
102
-            ' AS ' . $this->driver->quote($definition);
100
+        $routineDefinition = $this->driver->jush() !== 'pgsql' ? "\n$definition;" : ' AS ' . $this->driver->quote($definition);
103 101
 
104 102
         return "CREATE {$routine->type} $routineName ($routineParams)" .
105 103
             "{$routineReturns}{$routineLanguage}{$routineDefinition};";
@@ -265,7 +263,7 @@  discard block
 block discarded – undo
265 263
      *
266 264
      * @return array|string
267 265
      */
268
-    public function exportDatabases(array $databases, array $options): array|string
266
+    public function exportDatabases(array $databases, array $options): array | string
269 267
     {
270 268
         // From dump.inc.php
271 269
         // $tables = array_flip($options['tables']) + array_flip($options['data']);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -279,8 +279,7 @@
 block discarded – undo
279 279
         foreach ($databases as $database => $tables) {
280 280
             try {
281 281
                 $this->dumpDatabase($database, $tables);
282
-            }
283
-            catch (Exception $e) {
282
+            } catch (Exception $e) {
284 283
                 return $e->getMessage();
285 284
             }
286 285
         }
Please login to merge, or discard this patch.
config/dbadmin.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
 function getAuth($di): Config\AuthInterface
13 13
 {
14 14
     return $di->h(Config\AuthInterface::class) ?
15
-        $di->g(Config\AuthInterface::class) :
16
-        new class implements Config\AuthInterface {
15
+        $di->g(Config\AuthInterface::class) : new class implements Config\AuthInterface {
17 16
             public function user(): string
18 17
             {
19 18
                 return '';
@@ -64,7 +63,7 @@  discard block
 block discarded – undo
64 63
             Driver\DriverInterface::class => function($di) {
65 64
                 // Register a driver for each database server.
66 65
                 $package = $di->g(Lagdo\DbAdmin\DbAdminPackage::class);
67
-                foreach($package->getServers() as $server => $options) {
66
+                foreach ($package->getServers() as $server => $options) {
68 67
                     $di->set("dbadmin_driver_$server", fn() =>
69 68
                         Db\AppDriver::createDriver($options));
70 69
                 }
Please login to merge, or discard this patch.
config/logging.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
             Driver\DriverInterface::class => function($di) {
63 63
                 // Register a driver for each database server.
64 64
                 $package = $di->g(Lagdo\DbAdmin\DbAdminPackage::class);
65
-                foreach($package->getServers() as $server => $options) {
65
+                foreach ($package->getServers() as $server => $options) {
66 66
                     $di->set("dbadmin_driver_$server", fn() =>
67 67
                         Db\AppDriver::createDriver($options));
68 68
                 }
Please login to merge, or discard this patch.