Completed
Pull Request — master (#29)
by
unknown
02:32
created
src/Columns.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@
 block discarded – undo
144 144
    *
145 145
    * @param string $columnName The column name.
146 146
    *
147
-   * @return null|string
147
+   * @return integer|null
148 148
    */
149 149
   public function getPreviousColumn($columnName)
150 150
   {
Please login to merge, or discard this patch.
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -8,179 +8,179 @@
 block discarded – undo
8 8
  */
9 9
 class Columns
10 10
 {
11
-  //--------------------------------------------------------------------------------------------------------------------
12
-  /**
13
-   * The metadata of the columns.
14
-   *
15
-   * @var array[]
16
-   */
17
-  private $columns = [];
18
-
19
-  //--------------------------------------------------------------------------------------------------------------------
20
-  /**
21
-   * Object constructor.
22
-   *
23
-   * @param array[] $columns The metadata of the columns.
24
-   */
25
-  public function __construct($columns)
26
-  {
11
+    //--------------------------------------------------------------------------------------------------------------------
12
+    /**
13
+     * The metadata of the columns.
14
+     *
15
+     * @var array[]
16
+     */
17
+    private $columns = [];
18
+
19
+    //--------------------------------------------------------------------------------------------------------------------
20
+    /**
21
+     * Object constructor.
22
+     *
23
+     * @param array[] $columns The metadata of the columns.
24
+     */
25
+    public function __construct($columns)
26
+    {
27 27
     foreach ($columns as $column)
28 28
     {
29
-      $columnTypes                           = new ColumnTypes($column);
30
-      $this->columns[$column['column_name']] = $columnTypes->getTypes();
29
+        $columnTypes                           = new ColumnTypes($column);
30
+        $this->columns[$column['column_name']] = $columnTypes->getTypes();
31
+    }
31 32
     }
32
-  }
33
-
34
-  //--------------------------------------------------------------------------------------------------------------------
35
-  /**
36
-   * Generate array with audit columns and columns from data table.
37
-   *
38
-   * @param Columns $auditColumnsMetadata   AuditApplication columns for adding to exist columns
39
-   * @param Columns $currentColumnsMetadata Exist table columns
40
-   *
41
-   * @return Columns
42
-   */
43
-  public static function combine($auditColumnsMetadata, $currentColumnsMetadata)
44
-  {
33
+
34
+    //--------------------------------------------------------------------------------------------------------------------
35
+    /**
36
+     * Generate array with audit columns and columns from data table.
37
+     *
38
+     * @param Columns $auditColumnsMetadata   AuditApplication columns for adding to exist columns
39
+     * @param Columns $currentColumnsMetadata Exist table columns
40
+     *
41
+     * @return Columns
42
+     */
43
+    public static function combine($auditColumnsMetadata, $currentColumnsMetadata)
44
+    {
45 45
     $columns = [];
46 46
 
47 47
     foreach ($auditColumnsMetadata->columns as $column)
48 48
     {
49
-      $columns[] = ['column_name' => $column['column_name'],
49
+        $columns[] = ['column_name' => $column['column_name'],
50 50
                     'column_type' => $column['column_type']];
51 51
     }
52 52
 
53 53
     foreach ($currentColumnsMetadata->columns as $column)
54 54
     {
55
-      if ($column['column_type']!='timestamp')
56
-      {
55
+        if ($column['column_type']!='timestamp')
56
+        {
57 57
         $columns[] = ['column_name' => $column['column_name'],
58
-                      'column_type' => $column['column_type']];
59
-      }
60
-      else
61
-      {
58
+                        'column_type' => $column['column_type']];
59
+        }
60
+        else
61
+        {
62 62
         $columns[] = ['column_name' => $column['column_name'],
63
-                      'column_type' => $column['column_type'].' NULL'];
64
-      }
63
+                        'column_type' => $column['column_type'].' NULL'];
64
+        }
65 65
     }
66 66
 
67 67
     return new Columns($columns);
68
-  }
69
-
70
-  //--------------------------------------------------------------------------------------------------------------------
71
-  /**
72
-   * Compares two Columns objects and returns an array with columns that are in the first columns object and in the
73
-   * second Columns object but have different types.
74
-   *
75
-   * @param Columns $columns1 The first Columns object.
76
-   * @param Columns $columns2 The second Columns object.
77
-   *
78
-   * @return Columns
79
-   */
80
-  public static function differentColumnTypes($columns1, $columns2)
81
-  {
68
+    }
69
+
70
+    //--------------------------------------------------------------------------------------------------------------------
71
+    /**
72
+     * Compares two Columns objects and returns an array with columns that are in the first columns object and in the
73
+     * second Columns object but have different types.
74
+     *
75
+     * @param Columns $columns1 The first Columns object.
76
+     * @param Columns $columns2 The second Columns object.
77
+     *
78
+     * @return Columns
79
+     */
80
+    public static function differentColumnTypes($columns1, $columns2)
81
+    {
82 82
     $diff = [];
83 83
     foreach ($columns2->columns as $column2)
84 84
     {
85
-      if (isset($columns1->columns[$column2['column_name']]))
86
-      {
85
+        if (isset($columns1->columns[$column2['column_name']]))
86
+        {
87 87
         $column1 = $columns1->columns[$column2['column_name']];
88 88
         if ($column2['column_type']!=$column1['column_type'])
89 89
         {
90
-          $diff[] = $column1;
90
+            $diff[] = $column1;
91
+        }
91 92
         }
92
-      }
93 93
     }
94 94
 
95 95
     return new Columns($diff);
96
-  }
97
-
98
-  //--------------------------------------------------------------------------------------------------------------------
99
-  /**
100
-   * Compares two Columns objects and returns an array with columns that are in the first columns object but not in the
101
-   * second Columns object.
102
-   *
103
-   * @param Columns $columns1 The first Columns object.
104
-   * @param Columns $columns2 The second Columns object.
105
-   *
106
-   * @return Columns
107
-   */
108
-  public static function notInOtherSet($columns1, $columns2)
109
-  {
96
+    }
97
+
98
+    //--------------------------------------------------------------------------------------------------------------------
99
+    /**
100
+     * Compares two Columns objects and returns an array with columns that are in the first columns object but not in the
101
+     * second Columns object.
102
+     *
103
+     * @param Columns $columns1 The first Columns object.
104
+     * @param Columns $columns2 The second Columns object.
105
+     *
106
+     * @return Columns
107
+     */
108
+    public static function notInOtherSet($columns1, $columns2)
109
+    {
110 110
     $diff = [];
111 111
     if (isset($columns1))
112 112
     {
113
-      foreach ($columns1->columns as $column1)
114
-      {
113
+        foreach ($columns1->columns as $column1)
114
+        {
115 115
         if (!isset($columns2->columns[$column1['column_name']]))
116 116
         {
117
-          $diff[] = ['column_name' => $column1['column_name'],
118
-                     'column_type' => $column1['column_type']];
117
+            $diff[] = ['column_name' => $column1['column_name'],
118
+                        'column_type' => $column1['column_type']];
119
+        }
119 120
         }
120
-      }
121 121
     }
122 122
 
123 123
     return new Columns($diff);
124
-  }
125
-
126
-  //--------------------------------------------------------------------------------------------------------------------
127
-  /**
128
-   * Returns the underlying array with metadata of the columns.
129
-   *
130
-   * @return array[]
131
-   */
132
-  public function getColumns()
133
-  {
124
+    }
125
+
126
+    //--------------------------------------------------------------------------------------------------------------------
127
+    /**
128
+     * Returns the underlying array with metadata of the columns.
129
+     *
130
+     * @return array[]
131
+     */
132
+    public function getColumns()
133
+    {
134 134
     return $this->columns;
135
-  }
136
-
137
-  //--------------------------------------------------------------------------------------------------------------------
138
-  /**
139
-   * Return column type with character set and collation.
140
-   *
141
-   * @param string $columnName The column name.
142
-   *
143
-   * @return null|string
144
-   */
145
-  public function getColumnTypeWithCharSetCollation($columnName)
146
-  {
135
+    }
136
+
137
+    //--------------------------------------------------------------------------------------------------------------------
138
+    /**
139
+     * Return column type with character set and collation.
140
+     *
141
+     * @param string $columnName The column name.
142
+     *
143
+     * @return null|string
144
+     */
145
+    public function getColumnTypeWithCharSetCollation($columnName)
146
+    {
147 147
     $columns = array_keys($this->columns);
148 148
     $key     = array_search($columnName, $columns);
149 149
 
150 150
     if ($key!==false)
151 151
     {
152
-      $column                       = $this->columns[$columns[$key]];
153
-      $column['character_set_name'] = isset($column['character_set_name']) ? ' '.$column['character_set_name'] : '';
154
-      $column['collation_name']     = isset($column['collation_name']) ? ' '.$column['collation_name'] : '';
152
+        $column                       = $this->columns[$columns[$key]];
153
+        $column['character_set_name'] = isset($column['character_set_name']) ? ' '.$column['character_set_name'] : '';
154
+        $column['collation_name']     = isset($column['collation_name']) ? ' '.$column['collation_name'] : '';
155 155
 
156
-      return sprintf('%s%s%s', $column['column_type'], $column['character_set_name'], $column['collation_name']);
156
+        return sprintf('%s%s%s', $column['column_type'], $column['character_set_name'], $column['collation_name']);
157 157
     }
158 158
 
159 159
     return null;
160
-  }
161
-
162
-  //--------------------------------------------------------------------------------------------------------------------
163
-  /**
164
-   * Returns previous column of a columns. Returns null if the column name is not found in this Columns.
165
-   *
166
-   * @param string $columnName The column name.
167
-   *
168
-   * @return null|string
169
-   */
170
-  public function getPreviousColumn($columnName)
171
-  {
160
+    }
161
+
162
+    //--------------------------------------------------------------------------------------------------------------------
163
+    /**
164
+     * Returns previous column of a columns. Returns null if the column name is not found in this Columns.
165
+     *
166
+     * @param string $columnName The column name.
167
+     *
168
+     * @return null|string
169
+     */
170
+    public function getPreviousColumn($columnName)
171
+    {
172 172
     $columns = array_keys($this->columns);
173 173
     $key     = array_search($columnName, $columns);
174 174
 
175 175
     if ($key>=1)
176 176
     {
177
-      return $columns[$key - 1];
177
+        return $columns[$key - 1];
178 178
     }
179 179
 
180 180
     return null;
181
-  }
181
+    }
182 182
 
183
-  //--------------------------------------------------------------------------------------------------------------------
183
+    //--------------------------------------------------------------------------------------------------------------------
184 184
 }
185 185
 
186 186
 //----------------------------------------------------------------------------------------------------------------------
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     foreach ($currentColumnsMetadata->columns as $column)
54 54
     {
55
-      if ($column['column_type']!='timestamp')
55
+      if ($column['column_type'] != 'timestamp')
56 56
       {
57 57
         $columns[] = ['column_name' => $column['column_name'],
58 58
                       'column_type' => $column['column_type']];
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
       if (isset($columns1->columns[$column2['column_name']]))
86 86
       {
87 87
         $column1 = $columns1->columns[$column2['column_name']];
88
-        if ($column2['column_type']!=$column1['column_type'])
88
+        if ($column2['column_type'] != $column1['column_type'])
89 89
         {
90 90
           $diff[] = $column1;
91 91
         }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     $columns = array_keys($this->columns);
148 148
     $key     = array_search($columnName, $columns);
149 149
 
150
-    if ($key!==false)
150
+    if ($key !== false)
151 151
     {
152 152
       $column                       = $this->columns[$columns[$key]];
153 153
       $column['character_set_name'] = isset($column['character_set_name']) ? ' '.$column['character_set_name'] : '';
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     $columns = array_keys($this->columns);
173 173
     $key     = array_search($columnName, $columns);
174 174
 
175
-    if ($key>=1)
175
+    if ($key >= 1)
176 176
     {
177 177
       return $columns[$key - 1];
178 178
     }
Please login to merge, or discard this patch.
src/MySql/DataLayer.php 1 patch
Indentation   +279 added lines, -279 removed lines patch added patch discarded remove patch
@@ -15,90 +15,90 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class DataLayer
17 17
 {
18
-  //--------------------------------------------------------------------------------------------------------------------
19
-  /**
20
-   * The connection to the MySQL instance.
21
-   *
22
-   * @var StaticDataLayer
23
-   */
24
-  private static $dl;
25
-
26
-  /**
27
-   * The Output decorator.
28
-   *
29
-   * @var StratumStyle
30
-   */
31
-  private static $io;
32
-
33
-  //--------------------------------------------------------------------------------------------------------------------
34
-  /**
35
-   * Adds new columns to an audit table.
36
-   *
37
-   * @param string  $auditSchemaName The name of audit schema.
38
-   * @param string  $tableName       The name of the table.
39
-   * @param Columns $columns         The metadata of the new columns.
40
-   */
41
-  public static function addNewColumns($auditSchemaName, $tableName, $columns)
42
-  {
18
+    //--------------------------------------------------------------------------------------------------------------------
19
+    /**
20
+     * The connection to the MySQL instance.
21
+     *
22
+     * @var StaticDataLayer
23
+     */
24
+    private static $dl;
25
+
26
+    /**
27
+     * The Output decorator.
28
+     *
29
+     * @var StratumStyle
30
+     */
31
+    private static $io;
32
+
33
+    //--------------------------------------------------------------------------------------------------------------------
34
+    /**
35
+     * Adds new columns to an audit table.
36
+     *
37
+     * @param string  $auditSchemaName The name of audit schema.
38
+     * @param string  $tableName       The name of the table.
39
+     * @param Columns $columns         The metadata of the new columns.
40
+     */
41
+    public static function addNewColumns($auditSchemaName, $tableName, $columns)
42
+    {
43 43
     $helper = new AlterAuditTableAddColumns($auditSchemaName, $tableName, $columns);
44 44
     $sql    = $helper->buildStatement();
45 45
 
46 46
     self::executeNone($sql);
47
-  }
48
-
49
-  //--------------------------------------------------------------------------------------------------------------------
50
-  /**
51
-   * Connects to a MySQL instance.
52
-   *
53
-   * Wrapper around [mysqli::__construct](http://php.net/manual/mysqli.construct.php), however on failure an exception
54
-   * is thrown.
55
-   *
56
-   * @param string $host     The hostname.
57
-   * @param string $user     The MySQL user name.
58
-   * @param string $passWord The password.
59
-   * @param string $database The default database.
60
-   * @param int    $port     The port number.
61
-   */
62
-  public static function connect($host, $user, $passWord, $database, $port = 3306)
63
-  {
47
+    }
48
+
49
+    //--------------------------------------------------------------------------------------------------------------------
50
+    /**
51
+     * Connects to a MySQL instance.
52
+     *
53
+     * Wrapper around [mysqli::__construct](http://php.net/manual/mysqli.construct.php), however on failure an exception
54
+     * is thrown.
55
+     *
56
+     * @param string $host     The hostname.
57
+     * @param string $user     The MySQL user name.
58
+     * @param string $passWord The password.
59
+     * @param string $database The default database.
60
+     * @param int    $port     The port number.
61
+     */
62
+    public static function connect($host, $user, $passWord, $database, $port = 3306)
63
+    {
64 64
     self::$dl = new StaticDataLayer();
65 65
 
66 66
     self::$dl->connect($host, $user, $passWord, $database, $port);
67
-  }
68
-
69
-  //--------------------------------------------------------------------------------------------------------------------
70
-  /**
71
-   * Creates an audit table.
72
-   *
73
-   * @param string  $dataSchemaName  The name of the data schema.
74
-   * @param string  $auditSchemaName The name of the audit schema.
75
-   * @param string  $tableName       The name of the table.
76
-   * @param Columns $columns         The metadata of the columns of the audit table (i.e. the audit columns and columns
77
-   *                                 of the data table).
78
-   */
79
-  public static function createAuditTable($dataSchemaName, $auditSchemaName, $tableName, $columns)
80
-  {
67
+    }
68
+
69
+    //--------------------------------------------------------------------------------------------------------------------
70
+    /**
71
+     * Creates an audit table.
72
+     *
73
+     * @param string  $dataSchemaName  The name of the data schema.
74
+     * @param string  $auditSchemaName The name of the audit schema.
75
+     * @param string  $tableName       The name of the table.
76
+     * @param Columns $columns         The metadata of the columns of the audit table (i.e. the audit columns and columns
77
+     *                                 of the data table).
78
+     */
79
+    public static function createAuditTable($dataSchemaName, $auditSchemaName, $tableName, $columns)
80
+    {
81 81
     $helper = new CreateAuditTable($dataSchemaName, $auditSchemaName, $tableName, $columns);
82 82
     $sql    = $helper->buildStatement();
83 83
 
84 84
     self::executeNone($sql);
85
-  }
86
-
87
-  //--------------------------------------------------------------------------------------------------------------------
88
-  /**
89
-   * Creates a trigger on a table.
90
-   *
91
-   * @param string   $dataSchemaName  The name of the data schema.
92
-   * @param string   $auditSchemaName The name of the audit schema.
93
-   * @param string   $tableName       The name of the table.
94
-   * @param string   $triggerAction   The trigger action (i.e. INSERT, UPDATE, or DELETE).
95
-   * @param string   $triggerName     The name of the trigger.
96
-   * @param Columns  $tableColumns    The data table columns.
97
-   * @param Columns  $auditColumns    The audit table columns.
98
-   * @param string   $skipVariable    The skip variable.
99
-   * @param string[] $additionSql     Additional SQL statements.
100
-   */
101
-  public static function createAuditTrigger($dataSchemaName,
85
+    }
86
+
87
+    //--------------------------------------------------------------------------------------------------------------------
88
+    /**
89
+     * Creates a trigger on a table.
90
+     *
91
+     * @param string   $dataSchemaName  The name of the data schema.
92
+     * @param string   $auditSchemaName The name of the audit schema.
93
+     * @param string   $tableName       The name of the table.
94
+     * @param string   $triggerAction   The trigger action (i.e. INSERT, UPDATE, or DELETE).
95
+     * @param string   $triggerName     The name of the trigger.
96
+     * @param Columns  $tableColumns    The data table columns.
97
+     * @param Columns  $auditColumns    The audit table columns.
98
+     * @param string   $skipVariable    The skip variable.
99
+     * @param string[] $additionSql     Additional SQL statements.
100
+     */
101
+    public static function createAuditTrigger($dataSchemaName,
102 102
                                             $auditSchemaName,
103 103
                                             $tableName,
104 104
                                             $triggerAction,
@@ -107,151 +107,151 @@  discard block
 block discarded – undo
107 107
                                             $auditColumns,
108 108
                                             $skipVariable,
109 109
                                             $additionSql)
110
-  {
110
+    {
111 111
     $helper = new CreateAuditTrigger($dataSchemaName,
112
-                                     $auditSchemaName,
113
-                                     $tableName,
114
-                                     $triggerAction,
115
-                                     $triggerName,
116
-                                     $tableColumns,
117
-                                     $auditColumns,
118
-                                     $skipVariable,
119
-                                     $additionSql);
112
+                                        $auditSchemaName,
113
+                                        $tableName,
114
+                                        $triggerAction,
115
+                                        $triggerName,
116
+                                        $tableColumns,
117
+                                        $auditColumns,
118
+                                        $skipVariable,
119
+                                        $additionSql);
120 120
     $sql    = $helper->buildStatement();
121 121
 
122 122
     self::executeNone($sql);
123
-  }
124
-
125
-  //--------------------------------------------------------------------------------------------------------------------
126
-  /**
127
-   * Closes the connection to the MySQL instance, if connected.
128
-   */
129
-  public static function disconnect()
130
-  {
123
+    }
124
+
125
+    //--------------------------------------------------------------------------------------------------------------------
126
+    /**
127
+     * Closes the connection to the MySQL instance, if connected.
128
+     */
129
+    public static function disconnect()
130
+    {
131 131
     if (self::$dl!==null)
132 132
     {
133
-      self::$dl->disconnect();
134
-      self::$dl = null;
133
+        self::$dl->disconnect();
134
+        self::$dl = null;
135
+    }
135 136
     }
136
-  }
137
-
138
-  //--------------------------------------------------------------------------------------------------------------------
139
-  /**
140
-   * Drops a trigger.
141
-   *
142
-   * @param string $triggerSchema The name of the trigger schema.
143
-   * @param string $triggerName   The mame of trigger.
144
-   */
145
-  public static function dropTrigger($triggerSchema, $triggerName)
146
-  {
137
+
138
+    //--------------------------------------------------------------------------------------------------------------------
139
+    /**
140
+     * Drops a trigger.
141
+     *
142
+     * @param string $triggerSchema The name of the trigger schema.
143
+     * @param string $triggerName   The mame of trigger.
144
+     */
145
+    public static function dropTrigger($triggerSchema, $triggerName)
146
+    {
147 147
     $sql = sprintf('drop trigger `%s`.`%s`', $triggerSchema, $triggerName);
148 148
 
149 149
     self::executeNone($sql);
150
-  }
151
-
152
-  //--------------------------------------------------------------------------------------------------------------------
153
-  /**
154
-   * @param string $query The SQL statement.
155
-   *
156
-   * @return int The number of affected rows (if any).
157
-   */
158
-  public static function executeNone($query)
159
-  {
150
+    }
151
+
152
+    //--------------------------------------------------------------------------------------------------------------------
153
+    /**
154
+     * @param string $query The SQL statement.
155
+     *
156
+     * @return int The number of affected rows (if any).
157
+     */
158
+    public static function executeNone($query)
159
+    {
160 160
     self::logQuery($query);
161 161
 
162 162
     return self::$dl->executeNone($query);
163
-  }
164
-
165
-  //--------------------------------------------------------------------------------------------------------------------
166
-  /**
167
-   * Executes a query that returns 0 or 1 row.
168
-   * Throws an exception if the query selects 2 or more rows.
169
-   *
170
-   * @param string $query The SQL statement.
171
-   *
172
-   * @return array|null The selected row.
173
-   */
174
-  public static function executeRow0($query)
175
-  {
163
+    }
164
+
165
+    //--------------------------------------------------------------------------------------------------------------------
166
+    /**
167
+     * Executes a query that returns 0 or 1 row.
168
+     * Throws an exception if the query selects 2 or more rows.
169
+     *
170
+     * @param string $query The SQL statement.
171
+     *
172
+     * @return array|null The selected row.
173
+     */
174
+    public static function executeRow0($query)
175
+    {
176 176
     self::logQuery($query);
177 177
 
178 178
     return self::$dl->executeRow0($query);
179
-  }
180
-
181
-  //--------------------------------------------------------------------------------------------------------------------
182
-  /**
183
-   * Executes a query that returns 1 and only 1 row.
184
-   * Throws an exception if the query selects none, 2 or more rows.
185
-   *
186
-   * @param string $query The SQL statement.
187
-   *
188
-   * @return array The selected row.
189
-   */
190
-  public static function executeRow1($query)
191
-  {
179
+    }
180
+
181
+    //--------------------------------------------------------------------------------------------------------------------
182
+    /**
183
+     * Executes a query that returns 1 and only 1 row.
184
+     * Throws an exception if the query selects none, 2 or more rows.
185
+     *
186
+     * @param string $query The SQL statement.
187
+     *
188
+     * @return array The selected row.
189
+     */
190
+    public static function executeRow1($query)
191
+    {
192 192
     self::logQuery($query);
193 193
 
194 194
     return self::$dl->executeRow1($query);
195
-  }
196
-
197
-  //--------------------------------------------------------------------------------------------------------------------
198
-  /**
199
-   * Executes a query that returns 0 or more rows.
200
-   *
201
-   * @param string $query The SQL statement.
202
-   *
203
-   * @return \array[]
204
-   */
205
-  public static function executeRows($query)
206
-  {
195
+    }
196
+
197
+    //--------------------------------------------------------------------------------------------------------------------
198
+    /**
199
+     * Executes a query that returns 0 or more rows.
200
+     *
201
+     * @param string $query The SQL statement.
202
+     *
203
+     * @return \array[]
204
+     */
205
+    public static function executeRows($query)
206
+    {
207 207
     self::logQuery($query);
208 208
 
209 209
     return self::$dl->executeRows($query);
210
-  }
211
-
212
-  //--------------------------------------------------------------------------------------------------------------------
213
-  /**
214
-   * Executes a query that returns 0 or 1 row.
215
-   * Throws an exception if the query selects 2 or more rows.
216
-   *
217
-   * @param string $query The SQL statement.
218
-   *
219
-   * @return int|string|null The selected row.
220
-   */
221
-  public static function executeSingleton0($query)
222
-  {
210
+    }
211
+
212
+    //--------------------------------------------------------------------------------------------------------------------
213
+    /**
214
+     * Executes a query that returns 0 or 1 row.
215
+     * Throws an exception if the query selects 2 or more rows.
216
+     *
217
+     * @param string $query The SQL statement.
218
+     *
219
+     * @return int|string|null The selected row.
220
+     */
221
+    public static function executeSingleton0($query)
222
+    {
223 223
     self::logQuery($query);
224 224
 
225 225
     return self::$dl->executeSingleton0($query);
226
-  }
227
-
228
-  //--------------------------------------------------------------------------------------------------------------------
229
-  /**
230
-   * Executes a query that returns 1 and only 1 row with 1 column.
231
-   * Throws an exception if the query selects none, 2 or more rows.
232
-   *
233
-   * @param string $query The SQL statement.
234
-   *
235
-   * @return int|string The selected row.
236
-   */
237
-  public static function executeSingleton1($query)
238
-  {
226
+    }
227
+
228
+    //--------------------------------------------------------------------------------------------------------------------
229
+    /**
230
+     * Executes a query that returns 1 and only 1 row with 1 column.
231
+     * Throws an exception if the query selects none, 2 or more rows.
232
+     *
233
+     * @param string $query The SQL statement.
234
+     *
235
+     * @return int|string The selected row.
236
+     */
237
+    public static function executeSingleton1($query)
238
+    {
239 239
     self::logQuery($query);
240 240
 
241 241
     return self::$dl->executeSingleton1($query);
242
-  }
243
-
244
-  //--------------------------------------------------------------------------------------------------------------------
245
-  /**
246
-   * Selects metadata of all columns of table.
247
-   *
248
-   * @param string $schemaName The name of the table schema.
249
-   * @param string $tableName  The name of the table.
250
-   *
251
-   * @return \array[]
252
-   */
253
-  public static function getTableColumns($schemaName, $tableName)
254
-  {
242
+    }
243
+
244
+    //--------------------------------------------------------------------------------------------------------------------
245
+    /**
246
+     * Selects metadata of all columns of table.
247
+     *
248
+     * @param string $schemaName The name of the table schema.
249
+     * @param string $tableName  The name of the table.
250
+     *
251
+     * @return \array[]
252
+     */
253
+    public static function getTableColumns($schemaName, $tableName)
254
+    {
255 255
     $sql = sprintf('
256 256
 select COLUMN_NAME        as column_name
257 257
 ,      COLUMN_TYPE        as column_type
@@ -262,23 +262,23 @@  discard block
 block discarded – undo
262 262
 where  TABLE_SCHEMA = %s
263 263
 and    TABLE_NAME   = %s
264 264
 order by ORDINAL_POSITION',
265
-                   self::$dl->quoteString($schemaName),
266
-                   self::$dl->quoteString($tableName));
265
+                    self::$dl->quoteString($schemaName),
266
+                    self::$dl->quoteString($tableName));
267 267
 
268 268
     return self::$dl->executeRows($sql);
269
-  }
270
-
271
-  //--------------------------------------------------------------------------------------------------------------------
272
-  /**
273
-   * Selects table engine, character_set_name and table_collation.
274
-   *
275
-   * @param string $schemaName The name of the table schema.
276
-   * @param string $tableName  The name of the table.
277
-   *
278
-   * @return array
279
-   */
280
-  public static function getTableOptions($schemaName, $tableName)
281
-  {
269
+    }
270
+
271
+    //--------------------------------------------------------------------------------------------------------------------
272
+    /**
273
+     * Selects table engine, character_set_name and table_collation.
274
+     *
275
+     * @param string $schemaName The name of the table schema.
276
+     * @param string $tableName  The name of the table.
277
+     *
278
+     * @return array
279
+     */
280
+    public static function getTableOptions($schemaName, $tableName)
281
+    {
282 282
     $sql = sprintf('
283 283
 SELECT t1.TABLE_COLLATION    as table_collation
284 284
 ,      t1.ENGINE             as engine
@@ -287,45 +287,45 @@  discard block
 block discarded – undo
287 287
 inner join information_schema.COLLATION_CHARACTER_SET_APPLICABILITY t2  on  t2.COLLATION_NAME = t1.TABLE_COLLATION
288 288
 WHERE t1.TABLE_SCHEMA = %s
289 289
 AND   t1.TABLE_NAME   = %s',
290
-                   self::$dl->quoteString($schemaName),
291
-                   self::$dl->quoteString($tableName));
290
+                    self::$dl->quoteString($schemaName),
291
+                    self::$dl->quoteString($tableName));
292 292
 
293 293
     return self::$dl->executeRow1($sql);
294
-  }
295
-
296
-  //--------------------------------------------------------------------------------------------------------------------
297
-  /**
298
-   * Selects all triggers on a table.
299
-   *
300
-   * @param string $schemaName The name of the table schema.
301
-   * @param string $tableName  The name of the table.
302
-   *
303
-   * @return \array[]
304
-   */
305
-  public static function getTableTriggers($schemaName, $tableName)
306
-  {
294
+    }
295
+
296
+    //--------------------------------------------------------------------------------------------------------------------
297
+    /**
298
+     * Selects all triggers on a table.
299
+     *
300
+     * @param string $schemaName The name of the table schema.
301
+     * @param string $tableName  The name of the table.
302
+     *
303
+     * @return \array[]
304
+     */
305
+    public static function getTableTriggers($schemaName, $tableName)
306
+    {
307 307
     $sql = sprintf('
308 308
 select Trigger_Name as trigger_name
309 309
 from   information_schema.TRIGGERS
310 310
 where  TRIGGER_SCHEMA     = %s
311 311
 and    EVENT_OBJECT_TABLE = %s
312 312
 order by Trigger_Name',
313
-                   self::$dl->quoteString($schemaName),
314
-                   self::$dl->quoteString($tableName));
313
+                    self::$dl->quoteString($schemaName),
314
+                    self::$dl->quoteString($tableName));
315 315
 
316 316
     return self::$dl->executeRows($sql);
317
-  }
318
-
319
-  //--------------------------------------------------------------------------------------------------------------------
320
-  /**
321
-   * Selects all table names in a schema.
322
-   *
323
-   * @param string $schemaName The name of the schema.
324
-   *
325
-   * @return \array[]
326
-   */
327
-  public static function getTablesNames($schemaName)
328
-  {
317
+    }
318
+
319
+    //--------------------------------------------------------------------------------------------------------------------
320
+    /**
321
+     * Selects all table names in a schema.
322
+     *
323
+     * @param string $schemaName The name of the schema.
324
+     *
325
+     * @return \array[]
326
+     */
327
+    public static function getTablesNames($schemaName)
328
+    {
329 329
     $sql = sprintf("
330 330
 select TABLE_NAME as table_name
331 331
 from   information_schema.TABLES
@@ -334,67 +334,67 @@  discard block
 block discarded – undo
334 334
 order by TABLE_NAME", self::$dl->quoteString($schemaName));
335 335
 
336 336
     return self::$dl->executeRows($sql);
337
-  }
338
-
339
-  //--------------------------------------------------------------------------------------------------------------------
340
-  /**
341
-   * Acquires a write lock on a table.
342
-   *
343
-   * @param string $tableName The table name.
344
-   */
345
-  public static function lockTable($tableName)
346
-  {
337
+    }
338
+
339
+    //--------------------------------------------------------------------------------------------------------------------
340
+    /**
341
+     * Acquires a write lock on a table.
342
+     *
343
+     * @param string $tableName The table name.
344
+     */
345
+    public static function lockTable($tableName)
346
+    {
347 347
     $sql = sprintf('lock tables `%s` write', $tableName);
348 348
 
349 349
     self::$dl->executeNone($sql);
350
-  }
351
-
352
-  //--------------------------------------------------------------------------------------------------------------------
353
-  /**
354
-   * Sets the Output decorator.
355
-   *
356
-   * @param StratumStyle $io The Output decorator.
357
-   */
358
-  public static function setIo($io)
359
-  {
350
+    }
351
+
352
+    //--------------------------------------------------------------------------------------------------------------------
353
+    /**
354
+     * Sets the Output decorator.
355
+     *
356
+     * @param StratumStyle $io The Output decorator.
357
+     */
358
+    public static function setIo($io)
359
+    {
360 360
     self::$io = $io;
361
-  }
362
-
363
-  //--------------------------------------------------------------------------------------------------------------------
364
-  /**
365
-   * Releases all table locks.
366
-   */
367
-  public static function unlockTables()
368
-  {
361
+    }
362
+
363
+    //--------------------------------------------------------------------------------------------------------------------
364
+    /**
365
+     * Releases all table locks.
366
+     */
367
+    public static function unlockTables()
368
+    {
369 369
     $sql = 'unlock tables';
370 370
 
371 371
     self::$dl->executeNone($sql);
372
-  }
373
-
374
-  //--------------------------------------------------------------------------------------------------------------------
375
-  /**
376
-   * Logs the query on the console.
377
-   *
378
-   * @param string $query The query.
379
-   */
380
-  private static function logQuery($query)
381
-  {
372
+    }
373
+
374
+    //--------------------------------------------------------------------------------------------------------------------
375
+    /**
376
+     * Logs the query on the console.
377
+     *
378
+     * @param string $query The query.
379
+     */
380
+    private static function logQuery($query)
381
+    {
382 382
     $query = trim($query);
383 383
 
384 384
     if (strpos($query, "\n")!==false)
385 385
     {
386
-      // Query is a multi line query.
387
-      self::$io->logVeryVerbose('Executing query:');
388
-      self::$io->logVeryVerbose('<sql>%s</sql>', $query);
386
+        // Query is a multi line query.
387
+        self::$io->logVeryVerbose('Executing query:');
388
+        self::$io->logVeryVerbose('<sql>%s</sql>', $query);
389 389
     }
390 390
     else
391 391
     {
392
-      // Query is a single line query.
393
-      self::$io->logVeryVerbose('Executing query: <sql>%s</sql>', $query);
392
+        // Query is a single line query.
393
+        self::$io->logVeryVerbose('Executing query: <sql>%s</sql>', $query);
394
+    }
394 395
     }
395
-  }
396 396
 
397
-  //--------------------------------------------------------------------------------------------------------------------
397
+    //--------------------------------------------------------------------------------------------------------------------
398 398
 }
399 399
 
400 400
 //----------------------------------------------------------------------------------------------------------------------
Please login to merge, or discard this patch.
src/ColumnTypes.php 3 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -8,73 +8,73 @@
 block discarded – undo
8 8
  */
9 9
 class ColumnTypes
10 10
 {
11
-  //--------------------------------------------------------------------------------------------------------------------
12
-  /**
13
-   * The metadata of the columns.
14
-   *
15
-   * @var array[]
16
-   */
17
-  private $columnTypes = [];
11
+    //--------------------------------------------------------------------------------------------------------------------
12
+    /**
13
+     * The metadata of the columns.
14
+     *
15
+     * @var array[]
16
+     */
17
+    private $columnTypes = [];
18 18
 
19
-  //--------------------------------------------------------------------------------------------------------------------
20
-  /**
21
-   * Object constructor.
22
-   *
23
-   * @param array[]     $columnTypes The metadata of the column.
24
-   * @param null|string $typePrefix  Prefix for column type name.
25
-   */
26
-  public function __construct($columnTypes, $typePrefix = null)
27
-  {
19
+    //--------------------------------------------------------------------------------------------------------------------
20
+    /**
21
+     * Object constructor.
22
+     *
23
+     * @param array[]     $columnTypes The metadata of the column.
24
+     * @param null|string $typePrefix  Prefix for column type name.
25
+     */
26
+    public function __construct($columnTypes, $typePrefix = null)
27
+    {
28 28
     $this->appendColumnTypes($columnTypes, $typePrefix);
29
-  }
29
+    }
30 30
 
31
-  //--------------------------------------------------------------------------------------------------------------------
32
-  /**
33
-   * Return array with all columns types.
34
-   *
35
-   * @param array[] $columnTypes The metadata of the column.
36
-   * @param string  $typePrefix  Prefix for column type name.
37
-   *
38
-   * @return \array[]
39
-   */
40
-  public function appendColumnTypes($columnTypes, $typePrefix = null)
41
-  {
31
+    //--------------------------------------------------------------------------------------------------------------------
32
+    /**
33
+     * Return array with all columns types.
34
+     *
35
+     * @param array[] $columnTypes The metadata of the column.
36
+     * @param string  $typePrefix  Prefix for column type name.
37
+     *
38
+     * @return \array[]
39
+     */
40
+    public function appendColumnTypes($columnTypes, $typePrefix = null)
41
+    {
42 42
     foreach ($columnTypes as $typeName => $typeValue)
43 43
     {
44
-      if ($typeName=='column_name')
45
-      {
44
+        if ($typeName=='column_name')
45
+        {
46 46
         if (!isset($this->columnTypes['column_name']))
47 47
         {
48
-          $this->columnTypes[$typeName] = $typeValue;
48
+            $this->columnTypes[$typeName] = $typeValue;
49
+        }
49 50
         }
50
-      }
51
-      else
52
-      {
51
+        else
52
+        {
53 53
         $format = '%s_%s';
54 54
         if (isset($typePrefix))
55 55
         {
56
-          $this->columnTypes[sprintf($format, $typePrefix, $typeName)] = $typeValue;
56
+            $this->columnTypes[sprintf($format, $typePrefix, $typeName)] = $typeValue;
57 57
         }
58 58
         else
59 59
         {
60
-          $this->columnTypes[$typeName] = $typeValue;
60
+            $this->columnTypes[$typeName] = $typeValue;
61
+        }
61 62
         }
62
-      }
63 63
     }
64
-  }
64
+    }
65 65
 
66
-  //--------------------------------------------------------------------------------------------------------------------
67
-  /**
68
-   * Get columns types.
69
-   *
70
-   * @return array[]
71
-   */
72
-  public function getTypes()
73
-  {
66
+    //--------------------------------------------------------------------------------------------------------------------
67
+    /**
68
+     * Get columns types.
69
+     *
70
+     * @return array[]
71
+     */
72
+    public function getTypes()
73
+    {
74 74
     return $this->columnTypes;
75
-  }
75
+    }
76 76
 
77
-  //--------------------------------------------------------------------------------------------------------------------
77
+    //--------------------------------------------------------------------------------------------------------------------
78 78
 }
79 79
 
80 80
 //----------------------------------------------------------------------------------------------------------------------
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
   {
42 42
     foreach ($columnTypes as $typeName => $typeValue)
43 43
     {
44
-      if ($typeName=='column_name')
44
+      if ($typeName == 'column_name')
45 45
       {
46 46
         if (!isset($this->columnTypes['column_name']))
47 47
         {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,15 +47,13 @@
 block discarded – undo
47 47
         {
48 48
           $this->columnTypes[$typeName] = $typeValue;
49 49
         }
50
-      }
51
-      else
50
+      } else
52 51
       {
53 52
         $format = '%s_%s';
54 53
         if (isset($typePrefix))
55 54
         {
56 55
           $this->columnTypes[sprintf($format, $typePrefix, $typeName)] = $typeValue;
57
-        }
58
-        else
56
+        } else
59 57
         {
60 58
           $this->columnTypes[$typeName] = $typeValue;
61 59
         }
Please login to merge, or discard this patch.
src/Command/DiffCommand.php 2 patches
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -22,70 +22,70 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class DiffCommand extends AuditCommand
24 24
 {
25
-  //--------------------------------------------------------------------------------------------------------------------
26
-  /**
27
-   * Array with columns for each table.
28
-   * array [
29
-   *    table_name [
30
-   *            column [
31
-   *                    data table type,
32
-   *                    audit table type
33
-   *                    ],
34
-   *                      ...
35
-   *               ]
36
-   *       ]
37
-   *
38
-   * @var array[]
39
-   */
40
-  private $diffColumns;
41
-
42
-  /**
43
-   * If set all tables and columns are shown.
44
-   *
45
-   * @var string
46
-   */
47
-  private $full;
48
-
49
-  //--------------------------------------------------------------------------------------------------------------------
50
-  /**
51
-   * Check full full and return array without new or obsolete columns if full not set.
52
-   *
53
-   * @param array[] $columns The metadata of the columns of a table.
54
-   *
55
-   * @return array[]
56
-   */
57
-  private static function removeMatchingColumns($columns)
58
-  {
25
+    //--------------------------------------------------------------------------------------------------------------------
26
+    /**
27
+     * Array with columns for each table.
28
+     * array [
29
+     *    table_name [
30
+     *            column [
31
+     *                    data table type,
32
+     *                    audit table type
33
+     *                    ],
34
+     *                      ...
35
+     *               ]
36
+     *       ]
37
+     *
38
+     * @var array[]
39
+     */
40
+    private $diffColumns;
41
+
42
+    /**
43
+     * If set all tables and columns are shown.
44
+     *
45
+     * @var string
46
+     */
47
+    private $full;
48
+
49
+    //--------------------------------------------------------------------------------------------------------------------
50
+    /**
51
+     * Check full full and return array without new or obsolete columns if full not set.
52
+     *
53
+     * @param array[] $columns The metadata of the columns of a table.
54
+     *
55
+     * @return array[]
56
+     */
57
+    private static function removeMatchingColumns($columns)
58
+    {
59 59
     $cleaned = [];
60 60
     foreach ($columns as $column)
61 61
     {
62
-      if (($column['data_table_type']!=$column['audit_table_type'] && $column['audit_table_type']!=$column['config_type']) || ($column['audit_table_type']!=$column['config_type'] && !empty($column['config_type'])))
63
-      {
62
+        if (($column['data_table_type']!=$column['audit_table_type'] && $column['audit_table_type']!=$column['config_type']) || ($column['audit_table_type']!=$column['config_type'] && !empty($column['config_type'])))
63
+        {
64 64
         $cleaned[] = $column;
65
-      }
65
+        }
66 66
     }
67 67
 
68 68
     return $cleaned;
69
-  }
70
-
71
-  //--------------------------------------------------------------------------------------------------------------------
72
-  /**
73
-   * {@inheritdoc}
74
-   */
75
-  protected function configure()
76
-  {
69
+    }
70
+
71
+    //--------------------------------------------------------------------------------------------------------------------
72
+    /**
73
+     * {@inheritdoc}
74
+     */
75
+    protected function configure()
76
+    {
77 77
     $this->setName('diff')
78
-         ->setDescription('Compares data tables and audit tables')
79
-         ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json')
80
-         ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns');
81
-  }
82
-
83
-  //--------------------------------------------------------------------------------------------------------------------
84
-  /**
85
-   * {@inheritdoc}
86
-   */
87
-  protected function execute(InputInterface $input, OutputInterface $output)
88
-  {
78
+            ->setDescription('Compares data tables and audit tables')
79
+            ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json')
80
+            ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns');
81
+    }
82
+
83
+    //--------------------------------------------------------------------------------------------------------------------
84
+    /**
85
+     * {@inheritdoc}
86
+     */
87
+    protected function execute(InputInterface $input, OutputInterface $output)
88
+    {
89 89
     $this->io = new StratumStyle($input, $output);
90 90
 
91 91
     // Style for column names with miss matched column types.
@@ -115,179 +115,179 @@  discard block
 block discarded – undo
115 115
 
116 116
     $this->getDiff();
117 117
     $this->printDiff($output);
118
-  }
119
-
120
-  //--------------------------------------------------------------------------------------------------------------------
121
-  /**
122
-   * Get the difference between data and audit tables.
123
-   *
124
-   * @param Columns $dataColumns  The table columns from data schema.
125
-   * @param Columns $auditColumns The table columns from audit schema.
126
-   *
127
-   * @return \array[]
128
-   */
129
-  private function createDiffArray($dataColumns, $auditColumns)
130
-  {
118
+    }
119
+
120
+    //--------------------------------------------------------------------------------------------------------------------
121
+    /**
122
+     * Get the difference between data and audit tables.
123
+     *
124
+     * @param Columns $dataColumns  The table columns from data schema.
125
+     * @param Columns $auditColumns The table columns from audit schema.
126
+     *
127
+     * @return \array[]
128
+     */
129
+    private function createDiffArray($dataColumns, $auditColumns)
130
+    {
131 131
     $diff = [];
132 132
 
133 133
     foreach ($this->config['audit_columns'] as $column)
134 134
     {
135
-      $columnTypes                  = new ColumnTypes($column, 'config');
136
-      $diff[$column['column_name']] = $columnTypes;
135
+        $columnTypes                  = new ColumnTypes($column, 'config');
136
+        $diff[$column['column_name']] = $columnTypes;
137 137
     }
138 138
 
139 139
     foreach ($auditColumns->getColumns() as $column)
140 140
     {
141
-      if (isset($diff[$column['column_name']]))
142
-      {
141
+        if (isset($diff[$column['column_name']]))
142
+        {
143 143
         $diff[$column['column_name']]->appendColumnTypes($column, 'audit');
144
-      }
145
-      else
146
-      {
144
+        }
145
+        else
146
+        {
147 147
         $columnTypes                  = new ColumnTypes($column, 'audit');
148 148
         $diff[$column['column_name']] = $columnTypes;
149
-      }
149
+        }
150 150
     }
151 151
 
152 152
     foreach ($dataColumns->getColumns() as $column)
153 153
     {
154
-      if (isset($diff[$column['column_name']]))
155
-      {
154
+        if (isset($diff[$column['column_name']]))
155
+        {
156 156
         $diff[$column['column_name']]->appendColumnTypes($column, 'data');
157
-      }
158
-      else
159
-      {
157
+        }
158
+        else
159
+        {
160 160
         $columnTypes                  = new ColumnTypes($column, 'data');
161 161
         $diff[$column['column_name']] = $columnTypes;
162
-      }
162
+        }
163 163
     }
164 164
 
165 165
     return $diff;
166
-  }
167
-
168
-  //--------------------------------------------------------------------------------------------------------------------
169
-  /**
170
-   * Computes the difference between data and audit tables.
171
-   */
172
-  private function getDiff()
173
-  {
166
+    }
167
+
168
+    //--------------------------------------------------------------------------------------------------------------------
169
+    /**
170
+     * Computes the difference between data and audit tables.
171
+     */
172
+    private function getDiff()
173
+    {
174 174
     foreach ($this->dataSchemaTables as $table)
175 175
     {
176
-      if ($this->config['tables'][$table['table_name']]['audit'])
177
-      {
176
+        if ($this->config['tables'][$table['table_name']]['audit'])
177
+        {
178 178
         $res = StaticDataLayer::searchInRowSet('table_name', $table['table_name'], $this->auditSchemaTables);
179 179
         if (isset($res))
180 180
         {
181
-          $dataColumns  = new Columns(DataLayer::getTableColumns($this->config['database']['data_schema'], $table['table_name']));
182
-          $auditColumns = DataLayer::getTableColumns($this->config['database']['audit_schema'], $table['table_name']);
183
-          $auditColumns = $this->addNotNull($auditColumns);
184
-          $auditColumns = new Columns($auditColumns);
181
+            $dataColumns  = new Columns(DataLayer::getTableColumns($this->config['database']['data_schema'], $table['table_name']));
182
+            $auditColumns = DataLayer::getTableColumns($this->config['database']['audit_schema'], $table['table_name']);
183
+            $auditColumns = $this->addNotNull($auditColumns);
184
+            $auditColumns = new Columns($auditColumns);
185 185
 
186
-          $this->diffColumns[$table['table_name']] = $this->createDiffArray($dataColumns, $auditColumns);
186
+            $this->diffColumns[$table['table_name']] = $this->createDiffArray($dataColumns, $auditColumns);
187 187
         }
188
-      }
188
+        }
189
+    }
189 190
     }
190
-  }
191
-
192
-  //--------------------------------------------------------------------------------------------------------------------
193
-  /**
194
-   * Add not null to audit columns if it not nullable.
195
-   *
196
-   * @param array $theColumns Audit columns.
197
-   *
198
-   * @return array
199
-   */
200
-  private function addNotNull($theColumns)
201
-  {
191
+
192
+    //--------------------------------------------------------------------------------------------------------------------
193
+    /**
194
+     * Add not null to audit columns if it not nullable.
195
+     *
196
+     * @param array $theColumns Audit columns.
197
+     *
198
+     * @return array
199
+     */
200
+    private function addNotNull($theColumns)
201
+    {
202 202
     $modifiedColumns = [];
203 203
     foreach ($theColumns as $column)
204 204
     {
205
-      $modifiedColumn = $column;
206
-      $auditColumn    = StaticDataLayer::searchInRowSet('column_name', $modifiedColumn['column_name'], $this->config['audit_columns']);
207
-      if (isset($auditColumn))
208
-      {
205
+        $modifiedColumn = $column;
206
+        $auditColumn    = StaticDataLayer::searchInRowSet('column_name', $modifiedColumn['column_name'], $this->config['audit_columns']);
207
+        if (isset($auditColumn))
208
+        {
209 209
         if ($modifiedColumn['is_nullable']==='NO')
210 210
         {
211
-          $modifiedColumn['column_type'] = sprintf('%s not null', $modifiedColumn['column_type']);
211
+            $modifiedColumn['column_type'] = sprintf('%s not null', $modifiedColumn['column_type']);
212
+        }
212 213
         }
213
-      }
214
-      $modifiedColumns[] = $modifiedColumn;
214
+        $modifiedColumns[] = $modifiedColumn;
215 215
     }
216 216
 
217 217
     return $modifiedColumns;
218
-  }
219
-
220
-  //--------------------------------------------------------------------------------------------------------------------
221
-  /**
222
-   * Writes the difference between the audit tables and metadata tables to the output.
223
-   *
224
-   * @param OutputInterface $output The output.
225
-   */
226
-  private function diffTables($output)
227
-  {
218
+    }
219
+
220
+    //--------------------------------------------------------------------------------------------------------------------
221
+    /**
222
+     * Writes the difference between the audit tables and metadata tables to the output.
223
+     *
224
+     * @param OutputInterface $output The output.
225
+     */
226
+    private function diffTables($output)
227
+    {
228 228
     foreach ($this->config['tables'] as $tableName => $table)
229 229
     {
230
-      $res = StaticDataLayer::searchInRowSet('table_name', $tableName, $this->auditSchemaTables);
231
-      if ($table['audit'] && !isset($res))
232
-      {
230
+        $res = StaticDataLayer::searchInRowSet('table_name', $tableName, $this->auditSchemaTables);
231
+        if ($table['audit'] && !isset($res))
232
+        {
233 233
         $output->writeln(sprintf('<miss_table>%s</>', $tableName));
234
-      }
235
-      else if (!$table['audit'] && isset($res))
236
-      {
234
+        }
235
+        else if (!$table['audit'] && isset($res))
236
+        {
237 237
         $output->writeln(sprintf('<obsolete_table>%s</>', $tableName));
238
-      }
238
+        }
239
+    }
239 240
     }
240
-  }
241
-
242
-  //--------------------------------------------------------------------------------------------------------------------
243
-  /**
244
-   * Writes the difference between the audit and data tables to the output.
245
-   *
246
-   * @param OutputInterface $output The output.
247
-   */
248
-  private function printDiff($output)
249
-  {
241
+
242
+    //--------------------------------------------------------------------------------------------------------------------
243
+    /**
244
+     * Writes the difference between the audit and data tables to the output.
245
+     *
246
+     * @param OutputInterface $output The output.
247
+     */
248
+    private function printDiff($output)
249
+    {
250 250
     $first = true;
251 251
     if (isset($this->diffColumns))
252 252
     {
253
-      foreach ($this->diffColumns as $tableName => $columns)
254
-      {
253
+        foreach ($this->diffColumns as $tableName => $columns)
254
+        {
255 255
         // Remove matching columns unless the full option is used.
256 256
         if (!$this->full)
257 257
         {
258
-          $columns = self::removeMatchingColumns($columns);
258
+            $columns = self::removeMatchingColumns($columns);
259 259
         }
260 260
 
261 261
         if (!empty($columns))
262 262
         {
263
-          // Add an empty line between tables.
264
-          if ($first)
265
-          {
263
+            // Add an empty line between tables.
264
+            if ($first)
265
+            {
266 266
             $first = false;
267
-          }
268
-          else
269
-          {
267
+            }
268
+            else
269
+            {
270 270
             $output->writeln('');
271
-          }
271
+            }
272 272
 
273
-          // Write table name.
274
-          $output->writeln($tableName);
273
+            // Write table name.
274
+            $output->writeln($tableName);
275 275
 
276
-          // Write table with columns.
277
-          $rows = new TableHelper($this->config['database']['data_schema'], $this->config['database']['audit_schema'], $tableName, $this->config['audit_columns']);
278
-          $rows->appendRows($columns);
279
-          $rows->addHighlighting();
280
-          $table = new Table($output);
281
-          $table->setHeaders(['column', 'data table', 'audit table', 'config'])
276
+            // Write table with columns.
277
+            $rows = new TableHelper($this->config['database']['data_schema'], $this->config['database']['audit_schema'], $tableName, $this->config['audit_columns']);
278
+            $rows->appendRows($columns);
279
+            $rows->addHighlighting();
280
+            $table = new Table($output);
281
+            $table->setHeaders(['column', 'data table', 'audit table', 'config'])
282 282
                 ->setRows($rows->getRows());
283
-          $table->render();
283
+            $table->render();
284
+        }
284 285
         }
285
-      }
286 286
     }
287 287
     $this->diffTables($output);
288
-  }
288
+    }
289 289
 
290
-  //--------------------------------------------------------------------------------------------------------------------
290
+    //--------------------------------------------------------------------------------------------------------------------
291 291
 }
292 292
 
293 293
 //----------------------------------------------------------------------------------------------------------------------
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -141,8 +141,7 @@  discard block
 block discarded – undo
141 141
       if (isset($diff[$column['column_name']]))
142 142
       {
143 143
         $diff[$column['column_name']]->appendColumnTypes($column, 'audit');
144
-      }
145
-      else
144
+      } else
146 145
       {
147 146
         $columnTypes                  = new ColumnTypes($column, 'audit');
148 147
         $diff[$column['column_name']] = $columnTypes;
@@ -154,8 +153,7 @@  discard block
 block discarded – undo
154 153
       if (isset($diff[$column['column_name']]))
155 154
       {
156 155
         $diff[$column['column_name']]->appendColumnTypes($column, 'data');
157
-      }
158
-      else
156
+      } else
159 157
       {
160 158
         $columnTypes                  = new ColumnTypes($column, 'data');
161 159
         $diff[$column['column_name']] = $columnTypes;
@@ -231,8 +229,7 @@  discard block
 block discarded – undo
231 229
       if ($table['audit'] && !isset($res))
232 230
       {
233 231
         $output->writeln(sprintf('<miss_table>%s</>', $tableName));
234
-      }
235
-      else if (!$table['audit'] && isset($res))
232
+      } else if (!$table['audit'] && isset($res))
236 233
       {
237 234
         $output->writeln(sprintf('<obsolete_table>%s</>', $tableName));
238 235
       }
@@ -264,8 +261,7 @@  discard block
 block discarded – undo
264 261
           if ($first)
265 262
           {
266 263
             $first = false;
267
-          }
268
-          else
264
+          } else
269 265
           {
270 266
             $output->writeln('');
271 267
           }
Please login to merge, or discard this patch.
src/MySql/Helper/TableHelper.php 3 patches
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -13,160 +13,160 @@
 block discarded – undo
13 13
  */
14 14
 class TableHelper
15 15
 {
16
-  //--------------------------------------------------------------------------------------------------------------------
17
-  /**
18
-   * Array with rows for table.
19
-   *
20
-   * @var \array[]
21
-   */
22
-  private $rows = [];
16
+    //--------------------------------------------------------------------------------------------------------------------
17
+    /**
18
+     * Array with rows for table.
19
+     *
20
+     * @var \array[]
21
+     */
22
+    private $rows = [];
23 23
 
24
-  /**
25
-   * Audit columns from config file.
26
-   *
27
-   * @var array
28
-   */
29
-  private $auditColumns;
24
+    /**
25
+     * Audit columns from config file.
26
+     *
27
+     * @var array
28
+     */
29
+    private $auditColumns;
30 30
 
31
-  /**
32
-   * Table options from audit schema.
33
-   *
34
-   * @var array
35
-   */
36
-  private $auditTableOptions;
31
+    /**
32
+     * Table options from audit schema.
33
+     *
34
+     * @var array
35
+     */
36
+    private $auditTableOptions;
37 37
 
38
-  /**
39
-   * Table options from data schema.
40
-   *
41
-   * @var array
42
-   */
43
-  private $dataTableOptions;
38
+    /**
39
+     * Table options from data schema.
40
+     *
41
+     * @var array
42
+     */
43
+    private $dataTableOptions;
44 44
 
45
-  //--------------------------------------------------------------------------------------------------------------------
46
-  /**
47
-   * Object constructor.
48
-   *
49
-   * @param string  $dataSchema      Data schema name.
50
-   * @param string  $auditSchema     Audit schema name.
51
-   * @param string  $tableName       The table name.
52
-   * @param array[] $theAuditColumns Audit columns from config file.
53
-   */
54
-  public function __construct($dataSchema, $auditSchema, $tableName, $theAuditColumns)
55
-  {
45
+    //--------------------------------------------------------------------------------------------------------------------
46
+    /**
47
+     * Object constructor.
48
+     *
49
+     * @param string  $dataSchema      Data schema name.
50
+     * @param string  $auditSchema     Audit schema name.
51
+     * @param string  $tableName       The table name.
52
+     * @param array[] $theAuditColumns Audit columns from config file.
53
+     */
54
+    public function __construct($dataSchema, $auditSchema, $tableName, $theAuditColumns)
55
+    {
56 56
     $this->auditColumns      = $theAuditColumns;
57 57
     $this->auditTableOptions = DataLayer::getTableOptions($auditSchema, $tableName);
58 58
     $this->dataTableOptions  = DataLayer::getTableOptions($dataSchema, $tableName);
59
-  }
59
+    }
60 60
 
61
-  //--------------------------------------------------------------------------------------------------------------------
62
-  /**
63
-   * Append row with table option.
64
-   *
65
-   * @param string $theOption
66
-   */
67
-  public function appendTableOption($theOption)
68
-  {
61
+    //--------------------------------------------------------------------------------------------------------------------
62
+    /**
63
+     * Append row with table option.
64
+     *
65
+     * @param string $theOption
66
+     */
67
+    public function appendTableOption($theOption)
68
+    {
69 69
     $tableRow               = ['column_name'        => $theOption,
70
-                               'data_column_type'   => $this->dataTableOptions[$theOption],
71
-                               'audit_column_type'  => $this->auditTableOptions[$theOption],
72
-                               'config_column_type' => null];
70
+                                'data_column_type'   => $this->dataTableOptions[$theOption],
71
+                                'audit_column_type'  => $this->auditTableOptions[$theOption],
72
+                                'config_column_type' => null];
73 73
     $this->rows[$theOption] = RowHelper::createTableRow($tableRow);
74
-  }
74
+    }
75 75
 
76
-  //--------------------------------------------------------------------------------------------------------------------
77
-  /**
78
-   * Appends rows.
79
-   *
80
-   * @param \array[] $theRows
81
-   */
82
-  public function appendRows($theRows)
83
-  {
76
+    //--------------------------------------------------------------------------------------------------------------------
77
+    /**
78
+     * Appends rows.
79
+     *
80
+     * @param \array[] $theRows
81
+     */
82
+    public function appendRows($theRows)
83
+    {
84 84
     /** @var ColumnTypes $row */
85 85
     foreach ($theRows as $row)
86 86
     {
87
-      RowHelper::appendRow($this->rows, $row);
87
+        RowHelper::appendRow($this->rows, $row);
88 88
     }
89 89
     $this->rows[] = new TableSeparator();
90 90
     $this->appendTableOption('engine');
91 91
     $this->appendTableOption('character_set_name');
92
-  }
92
+    }
93 93
 
94
-  //--------------------------------------------------------------------------------------------------------------------
95
-  /**
96
-   * Add highlighting to columns.
97
-   *
98
-   * @return array[]
99
-   */
100
-  public function addHighlighting()
101
-  {
94
+    //--------------------------------------------------------------------------------------------------------------------
95
+    /**
96
+     * Add highlighting to columns.
97
+     *
98
+     * @return array[]
99
+     */
100
+    public function addHighlighting()
101
+    {
102 102
     $styledColumns = [];
103 103
     foreach ($this->rows as $column)
104 104
     {
105
-      $styledColumn = $column;
106
-      if (is_array($column))
107
-      {
105
+        $styledColumn = $column;
106
+        if (is_array($column))
107
+        {
108 108
         // Highlighting for data table column types and audit.
109 109
         if (!empty($column['data_table_type']))
110 110
         {
111
-          if (isset($column['data_table_type']) && !isset($column['audit_table_type']))
112
-          {
111
+            if (isset($column['data_table_type']) && !isset($column['audit_table_type']))
112
+            {
113 113
             $styledColumn['column_name']     = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
114 114
             $styledColumn['data_table_type'] = sprintf('<mm_type>%s</>', $styledColumn['data_table_type']);
115
-          }
116
-          else if (!isset($column['data_table_type']) && isset($column['audit_table_type']))
117
-          {
115
+            }
116
+            else if (!isset($column['data_table_type']) && isset($column['audit_table_type']))
117
+            {
118 118
             $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $styledColumn['audit_table_type']);
119
-          }
120
-          else if (strcmp($column['data_table_type'], $column['audit_table_type']))
121
-          {
119
+            }
120
+            else if (strcmp($column['data_table_type'], $column['audit_table_type']))
121
+            {
122 122
             $styledColumn['column_name']      = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
123 123
             $styledColumn['data_table_type']  = sprintf('<mm_type>%s</>', $styledColumn['data_table_type']);
124 124
             $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $styledColumn['audit_table_type']);
125
-          }
125
+            }
126 126
         }
127 127
         else
128 128
         {
129
-          // Highlighting for audit table column types and audit_columns in config file.
130
-          $searchColumn = StaticDataLayer::searchInRowSet('column_name', $styledColumn['column_name'], $this->auditColumns);
131
-          if (isset($searchColumn))
132
-          {
129
+            // Highlighting for audit table column types and audit_columns in config file.
130
+            $searchColumn = StaticDataLayer::searchInRowSet('column_name', $styledColumn['column_name'], $this->auditColumns);
131
+            if (isset($searchColumn))
132
+            {
133 133
             $configType = $this->auditColumns[$searchColumn]['column_type'];
134 134
             if (isset($configType) && !isset($column['audit_table_type']))
135 135
             {
136
-              $styledColumn['column_name'] = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
137
-              $styledColumn['config_type'] = sprintf('<mm_type>%s</>', $styledColumn['config_type']);
136
+                $styledColumn['column_name'] = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
137
+                $styledColumn['config_type'] = sprintf('<mm_type>%s</>', $styledColumn['config_type']);
138 138
             }
139 139
             else if (!isset($configType) && isset($column['audit_table_type']))
140 140
             {
141
-              $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $column['audit_table_type']);
141
+                $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $column['audit_table_type']);
142 142
             }
143 143
             else if (strcmp($configType, $column['audit_table_type']))
144 144
             {
145
-              $styledColumn['column_name']      = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
146
-              $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $column['audit_table_type']);
147
-              $styledColumn['config_type']      = sprintf('<mm_type>%s</>', $styledColumn['config_type']);
145
+                $styledColumn['column_name']      = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
146
+                $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $column['audit_table_type']);
147
+                $styledColumn['config_type']      = sprintf('<mm_type>%s</>', $styledColumn['config_type']);
148 148
             }
149
-          }
149
+            }
150
+        }
150 151
         }
151
-      }
152
-      $styledColumns[] = $styledColumn;
152
+        $styledColumns[] = $styledColumn;
153 153
     }
