Passed
Push — master ( 13c085...f6895e )
by P.R.
07:34
created
src/DiffTable.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -229,20 +229,20 @@  discard block
 block discarded – undo
229 229
       if (in_array($column, $auditColumns))
230 230
       {
231 231
         $this->rows[] = ['name'     => $column,
232
-                         'audit'    => $this->auditTable->getColumns()->getColumn($column),
233
-                         'data'     => $this->dataTable->getColumns()->getColumn($column),
234
-                         'type'     => 'column',
235
-                         'new'      => false,
236
-                         'obsolete' => false];
232
+                          'audit'    => $this->auditTable->getColumns()->getColumn($column),
233
+                          'data'     => $this->dataTable->getColumns()->getColumn($column),
234
+                          'type'     => 'column',
235
+                          'new'      => false,
236
+                          'obsolete' => false];
237 237
       }
238 238
       else
239 239
       {
240 240
         $this->rows[] = ['name'     => $column,
241
-                         'audit'    => null,
242
-                         'data'     => $this->dataTable->getColumns()->getColumn($column),
243
-                         'type'     => 'column',
244
-                         'new'      => true,
245
-                         'obsolete' => false];
241
+                          'audit'    => null,
242
+                          'data'     => $this->dataTable->getColumns()->getColumn($column),
243
+                          'type'     => 'column',
244
+                          'new'      => true,
245
+                          'obsolete' => false];
246 246
       }
247 247
     }
248 248
 
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
       if (!in_array($column, $dataColumns))
252 252
       {
253 253
         $this->rows[] = ['name'     => $column,
254
-                         'audit'    => $this->auditTable->getColumns()->getColumn($column),
255
-                         'data'     => null,
256
-                         'type'     => 'column',
257
-                         'new'      => false,
258
-                         'obsolete' => true];
254
+                          'audit'    => $this->auditTable->getColumns()->getColumn($column),
255
+                          'data'     => null,
256
+                          'type'     => 'column',
257
+                          'new'      => false,
258
+                          'obsolete' => true];
259 259
       }
260 260
     }
261 261
   }
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
     foreach ($dataOptions as $option)
273 273
     {
274 274
       $this->rows[] = ['name'    => $option,
275
-                       'audit1'  => $this->auditTable->getProperty($option),
276
-                       'data1'   => $this->dataTable->getProperty($option),
277
-                       'type'    => 'option',
278
-                       'rowspan' => 1];
275
+                        'audit1'  => $this->auditTable->getProperty($option),
276
+                        'data1'   => $this->dataTable->getProperty($option),
277
+                        'type'    => 'option',
278
+                        'rowspan' => 1];
279 279
     }
280 280
 
281 281
     foreach ($auditOptions as $option)
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
       if (!in_array($option, $dataOptions))
284 284
       {
285 285
         $this->rows[] = ['name'    => $option,
286
-                         'audit1'  => $this->auditTable->getProperty($option),
287
-                         'data2'   => null,
288
-                         'type'    => 'option',
289
-                         'rowspan' => 1];
286
+                          'audit1'  => $this->auditTable->getProperty($option),
287
+                          'data2'   => null,
288
+                          'type'    => 'option',
289
+                          'rowspan' => 1];
290 290
       }
291 291
     }
292 292
   }
Please login to merge, or discard this patch.
src/Command/DiffCommand.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
32 32
   protected function configure()
33 33
   {
34 34
     $this->setName('diff')
35
-         ->setDescription('Compares data tables and audit tables')
36
-         ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file')
37
-         ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns');
35
+          ->setDescription('Compares data tables and audit tables')
36
+          ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file')
37
+          ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns');
38 38
   }
39 39
 
40 40
   //--------------------------------------------------------------------------------------------------------------------
Please login to merge, or discard this patch.
src/Command/AlterAuditTableCommand.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
   protected function configure()
