@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | if ($input->getOption('todo')) { |
| 199 | 199 | foreach ($data as $migrationData) { |
| 200 | - $output->writeln("$migrationData", OutputInterface::OUTPUT_RAW|OutputInterface::VERBOSITY_QUIET); |
|
| 200 | + $output->writeln("$migrationData", OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_QUIET); |
|
| 201 | 201 | } |
| 202 | 202 | return 0; |
| 203 | 203 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | protected function sortMigrationIndex(array &$index, $sortBy) |
| 228 | 228 | { |
| 229 | - switch($sortBy) { |
|
| 229 | + switch ($sortBy) { |
|
| 230 | 230 | case 'execution': |
| 231 | 231 | uasort($index, function($m1, $m2) { |
| 232 | 232 | if (isset($m1['migration']) && $m1['migration']->executionDate !== null) { |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 286 | - throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition). " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); |
|
| 286 | + throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition) . " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /// @todo add support for setting in $migrationContext a userContentType, userGroupContentType ? |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | try { |
| 319 | 319 | |
| 320 | - $i = $stepOffset+1; |
|
| 320 | + $i = $stepOffset + 1; |
|
| 321 | 321 | $finalStatus = Migration::STATUS_DONE; |
| 322 | 322 | $finalMessage = null; |
| 323 | 323 | |
@@ -454,12 +454,12 @@ discard block |
||
| 454 | 454 | public function resumeMigration(Migration $migration, $useTransaction = true, array $forcedReferences = array()) |
| 455 | 455 | { |
| 456 | 456 | if ($migration->status != Migration::STATUS_SUSPENDED) { |
| 457 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status"); |
|
| 457 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': it is not in suspended status"); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | $migrationDefinitions = $this->getMigrationsDefinitions(array($migration->path)); |
| 461 | 461 | if (!count($migrationDefinitions)) { |
| 462 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': its definition is missing"); |
|
| 462 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': its definition is missing"); |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | $defs = $migrationDefinitions->getArrayCopy(); |
@@ -467,24 +467,24 @@ discard block |
||
| 467 | 467 | |
| 468 | 468 | $migrationDefinition = $this->parseMigrationDefinition($migrationDefinition); |
| 469 | 469 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 470 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': {$migrationDefinition->parsingError}"); |
|
| 470 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': {$migrationDefinition->parsingError}"); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | // restore context |
| 474 | 474 | $this->contextHandler->restoreCurrentContext($migration->name); |
| 475 | 475 | |
| 476 | 476 | if ($forcedReferences) { |
| 477 | - foreach($forcedReferences as $name => $value) { |
|
| 477 | + foreach ($forcedReferences as $name => $value) { |
|
| 478 | 478 | $this->referenceResolver->addReference($name, $value, true); |
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | if (!isset($this->migrationContext[$migration->name])) { |
| 483 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is missing"); |
|
| 483 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is missing"); |
|
| 484 | 484 | } |
| 485 | 485 | $restoredContext = $this->migrationContext[$migration->name]; |
| 486 | - if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'] )) { |
|
| 487 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is invalid"); |
|
| 486 | + if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'])) { |
|
| 487 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is invalid"); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | // update migration status |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | * @param bool|null $forceSigchildEnabled |
| 506 | 506 | * @return array |
| 507 | 507 | */ |
| 508 | - protected function migrationContextFromParameters($defaultLanguageCode = null, $adminLogin = null, $forceSigchildEnabled = null ) |
|
| 508 | + protected function migrationContextFromParameters($defaultLanguageCode = null, $adminLogin = null, $forceSigchildEnabled = null) |
|
| 509 | 509 | { |
| 510 | 510 | $properties = array(); |
| 511 | 511 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $forcedRefs = array(); |
| 98 | 98 | if ($input->getOption('set-reference') /*&& !$input->getOption('separate-process')*/) { |
| 99 | 99 | $refResolver = $this->getContainer()->get('ez_migration_bundle.reference_resolver.customreference'); |
| 100 | - foreach($input->getOption('set-reference') as $refSpec) { |
|
| 100 | + foreach ($input->getOption('set-reference') as $refSpec) { |
|
| 101 | 101 | $ref = explode(':', $refSpec, 2); |
| 102 | 102 | if (count($ref) < 2 || $ref[0] === '') { |
| 103 | 103 | throw new \Exception("Invalid reference specification: '$refSpec'"); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $executed = 0; |
| 110 | 110 | $failed = 0; |
| 111 | 111 | |
| 112 | - foreach($suspendedMigrations as $suspendedMigration) { |
|
| 112 | + foreach ($suspendedMigrations as $suspendedMigration) { |
|
| 113 | 113 | $output->writeln("<info>Resuming {$suspendedMigration->name}</info>"); |
| 114 | 114 | |
| 115 | 115 | try { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $time = microtime(true) - $start; |
| 131 | 131 | $output->writeln("Resumed $executed migrations, failed $failed"); |
| 132 | - $output->writeln("Time taken: ".sprintf('%.3f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB'); |
|
| 132 | + $output->writeln("Time taken: " . sprintf('%.3f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB'); |
|
| 133 | 133 | |
| 134 | 134 | if ($failed) { |
| 135 | 135 | return 2; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | if ($input->getOption('set-reference') && !$input->getOption('separate-process')) { |
| 134 | 134 | $refResolver = $this->getContainer()->get('ez_migration_bundle.reference_resolver.customreference'); |
| 135 | - foreach($input->getOption('set-reference') as $refSpec) { |
|
| 135 | + foreach ($input->getOption('set-reference') as $refSpec) { |
|
| 136 | 136 | $ref = explode(':', $refSpec, 2); |
| 137 | 137 | if (count($ref) < 2 || $ref[0] === '') { |
| 138 | 138 | throw new \Exception("Invalid reference specification: '$refSpec'"); |
@@ -232,9 +232,9 @@ discard block |
||
| 232 | 232 | $time = microtime(true) - $start; |
| 233 | 233 | if ($input->getOption('separate-process')) { |
| 234 | 234 | // in case of using subprocesses, we can not measure max memory used |
| 235 | - $this->writeln("<info>Time taken: ".sprintf('%.3f', $time)." secs</info>"); |
|
| 235 | + $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs</info>"); |
|
| 236 | 236 | } else { |
| 237 | - $this->writeln("<info>Time taken: ".sprintf('%.3f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB</info>'); |
|
| 237 | + $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB</info>'); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | return $failed; |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | $builderArgs[] = '--no-debug'; |
| 467 | 467 | } |
| 468 | 468 | if ($input->getOption('siteaccess')) { |
| 469 | - $builderArgs[] = '--siteaccess='.$input->getOption('siteaccess'); |
|
| 469 | + $builderArgs[] = '--siteaccess=' . $input->getOption('siteaccess'); |
|
| 470 | 470 | } |
| 471 | 471 | switch ($this->verbosity) { |
| 472 | 472 | case OutputInterface::VERBOSITY_VERBOSE: |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | $builderArgs[] = '--no-transactions'; |
| 499 | 499 | } |
| 500 | 500 | if ($input->getOption('set-reference')) { |
| 501 | - foreach($input->getOption('set-reference') as $refSpec) { |
|
| 501 | + foreach ($input->getOption('set-reference') as $refSpec) { |
|
| 502 | 502 | $builderArgs[] = '--set-reference=' . $refSpec; |
| 503 | 503 | } |
| 504 | 504 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | throw new \Exception("Invalid step definition: file '$fileName' for saving references already exists"); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if (! $this->referenceResolver instanceof EnumerableReferenceResolverInterface) { |
|
| 163 | + if (!$this->referenceResolver instanceof EnumerableReferenceResolverInterface) { |
|
| 164 | 164 | throw new \Exception("Can not save references as resolver is not enumerable"); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $value = $this->dumpVar($this->referenceResolver->resolveReference($dsl['identifier'])); |
| 206 | 206 | |
| 207 | 207 | if (isset($context['output']) && $context['output'] instanceof OutputInterface) { |
| 208 | - $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW|OutputInterface::VERBOSITY_NORMAL); |
|
| 208 | + $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_NORMAL); |
|
| 209 | 209 | } else { |
| 210 | 210 | echo $label . $value; |
| 211 | 211 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | $dumper->dump( |
| 229 | 229 | $cloner->cloneVar($var), |
| 230 | - function ($line, $depth) use (&$output) { |
|
| 230 | + function($line, $depth) use (&$output) { |
|
| 231 | 231 | // A negative depth means "end of dump" |
| 232 | 232 | if ($depth >= 0) { |
| 233 | 233 | // Adds a two spaces indentation to the line |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | if (is_array($paths) && count($paths)) { |
| 86 | 86 | $pexps = array(); |
| 87 | - foreach($paths as $path) { |
|
| 87 | + foreach ($paths as $path) { |
|
| 88 | 88 | /// @todo use a proper db-aware escaping function |
| 89 | - $pexps[] = $q->expr->like('path', "'" . str_replace(array('_', '%', "'"), array('\_', '\%', "''"), $path).'%' . "'"); |
|
| 89 | + $pexps[] = $q->expr->like('path', "'" . str_replace(array('_', '%', "'"), array('\_', '\%', "''"), $path) . '%' . "'"); |
|
| 90 | 90 | } |
| 91 | 91 | $exps[] = $q->expr->lor($pexps); |
| 92 | 92 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | public function endMigration(APIMigration $migration, $force = false) |
| 197 | 197 | { |
| 198 | 198 | if ($migration->status == APIMigration::STATUS_STARTED) { |
| 199 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be ended as its status is 'started'..."); |
|
| 199 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be ended as its status is 'started'..."); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | $this->createTableIfNeeded(); |
@@ -223,13 +223,13 @@ discard block |
||
| 223 | 223 | if (!is_array($existingMigrationData)) { |
| 224 | 224 | // commit to release the lock |
| 225 | 225 | $conn->commit(); |
| 226 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be ended as it is not found"); |
|
| 226 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be ended as it is not found"); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if (($existingMigrationData['status'] != APIMigration::STATUS_STARTED) && !$force) { |
| 230 | 230 | // commit to release the lock |
| 231 | 231 | $conn->commit(); |
| 232 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be ended as it is not executing"); |
|
| 232 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be ended as it is not executing"); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $conn->update( |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | if (!is_array($existingMigrationData)) { |
| 385 | 385 | // commit immediately, to release the lock and avoid deadlocks |
| 386 | 386 | $conn->commit(); |
| 387 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be resumed as it is not found"); |
|
| 387 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be resumed as it is not found"); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // migration exists |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | if ($existingMigrationData['status'] != APIMigration::STATUS_SUSPENDED) { |
| 394 | 394 | // commit to release the lock |
| 395 | 395 | $conn->commit(); |
| 396 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be resumed as it is not suspended"); |
|
| 396 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be resumed as it is not suspended"); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $migration = new APIMigration( |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | foreach ($schema->toSql($dbPlatform) as $sql) { |
| 456 | 456 | try { |
| 457 | 457 | $this->dbHandler->exec($sql); |
| 458 | - } catch(QueryException $e) { |
|
| 458 | + } catch (QueryException $e) { |
|
| 459 | 459 | // work around limitations in both Mysql and Doctrine |
| 460 | 460 | // @see https://github.com/kaliop-uk/ezmigrationbundle/issues/176 |
| 461 | 461 | if (strpos($e->getMessage(), '1071 Specified key was too long; max key length is 767 bytes') !== false && |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | if ($this->usingLegacyFieldType()) { |
| 26 | 26 | $rows = array(); |
| 27 | - foreach($fieldValue as $data) { |
|
| 27 | + foreach ($fieldValue as $data) { |
|
| 28 | 28 | $rows[] = new \EzSystems\MatrixBundle\FieldType\Matrix\Row($data); |
| 29 | 29 | } |
| 30 | 30 | return new \EzSystems\MatrixBundle\FieldType\Matrix\Value($rows); |
| 31 | 31 | } else { |
| 32 | 32 | $rows = array(); |
| 33 | - foreach($fieldValue as $data) { |
|
| 33 | + foreach ($fieldValue as $data) { |
|
| 34 | 34 | $rows[] = new \EzSystems\EzPlatformMatrixFieldtype\FieldType\Value\Row($data); |
| 35 | 35 | } |
| 36 | 36 | return new \EzSystems\EzPlatformMatrixFieldtype\FieldType\Value($rows); |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | $data = array(); |
| 43 | 43 | |
| 44 | 44 | if ($this->usingLegacyFieldType()) { |
| 45 | - foreach($fieldValue->getRows() as $row) { |
|
| 45 | + foreach ($fieldValue->getRows() as $row) { |
|
| 46 | 46 | $data[] = $row->toArray(); |
| 47 | 47 | } |
| 48 | 48 | } else { |
| 49 | - foreach($fieldValue->getRows() as $row) { |
|
| 49 | + foreach ($fieldValue->getRows() as $row) { |
|
| 50 | 50 | $data[] = $row->getCells(); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | $locations = $locationService->loadLocations($content->contentInfo); |
| 546 | 546 | if (count($locations) > 1) { |
| 547 | 547 | $otherParentLocations = array(); |
| 548 | - foreach($locations as $otherLocation) { |
|
| 548 | + foreach ($locations as $otherLocation) { |
|
| 549 | 549 | if ($otherLocation->id != $location->id) { |
| 550 | 550 | $otherParentLocations[] = $otherLocation->parentLocationId; |
| 551 | 551 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | $attributes = array(); |
| 599 | - foreach($languages as $lang) { |
|
| 599 | + foreach ($languages as $lang) { |
|
| 600 | 600 | foreach ($content->getFieldsByLanguage($lang) as $fieldIdentifier => $field) { |
| 601 | 601 | $fieldDefinition = $contentType->getFieldDefinition($fieldIdentifier); |
| 602 | 602 | $fieldValue = $this->fieldHandlerManager->fieldValueToHash( |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | }, |
| 745 | 745 | array_filter( |
| 746 | 746 | $this->repository->getContentLanguageService()->loadLanguages(), |
| 747 | - function ($language) { |
|
| 747 | + function($language) { |
|
| 748 | 748 | return $language->enabled; |
| 749 | 749 | } |
| 750 | 750 | ) |