154 154
 
155 155
     $this->rows = $styledColumns;
156
-  }
156
+    }
157 157
 
158
-  //--------------------------------------------------------------------------------------------------------------------
159
-  /**
160
-   * Get rows.
161
-   *
162
-   * @return \array[]
163
-   */
164
-  public function getRows()
165
-  {
158
+    //--------------------------------------------------------------------------------------------------------------------
159
+    /**
160
+     * Get rows.
161
+     *
162
+     * @return \array[]
163
+     */
164
+    public function getRows()
165
+    {
166 166
     return $this->rows;
167
-  }
167
+    }
168 168
 
169
-  //--------------------------------------------------------------------------------------------------------------------
169
+    //--------------------------------------------------------------------------------------------------------------------
170 170
 }
171 171
 
172 172
 //----------------------------------------------------------------------------------------------------------------------
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
    */
67 67
   public function appendTableOption($theOption)
68 68
   {
69
-    $tableRow               = ['column_name'        => $theOption,
69
+    $tableRow = ['column_name'        => $theOption,
70 70
                                'data_column_type'   => $this->dataTableOptions[$theOption],
71 71
                                'audit_column_type'  => $this->auditTableOptions[$theOption],
72 72
                                'config_column_type' => null];
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -112,19 +112,16 @@  discard block
 block discarded – undo
112 112
           {
113 113
             $styledColumn['column_name']     = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
114 114
             $styledColumn['data_table_type'] = sprintf('<mm_type>%s</>', $styledColumn['data_table_type']);
115
-          }
116
-          else if (!isset($column['data_table_type']) && isset($column['audit_table_type']))
115
+          } else if (!isset($column['data_table_type']) && isset($column['audit_table_type']))
117 116
           {
118 117
             $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $styledColumn['audit_table_type']);
119
-          }
120
-          else if (strcmp($column['data_table_type'], $column['audit_table_type']))
118
+          } else if (strcmp($column['data_table_type'], $column['audit_table_type']))
121 119
           {
122 120
             $styledColumn['column_name']      = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
123 121
             $styledColumn['data_table_type']  = sprintf('<mm_type>%s</>', $styledColumn['data_table_type']);
124 122
             $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $styledColumn['audit_table_type']);