32 32
   {
33 33
     $this->setName('alter-audit-table')
34
-         ->setDescription('Creates alter SQL statements for audit tables')
35
-         ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file')
36
-         ->addArgument('sql file', InputArgument::OPTIONAL, 'The destination file for the SQL statements');
34
+          ->setDescription('Creates alter SQL statements for audit tables')
35
+          ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file')
36
+          ->addArgument('sql file', InputArgument::OPTIONAL, 'The destination file for the SQL statements');
37 37
 
38 38
     $this->setHelp(<<<EOL
39 39
 Generates alter table SQL statements for aligning the audit tables with the 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 No SQL statements will be generated for missing or obsolete columns in the 
50 50
 audit tables. Use the command 'audit' for creating missing columns in audit
51 51
 tables.
52
-EOL
52
+eol
53 53
     );
54 54
   }
55 55
 
Please login to merge, or discard this patch.
src/Command/AuditCommand.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
   protected function configure()
23 23
   {
24 24
     $this->setName('audit')
25
-         ->setDescription('Maintains audit tables and audit triggers')
26
-         ->setHelp("Maintains audit tables and audit triggers:\n".
27
-                   "- creates new audit tables\n".
28
-                   "- adds new columns to exiting audit tables\n".
29
-                   "- creates new and recreates existing audit triggers\n")
30
-         ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file');
25
+          ->setDescription('Maintains audit tables and audit triggers')
26
+          ->setHelp("Maintains audit tables and audit triggers:\n".
27
+                    "- creates new audit tables\n".
28
+                    "- adds new columns to exiting audit tables\n".
29
+                    "- creates new and recreates existing audit triggers\n")
30
+          ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file');
31 31
   }
32 32
 
33 33
   //--------------------------------------------------------------------------------------------------------------------
Please login to merge, or discard this patch.
src/MySql/AuditDataLayer.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
                                      $tableColumns,
120 120
                                      $skipVariable,
121 121
                                      $additionSql);
122
-    $sql    = $helper->buildStatement();
122
+    $sql = $helper->buildStatement();
123 123
 
124 124
     $this->executeNone($sql);
125 125
   }
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
    *                                              columns and columns of the data table).
77 77
    */
78 78
   public function createAuditTable(string               $dataSchemaName,
79
-                                   string               $auditSchemaName,
80
-                                   string               $tableName,
81
-                                   TableColumnsMetadata $columns): void
79
+                                    string               $auditSchemaName,
80
+                                    string               $tableName,
81
+                                    TableColumnsMetadata $columns): void
82 82
   {
83 83
     $helper = new CreateAuditTable($dataSchemaName, $auditSchemaName, $tableName, $columns);
84 84
     $sql    = $helper->buildStatement();
@@ -102,24 +102,24 @@  discard block
 block discarded – undo
102 102
    * @param string[]             $additionSql            Additional SQL statements.
103 103
    */
104 104
   public function createAuditTrigger(string               $dataSchemaName,
105
-                                     string               $auditSchemaName,
106
-                                     string               $tableName,
107
-                                     string               $triggerName,
108
-                                     string               $triggerAction,
109
-                                     TableColumnsMetadata $additionalAuditColumns,
110
-                                     TableColumnsMetadata $tableColumns,
105
+                                      string               $auditSchemaName,
106
+                                      string               $tableName,
107
+                                      string               $triggerName,
108
+                                      string               $triggerAction,
109
+                                      TableColumnsMetadata $additionalAuditColumns,
110
+                                      TableColumnsMetadata $tableColumns,
111 111
                                      ?string              $skipVariable,
112
-                                     array                $additionSql): void
112
+                                      array                $additionSql): void
113 113
   {
114 114
     $helper = new CreateAuditTrigger($dataSchemaName,
115
-                                     $auditSchemaName,
116
-                                     $tableName,
117
-                                     $triggerName,
118
-                                     $triggerAction,
119
-                                     $additionalAuditColumns,
120
-                                     $tableColumns,
121
-                                     $skipVariable,
122
-                                     $additionSql);
115
+                                      $auditSchemaName,
116
+                                      $tableName,
117
+                                      $triggerName,
118
+                                      $triggerAction,
119
+                                      $additionalAuditColumns,
120
+                                      $tableColumns,
121
+                                      $skipVariable,
122
+                                      $additionSql);
123 123
     $sql    = $helper->buildStatement();
