@@ -10,7 +10,7 @@ |
||
10 | 10 | protected $ioDecorator; |
11 | 11 | protected $ioService; |
12 | 12 | |
13 | - public function __construct($ioRootDir, UrlDecorator $ioDecorator=null, $ioService=null) |
|
13 | + public function __construct($ioRootDir, UrlDecorator $ioDecorator = null, $ioService = null) |
|
14 | 14 | { |
15 | 15 | $this->ioRootDir = $ioRootDir; |
16 | 16 | $this->ioDecorator = $ioDecorator; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | $processes = array(); |
134 | 134 | /** @var MigrationDefinition $migrationDefinition */ |
135 | - foreach($paths as $path => $count) { |
|
135 | + foreach ($paths as $path => $count) { |
|
136 | 136 | $this->writeln("<info>Queueing processing of: $path ($count migrations)</info>", OutputInterface::VERBOSITY_VERBOSE); |
137 | 137 | |
138 | 138 | $process = $builder |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | $missed = $total - $this->migrationsDone[Migration::STATUS_DONE] - $this->migrationsDone[Migration::STATUS_FAILED] - $this->migrationsDone[Migration::STATUS_SKIPPED]; |
182 | - $this->writeln("\nExecuted ".$this->migrationsDone[Migration::STATUS_DONE].' migrations'. |
|
183 | - ', failed '.$this->migrationsDone[Migration::STATUS_FAILED]. |
|
184 | - ', skipped '.$this->migrationsDone[Migration::STATUS_SKIPPED]. |
|
182 | + $this->writeln("\nExecuted " . $this->migrationsDone[Migration::STATUS_DONE] . ' migrations' . |
|
183 | + ', failed ' . $this->migrationsDone[Migration::STATUS_FAILED] . |
|
184 | + ', skipped ' . $this->migrationsDone[Migration::STATUS_SKIPPED] . |
|
185 | 185 | ($missed ? ", missed $missed" : '')); |
186 | 186 | |
187 | 187 | $time = microtime(true) - $start; |
188 | 188 | // since we use subprocesses, we can not measure max memory used |
189 | - $this->writeln("<info>Time taken: ".sprintf('%.3f', $time)." secs</info>"); |
|
189 | + $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs</info>"); |
|
190 | 190 | |
191 | 191 | return $subprocessesFailed + $this->migrationsDone[Migration::STATUS_FAILED] + $missed; |
192 | 192 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $prefix = array($php); |
212 | 212 | |
213 | 213 | if ($input->getOption('child-process-php-ini-config')) { |
214 | - foreach($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
214 | + foreach ($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
215 | 215 | $ini = explode(':', $iniSpec, 2); |
216 | 216 | if (count($ini) < 2 || $ini[0] === '') { |
217 | 217 | throw new \Exception("Invalid php ini specification: '$iniSpec'"); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | foreach ($toExecute as $name => $migrationDefinition) { |
241 | 241 | // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
242 | 242 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
243 | - $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::VERBOSITY_CHILD); |
|
243 | + $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::VERBOSITY_CHILD); |
|
244 | 244 | $skipped++; |
245 | 245 | continue; |
246 | 246 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input); |
281 | 281 | |
282 | 282 | $executed++; |
283 | - } catch(\Exception $e) { |
|
283 | + } catch (\Exception $e) { |
|
284 | 284 | $failed++; |
285 | 285 | |
286 | 286 | $errorMessage = $e->getMessage(); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * @param string $buffer |
314 | 314 | * @param null|\Symfony\Component\Process\Process $process |
315 | 315 | */ |
316 | - public function onChildProcessOutput($type, $buffer, $process=null) |
|
316 | + public function onChildProcessOutput($type, $buffer, $process = null) |
|
317 | 317 | { |
318 | 318 | $lines = explode("\n", trim($buffer)); |
319 | 319 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | // we tag the output with the id of the child process |
333 | 333 | if (trim($line) !== '') { |
334 | - $msg = '[' . ($process ? $process->getPid() : ''). '] ' . trim($line); |
|
334 | + $msg = '[' . ($process ? $process->getPid() : '') . '] ' . trim($line); |
|
335 | 335 | if ($type == 'err') { |
336 | 336 | $this->writeErrorln($msg, OutputInterface::VERBOSITY_QUIET, OutputInterface::OUTPUT_RAW); |
337 | 337 | } else { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | |
366 | 366 | // filter away all migrations except 'to do' ones |
367 | 367 | $toExecute = array(); |
368 | - foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
368 | + foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
369 | 369 | if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && in_array($migration->status, $allowedStatuses))) { |
370 | 370 | $toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition; |
371 | 371 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | { |
408 | 408 | $output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
409 | 409 | $output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
410 | - ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
410 | + ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
411 | 411 | if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) { |
412 | 412 | $output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>'); |
413 | 413 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | protected function groupMigrationsByPath($toExecute) |
421 | 421 | { |
422 | 422 | $paths = array(); |
423 | - foreach($toExecute as $name => $migrationDefinition) { |
|
423 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
424 | 424 | $path = dirname($migrationDefinition->path); |
425 | 425 | if (!isset($paths[$path])) { |
426 | 426 | $paths[$path] = 1; |
@@ -497,12 +497,12 @@ discard block |
||
497 | 497 | $builderArgs[] = '--separate-process'; |
498 | 498 | } |
499 | 499 | if ($input->getOption('set-reference')) { |
500 | - foreach($input->getOption('set-reference') as $refSpec) { |
|
500 | + foreach ($input->getOption('set-reference') as $refSpec) { |
|
501 | 501 | $builderArgs[] = '--set-reference=' . $refSpec; |
502 | 502 | } |
503 | 503 | } |
504 | 504 | if ($input->getOption('child-process-php-ini-config')) { |
505 | - foreach($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
505 | + foreach ($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
506 | 506 | $builderArgs[] = '--child-process-php-ini-config=' . $iniSpec; |
507 | 507 | } |
508 | 508 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | // which is misleading. We add the following loop to fix that, so that the status command will match more closely |
94 | 94 | // the 'migrate' command |
95 | 95 | if (count($paths)) { |
96 | - foreach($index as $migrationName => $data) { |
|
96 | + foreach ($index as $migrationName => $data) { |
|
97 | 97 | if (!isset($data['migration'])) { |
98 | 98 | $migration = $migrationsService->getMigration($migrationName); |
99 | 99 | if ($migration !== null) { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | if ($input->getOption('todo')) { |
233 | 233 | foreach ($data as $migrationData) { |
234 | - $output->writeln("$migrationData", OutputInterface::OUTPUT_RAW|OutputInterface::VERBOSITY_QUIET); |
|
234 | + $output->writeln("$migrationData", OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_QUIET); |
|
235 | 235 | } |
236 | 236 | return 0; |
237 | 237 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | protected function sortMigrationIndex(array &$index, $sortBy) |
262 | 262 | { |
263 | - switch($sortBy) { |
|
263 | + switch ($sortBy) { |
|
264 | 264 | case 'execution': |
265 | 265 | uasort($index, function($m1, $m2) { |
266 | 266 | if (isset($m1['migration']) && $m1['migration']->executionDate !== null) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $prefix = array($php); |
120 | 120 | |
121 | 121 | if ($input->getOption('child-process-php-ini-config')) { |
122 | - foreach($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
122 | + foreach ($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
123 | 123 | $ini = explode(':', $iniSpec, 2); |
124 | 124 | if (count($ini) < 2 || $ini[0] === '') { |
125 | 125 | throw new \Exception("Invalid php ini specification: '$iniSpec'"); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | if ($input->getOption('set-reference') && !$input->getOption('separate-process')) { |
147 | 147 | $refResolver = $this->getContainer()->get('ez_migration_bundle.reference_resolver.customreference'); |
148 | - foreach($input->getOption('set-reference') as $refSpec) { |
|
148 | + foreach ($input->getOption('set-reference') as $refSpec) { |
|
149 | 149 | $ref = explode(':', $refSpec, 2); |
150 | 150 | if (count($ref) < 2 || $ref[0] === '') { |
151 | 151 | throw new \Exception("Invalid reference specification: '$refSpec'"); |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | $time = microtime(true) - $start; |
247 | 247 | if ($input->getOption('separate-process')) { |
248 | 248 | // in case of using subprocesses, we can not measure max memory used |
249 | - $this->writeln("<info>Time taken: ".sprintf('%.3f', $time)." secs</info>"); |
|
249 | + $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs</info>"); |
|
250 | 250 | } else { |
251 | - $this->writeln("<info>Time taken: ".sprintf('%.3f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB</info>'); |
|
251 | + $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB</info>'); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | return $failed; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | $builderArgs[] = '--no-debug'; |
481 | 481 | } |
482 | 482 | if ($input->getOption('siteaccess')) { |
483 | - $builderArgs[] = '--siteaccess='.$input->getOption('siteaccess'); |
|
483 | + $builderArgs[] = '--siteaccess=' . $input->getOption('siteaccess'); |
|
484 | 484 | } |
485 | 485 | switch ($this->verbosity) { |
486 | 486 | case OutputInterface::VERBOSITY_VERBOSE: |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $builderArgs[] = '--no-transactions'; |
513 | 513 | } |
514 | 514 | if ($input->getOption('set-reference')) { |
515 | - foreach($input->getOption('set-reference') as $refSpec) { |
|
515 | + foreach ($input->getOption('set-reference') as $refSpec) { |
|
516 | 516 | $builderArgs[] = '--set-reference=' . $refSpec; |
517 | 517 | } |
518 | 518 | } |
@@ -44,12 +44,12 @@ |
||
44 | 44 | return array( |
45 | 45 | new ExpressionFunction( |
46 | 46 | 'resolve', |
47 | - function ($str) { |
|
47 | + function($str) { |
|
48 | 48 | /// @todo we could implement this via eg a static class var which holds a pointer to $this->referenceResolver |
49 | 49 | //return sprintf('(is_string(%1$s) ? FakerResolver::resolveExpressionLanguageReference(%1$s) : %1$s)', $str); |
50 | 50 | return "throw new \Exception('The \'resolve\' expression language operator can not be compiled, only evaluated'"; |
51 | 51 | }, |
52 | - function ($arguments, $str) use ($resolver) { |
|
52 | + function($arguments, $str) use ($resolver) { |
|
53 | 53 | if (!is_string($str)) { |
54 | 54 | return $str; |
55 | 55 | } |
@@ -131,7 +131,7 @@ |
||
131 | 131 | $refs = array(); |
132 | 132 | |
133 | 133 | foreach ($this->resolvers as $resolver) { |
134 | - if (! $resolver instanceof EnumerableReferenceResolverInterface) { |
|
134 | + if (!$resolver instanceof EnumerableReferenceResolverInterface) { |
|
135 | 135 | // Disabled - we now allow chaining enumerable and non-enumerable sets |
136 | 136 | //throw new \Exception("Could not enumerate references because of chained resolver of type: " . get_class($resolver)); |
137 | 137 | continue; |
@@ -84,7 +84,7 @@ |
||
84 | 84 | |
85 | 85 | $args = $dsl['arguments']; |
86 | 86 | |
87 | - foreach($args as &$val) { |
|
87 | + foreach ($args as &$val) { |
|
88 | 88 | $val = $this->resolveReferencesRecursively($val); |
89 | 89 | } |
90 | 90 | } else { |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $body = isset($dsl['body']) ? $this->resolveReferencesInText($dsl['body']) : null; |
76 | 76 | |
77 | 77 | if (isset($dsl['client'])) { |
78 | - $client = $this->container->get('httplug.client.'.$this->referenceResolver->resolveReference($dsl['client'])); |
|
78 | + $client = $this->container->get('httplug.client.' . $this->referenceResolver->resolveReference($dsl['client'])); |
|
79 | 79 | } else { |
80 | 80 | $client = $this->container->get('httplug.client'); |
81 | 81 | } |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | $subStep = new MigrationStep($type, $stepDef, array_merge($context, array())); |
100 | 100 | try { |
101 | 101 | $result = $stepExecutors[$j]->execute($subStep); |
102 | - } catch(MigrationStepSkippedException $e) { |
|
102 | + } catch (MigrationStepSkippedException $e) { |
|
103 | 103 | // all ok, continue the loop |
104 | - } catch(LoopContinueException $e) { |
|
104 | + } catch (LoopContinueException $e) { |
|
105 | 105 | // all ok, move to the next iteration |
106 | 106 | break; |
107 | 107 | } |
108 | 108 | } |
109 | - } catch(LoopBreakException $e) { |
|
109 | + } catch (LoopBreakException $e) { |
|
110 | 110 | // all ok, exit the loop |
111 | 111 | break; |
112 | 112 | } |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | $subStep = new MigrationStep($type, $stepDef, array_merge($context, array())); |
136 | 136 | try { |
137 | 137 | $result = $stepExecutors[$j]->execute($subStep); |
138 | - } catch(MigrationStepSkippedException $e) { |
|
138 | + } catch (MigrationStepSkippedException $e) { |
|
139 | 139 | // all ok, continue the loop |
140 | - } catch(LoopContinueException $e) { |
|
140 | + } catch (LoopContinueException $e) { |
|
141 | 141 | // all ok, move to the next iteration |
142 | 142 | break; |
143 | 143 | } |
144 | 144 | } |
145 | - } catch(LoopBreakException $e) { |
|
145 | + } catch (LoopBreakException $e) { |
|
146 | 146 | // all ok, exit the loop |
147 | 147 | break; |
148 | 148 | } |