125 123
           }
126
-        }
127
-        else
124
+        } else
128 125
         {
129 126
           // Highlighting for audit table column types and audit_columns in config file.
130 127
           $searchColumn = StaticDataLayer::searchInRowSet('column_name', $styledColumn['column_name'], $this->auditColumns);
@@ -135,12 +132,10 @@  discard block
 block discarded – undo
135 132
             {
136 133
               $styledColumn['column_name'] = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
137 134
               $styledColumn['config_type'] = sprintf('<mm_type>%s</>', $styledColumn['config_type']);
138
-            }
139
-            else if (!isset($configType) && isset($column['audit_table_type']))
135
+            } else if (!isset($configType) && isset($column['audit_table_type']))
140 136
             {
141 137
               $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $column['audit_table_type']);
142
-            }
143
-            else if (strcmp($configType, $column['audit_table_type']))
138
+            } else if (strcmp($configType, $column['audit_table_type']))
144 139
             {
145 140
               $styledColumn['column_name']      = sprintf('<mm_column>%s</>', $styledColumn['column_name']);
146 141
               $styledColumn['audit_table_type'] = sprintf('<mm_type>%s</>', $column['audit_table_type']);
Please login to merge, or discard this patch.
src/MySql/Helper/RowHelper.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -11,16 +11,16 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class RowHelper
13 13
 {
14
-  //--------------------------------------------------------------------------------------------------------------------
15
-  /**
16
-   * Create table row.
17
-   *
18
-   * @param array[] $theRow Data for table row.
19
-   *
20
-   * @return \string
21
-   */
22
-  public static function createColumnOptionsRow($theRow)
23
-  {
14
+    //--------------------------------------------------------------------------------------------------------------------
15
+    /**
16
+     * Create table row.
17
+     *
18
+     * @param array[] $theRow Data for table row.
19
+     *
20
+     * @return \string
21
+     */
22
+    public static function createColumnOptionsRow($theRow)
23
+    {
24 24
     $dataCharsetName   = isset($theRow['data_character_set_name']) ? $theRow['data_character_set_name'] : null;
25 25
     $dataCollationName = isset($theRow['data_collation_name']) ? $theRow['data_collation_name'] : null;
26 26
 
@@ -29,97 +29,97 @@  discard block
 block discarded – undo
29 29
 
30 30
 
31 31
     $tableRow = ['column_name'      => null,
32
-                 'data_table_type'  => self::styledOptionsRow($dataCharsetName, $dataCollationName),
33
-                 'audit_table_type' => self::styledOptionsRow($auditCharsetName, $auditCollationName),
34
-                 'config_type'      => null];
32
+                    'data_table_type'  => self::styledOptionsRow($dataCharsetName, $dataCollationName),
33
+                    'audit_table_type' => self::styledOptionsRow($auditCharsetName, $auditCollationName),
34
+                    'config_type'      => null];
35 35
 
36 36
     return $tableRow;
37
-  }
38
-
39
-  //--------------------------------------------------------------------------------------------------------------------
40
-  /**
41
-   * Create table row.
42
-   *
43
-   * @param $theCharacterSetName
44
-   * @param $theCollationName
45
-   *
46
-   * @return string
47
-   */
48
-  public static function styledOptionsRow($theCharacterSetName, $theCollationName)
49
-  {
37
+    }
38
+
39
+    //--------------------------------------------------------------------------------------------------------------------
40
+    /**
41
+     * Create table row.
42
+     *
43
+     * @param $theCharacterSetName
44
+     * @param $theCollationName
45
+     *
46
+     * @return string
47
+     */
48
+    public static function styledOptionsRow($theCharacterSetName, $theCollationName)
49
+    {
50 50
     $charsetName   = isset($theCharacterSetName) ? '['.$theCharacterSetName.']' : null;
51 51
     $collationName = isset($theCollationName) ? '['.$theCollationName.']' : null;
52 52
 
53 53
     return trim(sprintf('%s %s', $charsetName, $collationName));
54
-  }
55
-
56
-  //--------------------------------------------------------------------------------------------------------------------
57
-  /**
58
-   * Create table row.
59
-   *
60
-   * @param array[] $theRow Data for table row.
61
-   *
62
-   * @return \array[]
63
-   */
64
-  public static function createTableRow($theRow)
65
-  {
54
+    }
55
+
56
+    //--------------------------------------------------------------------------------------------------------------------
57
+    /**
58
+     * Create table row.
59
+     *
60
+     * @param array[] $theRow Data for table row.
61
+     *
62
+     * @return \array[]
63
+     */
64
+    public static function createTableRow($theRow)
65
+    {
66 66
     $tableRow = ['column_name'      => isset($theRow['column_name']) ? $theRow['column_name'] : null,
67
-                 'data_table_type'  => isset($theRow['data_column_type']) ? $theRow['data_column_type'] : null,
68
-                 'audit_table_type' => isset($theRow['audit_column_type']) ? $theRow['audit_column_type'] : null,
69
-                 'config_type'      => isset($theRow['config_column_type']) ? $theRow['config_column_type'] : null];
67
+                    'data_table_type'  => isset($theRow['data_column_type']) ? $theRow['data_column_type'] : null,
68
+                    'audit_table_type' => isset($theRow['audit_column_type']) ? $theRow['audit_column_type'] : null,
69
+                    'config_type'      => isset($theRow['config_column_type']) ? $theRow['config_column_type'] : null];
70 70
 
71 71
     return $tableRow;
72
-  }
73
-
74
-  //--------------------------------------------------------------------------------------------------------------------
75
-  /**
76
-   * Check isset options(collation, character set name) from row.
77
-   *
78
-   * @param array[] $theRow Row for append.
79
-   *
80
-   * @return bool
81
-   */
82
-  private static function checkOptions($theRow)
83
-  {
72
+    }
73
+
74
+    //--------------------------------------------------------------------------------------------------------------------
75
+    /**
76
+     * Check isset options(collation, character set name) from row.
77
+     *
78
+     * @param array[] $theRow Row for append.
79
+     *
80
+     * @return bool
81
+     */
82
+    private static function checkOptions($theRow)
83
+    {
84 84
     if (isset($theRow['audit_character_set_name']))
85 85
     {
86
-      return true;
86
+        return true;
87 87
     }
88 88
     if (isset($theRow['data_character_set_name']))
89 89
     {
90
-      return true;
90
+        return true;
91 91
     }
92 92
     if (isset($theRow['audit_collation_name']))
93 93
     {
94
-      return true;
94
+        return true;
95 95
     }
96 96
     if (isset($theRow['data_collation_name']))
97 97
     {
98
-      return true;
98
+        return true;
99 99
     }
100 100
 
101 101
     return false;
102
-  }
103
-
104
-  //--------------------------------------------------------------------------------------------------------------------
105
-  /**
106
-   * Append a row.
107
-   *
108
-   * @param \array[]    $theExistRows Exist rows array for appending.
109
-   * @param ColumnTypes $theRow       Row for append.
110
-   */
111
-  public static function appendRow(&$theExistRows, $theRow)
112
-  {
102
+    }
103
+
104
+    //--------------------------------------------------------------------------------------------------------------------
105
+    /**
106
+     * Append a row.
107
+     *
108
+     * @param \array[]    $theExistRows Exist rows array for appending.
109
+     * @param ColumnTypes $theRow       Row for append.
110
+     */
111
+    public static function appendRow(&$theExistRows, $theRow)
112
+    {
113 113
     $theRow         = $theRow->getTypes();
114 114
     $theExistRows[] = self::createTableRow($theRow);
115 115
     if (self::checkOptions($theRow))
116 116
     {
117
-      $theRow         = self::createColumnOptionsRow($theRow);
118
-      $theExistRows[] = $theRow;
117
+        $theRow         = self::createColumnOptionsRow($theRow);
118
+        $theExistRows[] = $theRow;
119
+    }
119 120
     }
120
-  }
121 121
 
122
-  //--------------------------------------------------------------------------------------------------------------------
122
+    //--------------------------------------------------------------------------------------------------------------------
123 123
 }
124 124
 
125 125
 //----------------------------------------------------------------------------------------------------------------------
Please login to merge, or discard this patch.