124 124
 
125 125
     $this->executeNone($sql);
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 where  TABLE_SCHEMA = %s
302 302
 and    TABLE_NAME   = %s
303 303
 order by ORDINAL_POSITION",
304
-                   $this->quoteString($schemaName),
305
-                   $this->quoteString($tableName));
304
+                    $this->quoteString($schemaName),
305
+                    $this->quoteString($tableName));
306 306
 
307 307
     return $this->executeRows($sql);
308 308
   }
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 inner join information_schema.COLLATION_CHARACTER_SET_APPLICABILITY t2  on  t2.COLLATION_NAME = t1.TABLE_COLLATION
329 329
 where t1.TABLE_SCHEMA = %s
330 330
 and   t1.TABLE_NAME   = %s',
331
-                   $this->quoteString($schemaName),
332
-                   $this->quoteString($tableName));
331
+                    $this->quoteString($schemaName),
332
+                    $this->quoteString($tableName));
333 333
 
334 334
     return $this->executeRow1($sql);
335 335
   }
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
 where  TRIGGER_SCHEMA     = %s
352 352
 and    EVENT_OBJECT_TABLE = %s
353 353
 order by Trigger_Name',
354
-                   $this->quoteString($schemaName),
355
-                   $this->quoteString($tableName));
354
+                    $this->quoteString($schemaName),
355
+                    $this->quoteString($tableName));
356 356
 
357 357
     return $this->executeRows($sql);
358 358
   }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 where  TRIGGER_SCHEMA     = %s
395 395
 order by EVENT_OBJECT_TABLE
396 396
 ,        TRIGGER_NAME',
397
-                   $this->quoteString($schemaName));
397
+                    $this->quoteString($schemaName));
398 398
 
399 399
     return $this->executeRows($sql);
400 400
   }
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
    * @return TableColumnsMetadata
424 424
    */
425 425
   public function resolveCanonicalAdditionalAuditColumns(string $auditSchema,
426
-                                                         array  $additionalAuditColumns): TableColumnsMetadata
426
+                                                          array  $additionalAuditColumns): TableColumnsMetadata
427 427
   {
428 428
     if (empty($additionalAuditColumns))
429 429
     {
Please login to merge, or discard this patch.
src/AuditTable.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -332,29 +332,29 @@
 block discarded – undo
332 332
    * @param TableColumnsMetadata $alteredColumns  The metadata of the altered columns.
333 333
    */
334 334
   private function logColumnInfo(TableColumnsMetadata $newColumns,
335
-                                 TableColumnsMetadata $obsoleteColumns,
336
-                                 TableColumnsMetadata $alteredColumns): void
335
+                                  TableColumnsMetadata $obsoleteColumns,
336
+                                  TableColumnsMetadata $alteredColumns): void
337 337
   {
338 338
     foreach ($newColumns->getColumns() as $column)
339 339
     {
340 340
       $this->io->logInfo('New column <dbo>%s.%s</dbo>',
341
-                         $this->tableName,
342
-                         $column->getName());
341
+                          $this->tableName,
342
+                          $column->getName());
343 343
     }
344 344
 
345 345
     foreach ($obsoleteColumns->getColumns() as $column)
346 346
     {
347 347
       $this->io->logInfo('Obsolete column <dbo>%s.%s</dbo>',
348
-                         $this->tableName,
349
-                         $column->getName());
348
+                          $this->tableName,
349
+                          $column->getName());
350 350
     }
