Passed
Push — master ( c56107...76bdd0 )
by Gaetano
16:10
created
app/src/Command/SqlExecute.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 
83 83
             /// @todo inject more randomness in the username, by allowing more chars than bin2hex produces
84 84
 
85
-            $userName = 'db3v4l_' . substr(bin2hex(random_bytes(5)), 0, 9); // some mysql versions have a limitation of 16 chars for usernames
85
+            $userName = 'db3v4l_'.substr(bin2hex(random_bytes(5)), 0, 9); // some mysql versions have a limitation of 16 chars for usernames
86 86
             $password = bin2hex(random_bytes(15)); // some oracle versions have a limit of 30 chars on passwords
87 87
             //$dbName = bin2hex(random_bytes(31));
88 88
             $dbName = $userName; // $userName will be used as db name
89 89
 
90 90
             $tempDbSpecs = [];
91
-            foreach($instanceList as $instanceName => $instanceSpecs) {
91
+            foreach ($instanceList as $instanceName => $instanceSpecs) {
92 92
                 $tempDbSpecs[$instanceName] = [
93 93
                     'dbname' => $dbName,
94 94
                     'user' => $userName,
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             }
98 98
 
99 99
             if (($charset = $input->getOption('charset')) != '') {
100
-                foreach($instanceList as $instanceName) {
100
+                foreach ($instanceList as $instanceName) {
101 101
                     $tempDbSpecs[$instanceName]['charset'] = $charset;
102 102
                 }
103 103
             }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             ];
125 125
 
126 126
             $dbConnectionSpecs = [];
127
-            foreach($instanceList as $instanceName => $instanceSpecs) {
127
+            foreach ($instanceList as $instanceName => $instanceSpecs) {
128 128
                 $dbConnectionSpecs[$instanceName] = array_merge($instanceSpecs, $dbConfig);
129 129
             }
130 130
         }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             if ($createDB) {
145 145
                 $results['failed'] += $creationResults['failed'];
146 146
 
147
-                foreach($instanceList as $instanceName  => $instanceSpecs) {
147
+                foreach ($instanceList as $instanceName  => $instanceSpecs) {
148 148
                     if (!isset($dbConnectionSpecs[$instanceName])) {
149 149
                         /// @todo retrieve the actual temp db creation error instead of doing this...
150 150
                         $results['data'][$instanceName] = [
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
                 $this->executionStrategy = $previousStrategy;
162 162
             }
163 163
         } else {
164
-            $results = ['succeeded' => 0,  'failed' => 0, 'data' => null];
164
+            $results = ['succeeded' => 0, 'failed' => 0, 'data' => null];
165 165
         }
166 166
 
167 167
         $time = microtime(true) - $start;
168 168
 
169 169
         $this->writeResults($results, $time);
170 170
 
171
-        return (int)$results['failed'];
171
+        return (int) $results['failed'];
172 172
     }
173 173
 
174 174
     /**
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
         return $this->executeSqlAction(
187 187
             $dbConnectionSpecs,
188 188
             'Execution of SQL',
189
-            function ($schemaManager, $instanceName) use ($sql, $filename) {
189
+            function($schemaManager, $instanceName) use ($sql, $filename) {
190 190
                 if ($sql != null) {
191 191
                     return new Command(
192 192
                         $sql,
193
-                        function ($output, $executor) {
193
+                        function($output, $executor) {
194 194
                             /** @var TimedExecutor $executor */
195 195
                             return array_merge(['stdout' => $output], $executor->getTimingData());
196 196
                         }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                     }
204 204
                     return new File(
205 205
                         $realFileName,
206
-                        function ($output, $executor) {
206
+                        function($output, $executor) {
207 207
                             /** @var TimedExecutor $executor */
208 208
                             return array_merge(['stdout' => $output], $executor->getTimingData());
209 209
                         }
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
             if (trim($line) !== '') {
239 239
                 if ($type === 'err') {
240 240
                     $this->writeErrorln(
241
-                        '[' . $processIndex . '][' . $pid . '] ' . trim($line),
241
+                        '['.$processIndex.']['.$pid.'] '.trim($line),
242 242
                         OutputInterface::VERBOSITY_VERBOSE,
243 243
                         OutputInterface::OUTPUT_RAW
244 244
                     );
245 245
                 } else {
246 246
                     $this->writeln(
247
-                        '[' . $processIndex . '][' . $pid . '] ' . trim($line),
247
+                        '['.$processIndex.']['.$pid.'] '.trim($line),
248 248
                         OutputInterface::VERBOSITY_VERBOSE,
249 249
                         OutputInterface::OUTPUT_RAW
250 250
                     );
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             return;
288 288
         }
289 289
 
290
-        foreach($results['data'] as $instanceName => $data) {
290
+        foreach ($results['data'] as $instanceName => $data) {
291 291
             $formattedData = $this->formatResults(array('data' => $data));
292 292
             $outputFile = $this->replaceDBSpecTokens($this->outputFile, $instanceName, $this->dbConfigurationManager->getInstanceConfiguration($instanceName));
293 293
             file_put_contents($outputFile, $formattedData);
Please login to merge, or discard this patch.