351 351
 
352 352
     foreach ($alteredColumns->getColumns() as $column)
353 353
     {
354 354
       $this->io->logInfo('Type of <dbo>%s.%s</dbo> has been altered to <dbo>%s</dbo>',
355
-                         $this->tableName,
356
-                         $column->getName(),
357
-                         $column->getProperty('column_type'));
355
+                          $this->tableName,
356
+                          $column->getName(),
357
+                          $column->getProperty('column_type'));
358 358
     }
359 359
   }
360 360
 
Please login to merge, or discard this patch.
src/Command/DropTriggersCommand.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
   protected function configure()
22 22
   {
23 23
     $this->setName('drop-triggers')
24
-         ->setDescription('Drops all triggers')
25
-         ->setHelp('Drops all triggers (including triggers not created by audit) from all tables (including tables '.
26
-                   'excluded for auditing) in the data schema.')
27
-         ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file');
24
+          ->setDescription('Drops all triggers')
25
+          ->setHelp('Drops all triggers (including triggers not created by audit) from all tables (including tables '.
26
+                    'excluded for auditing) in the data schema.')
27
+          ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file');
28 28
   }
29 29
 
30 30
   //--------------------------------------------------------------------------------------------------------------------
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
     foreach ($triggers as $trigger)
61 61
     {
62 62
       $this->io->logInfo('Dropping trigger <dbo>%s</dbo> from table <dbo>%s</dbo>',
63
-                         $trigger['trigger_name'],
64
-                         $trigger['table_name']);
63
+                          $trigger['trigger_name'],
64
+                          $trigger['table_name']);
65 65
 
66 66
       AuditDataLayer::$dl->dropTrigger($dataSchema, $trigger['trigger_name']);
67 67
     }
Please login to merge, or discard this patch.
src/Command/BaseCommand.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,10 +99,10 @@
 block discarded – undo
99 99
   protected function connect(): void
100 100
   {
101 101
     $connector = new MySqlDefaultConnector($this->config->getManString('database.host'),
102
-                                           $this->config->getManString('database.user'),
103
-                                           $this->config->getManString('database.password'),
104
-                                           $this->config->getManString('database.data_schema'),
105
-                                           $this->config->getManInt('database.port', 3306));
102
+                                            $this->config->getManString('database.user'),
103
+                                            $this->config->getManString('database.password'),
104
+                                            $this->config->getManString('database.data_schema'),
105
+                                            $this->config->getManInt('database.port', 3306));
106 106
     $dl = new AuditDataLayer($connector, $this->io);
107 107
     $dl->connect();
108 108
   }
Please login to merge, or discard this patch.
src/Audit/Audit.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -160,12 +160,12 @@
 block discarded – undo
160 160
       if ($audit===true)
161 161
       {
162 162
         $currentTable = new AuditTable($this->io,
163
-                                       $this->config->getManString('database.data_schema'),
164
-                                       $this->config->getManString('database.audit_schema'),
165
-                                       $table['table_name'],
166
-                                       $this->additionalAuditColumns,
167
-                                       $this->config->getOptString('tables.'.$table['table_name'].'.alias'),
168
-                                       $this->config->getOptString('tables.'.$table['table_name'].'.skip'));
163
+                                        $this->config->getManString('database.data_schema'),
164
+                                        $this->config->getManString('database.audit_schema'),
165
+                                        $table['table_name'],
166
+                                        $this->additionalAuditColumns,
167
+                                        $this->config->getOptString('tables.'.$table['table_name'].'.alias'),
168
+                                        $this->config->getOptString('tables.'.$table['table_name'].'.skip'));
169 169
 
170 170
         // Ensure the audit table exists.
171 171
         if (RowSetHelper::searchInRowSet($this->auditSchemaTables, 'table_name', $table['table_name'])===null)
Please login to merge, or discard this patch.