@@ -58,25 +58,25 @@ |
||
| 58 | 58 | { |
| 59 | 59 | $format = array(); |
| 60 | 60 | if (0 != $dateInterval->y) { |
| 61 | - $format[] = $dateInterval->y.' years'; |
|
| 61 | + $format[] = $dateInterval->y . ' years'; |
|
| 62 | 62 | } |
| 63 | 63 | if (0 != $dateInterval->m) { |
| 64 | - $format[] = $dateInterval->m.' months'; |
|
| 64 | + $format[] = $dateInterval->m . ' months'; |
|
| 65 | 65 | } |
| 66 | 66 | if (0 != $dateInterval->d) { |
| 67 | - $format[] = $dateInterval->d.' days'; |
|
| 67 | + $format[] = $dateInterval->d . ' days'; |
|
| 68 | 68 | } |
| 69 | 69 | //if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
| 70 | 70 | // $format .= 'T'; |
| 71 | 71 | //} |
| 72 | 72 | if (0 != $dateInterval->h) { |
| 73 | - $format[] = $dateInterval->h.' hours'; |
|
| 73 | + $format[] = $dateInterval->h . ' hours'; |
|
| 74 | 74 | } |
| 75 | 75 | if (0 != $dateInterval->i) { |
| 76 | - $format[] = $dateInterval->i.' minutes'; |
|
| 76 | + $format[] = $dateInterval->i . ' minutes'; |
|
| 77 | 77 | } |
| 78 | 78 | if (0 != $dateInterval->s) { |
| 79 | - $format[] = $dateInterval->s.' seconds'; |
|
| 79 | + $format[] = $dateInterval->s . ' seconds'; |
|
| 80 | 80 | } |
| 81 | 81 | return implode(', ', $format); |
| 82 | 82 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace Kaliop\eZMigrationBundle\Core\Matcher; |
| 4 | 4 | |
| 5 | -use eZ\Publish\API\Repository\Exceptions\UnauthorizedException ; |
|
| 5 | +use eZ\Publish\API\Repository\Exceptions\UnauthorizedException; |
|
| 6 | 6 | use eZ\Publish\API\Repository\Repository; |
| 7 | 7 | use eZ\Publish\API\Repository\Values\Content\Content; |
| 8 | 8 | use eZ\Publish\API\Repository\Values\Content\VersionInfo; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | } else { |
| 213 | 213 | // negative $acceptedVersionNo means 'leave the last X versions', eg: -1 = leave the last version |
| 214 | - if ($i < $contentVersionsCount + $acceptedVersionNo) { |
|
| 214 | + if ($i < $contentVersionsCount + $acceptedVersionNo) { |
|
| 215 | 215 | $versions[$versionKey] = $versionInfo; |
| 216 | 216 | break; |
| 217 | 217 | |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | } |
| 92 | 92 | if (isset($dsl['attach'])) { |
| 93 | 93 | $paths = $this->resolveReferencesRecursively($dsl['attach']); |
| 94 | - foreach((array)$paths as $path) { |
|
| 94 | + foreach ((array)$paths as $path) { |
|
| 95 | 95 | // we use the same logic as for the image/file fields in content: look up file 1st relative to the migration |
| 96 | 96 | $attachment = dirname($context['path']) . '/' . $path; |
| 97 | 97 | if (!is_file($attachment)) { |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | throw new MigrationBundleException("Invalid step definition: file '$fileName' for saving references already exists"); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - if (! $this->referenceResolver instanceof EnumerableReferenceResolverInterface) { |
|
| 173 | + if (!$this->referenceResolver instanceof EnumerableReferenceResolverInterface) { |
|
| 174 | 174 | throw new MigrationBundleException("Can not save references as resolver is not enumerable"); |
| 175 | 175 | } |
| 176 | 176 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $value = $this->dumpVar($this->resolveReference($dsl['identifier'])); |
| 216 | 216 | |
| 217 | 217 | if (isset($context['output']) && $context['output'] instanceof OutputInterface) { |
| 218 | - $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW|OutputInterface::VERBOSITY_NORMAL); |
|
| 218 | + $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_NORMAL); |
|
| 219 | 219 | } else { |
| 220 | 220 | echo $label . $value; |
| 221 | 221 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $dumper->dump( |
| 239 | 239 | $cloner->cloneVar($var), |
| 240 | - function ($line, $depth) use (&$output) { |
|
| 240 | + function($line, $depth) use (&$output) { |
|
| 241 | 241 | // A negative depth means "end of dump" |
| 242 | 242 | if ($depth >= 0) { |
| 243 | 243 | // Adds a two spaces indentation to the line |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $body = isset($dsl['body']) ? $this->resolveReferencesInText($dsl['body']) : null; |
| 77 | 77 | |
| 78 | 78 | if (isset($dsl['client'])) { |
| 79 | - $client = $this->container->get('httplug.client.'.$this->resolveReference($dsl['client'])); |
|
| 79 | + $client = $this->container->get('httplug.client.' . $this->resolveReference($dsl['client'])); |
|
| 80 | 80 | } else { |
| 81 | 81 | $client = $this->container->get('httplug.client'); |
| 82 | 82 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | if (is_string($key) && is_string($value)) { |
| 47 | 47 | return array('identifier' => $key, 'attribute' => $value); |
| 48 | 48 | } |
| 49 | - if (!is_array($value) || !isset($value['identifier']) || ! isset($value['attribute'])) { |
|
| 49 | + if (!is_array($value) || !isset($value['identifier']) || !isset($value['attribute'])) { |
|
| 50 | 50 | throw new InvalidStepDefinitionException("Invalid reference definition for reference number $key"); |
| 51 | 51 | } |
| 52 | 52 | return $value; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | /// @todo can we could have the included migration's steps be printed as 1.1, 1.2 etc... |
| 86 | 86 | /// @todo we could return the result of the included migration's last step |
| 87 | - foreach($migrationDefinitions as $migrationDefinition) { |
|
| 87 | + foreach ($migrationDefinitions as $migrationDefinition) { |
|
| 88 | 88 | $this->migrationService->executeMigration($migrationDefinition, $context); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | foreach ($dsl['references'] as $key => $reference) { |
| 212 | 212 | // BC |
| 213 | - if (is_array($reference) && isset($reference['json_path']) && !isset($reference['attribute'] )) { |
|
| 213 | + if (is_array($reference) && isset($reference['json_path']) && !isset($reference['attribute'])) { |
|
| 214 | 214 | $reference['attribute'] = $reference['json_path']; |
| 215 | 215 | } |
| 216 | 216 | $reference = $this->parseReferenceDefinition($key, $reference); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 317 | - throw new MigrationBundleException("Can not execute " . $this->getEntityName($migrationDefinition). " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); |
|
| 317 | + throw new MigrationBundleException("Can not execute " . $this->getEntityName($migrationDefinition) . " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | // BC: handling of legacy method call signature |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | $this->migrationContext[$migration->name] = array('context' => $migrationContext); |
| 376 | 376 | |
| 377 | 377 | $steps = array_slice($migrationDefinition->steps->getArrayCopy(), $stepOffset); |
| 378 | - $i = $stepOffset+1; |
|
| 378 | + $i = $stepOffset + 1; |
|
| 379 | 379 | $finalStatus = Migration::STATUS_DONE; |
| 380 | 380 | $finalMessage = ''; |
| 381 | 381 | $error = null; |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | |
| 584 | 584 | // save migration status |
| 585 | 585 | |
| 586 | - $finalMessage = ($finalMessage != '' && $messageSuffix != '') ? $finalMessage . '. '. $messageSuffix : $finalMessage . $messageSuffix; |
|
| 586 | + $finalMessage = ($finalMessage != '' && $messageSuffix != '') ? $finalMessage . '. ' . $messageSuffix : $finalMessage . $messageSuffix; |
|
| 587 | 587 | |
| 588 | 588 | try { |
| 589 | 589 | $this->storageHandler->endMigration(new Migration( |
@@ -639,12 +639,12 @@ discard block |
||
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | if ($migration->status != Migration::STATUS_SUSPENDED) { |
| 642 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status"); |
|
| 642 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': it is not in suspended status"); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | $migrationDefinitions = $this->getMigrationsDefinitions(array($migration->path)); |
| 646 | 646 | if (!count($migrationDefinitions)) { |
| 647 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': its definition is missing"); |
|
| 647 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': its definition is missing"); |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | $defs = $migrationDefinitions->getArrayCopy(); |
@@ -652,17 +652,17 @@ discard block |
||
| 652 | 652 | |
| 653 | 653 | $migrationDefinition = $this->parseMigrationDefinition($migrationDefinition); |
| 654 | 654 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 655 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': {$migrationDefinition->parsingError}"); |
|
| 655 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': {$migrationDefinition->parsingError}"); |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // restore context |
| 659 | 659 | $this->contextHandler->restoreCurrentContext($migration->name); |
| 660 | 660 | if (!isset($this->migrationContext[$migration->name])) { |
| 661 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is missing"); |
|
| 661 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is missing"); |
|
| 662 | 662 | } |
| 663 | 663 | $restoredContext = $this->migrationContext[$migration->name]; |
| 664 | 664 | if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'])) { |
| 665 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is invalid"); |
|
| 665 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is invalid"); |
|
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | // update migration status |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | // sort tags by depth so that there will be no errors in case we are deleting parent and child |
| 167 | 167 | $tagsCollection = $tagsCollection->getArrayCopy(); |
| 168 | - uasort($tagsCollection, function ($t1, $t2) { |
|
| 168 | + uasort($tagsCollection, function($t1, $t2) { |
|
| 169 | 169 | if ($t1->depth == $t2->depth) return 0; |
| 170 | 170 | return ($t1->depth > $t2->depth) ? -1 : 1; |
| 171 | 171 | }); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | case 'create': |
| 273 | 273 | // sort top to bottom |
| 274 | 274 | $tagCollection = $tagCollection->getArrayCopy(); |
| 275 | - uasort($tagCollection, function ($t1, $t2) { |
|
| 275 | + uasort($tagCollection, function($t1, $t2) { |
|
| 276 | 276 | if ($t1->depth == $t2->depth) return 0; |
| 277 | 277 | return ($t1->depth > $t2->depth) ? 1 : -1; |
| 278 | 278 | }); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | case 'delete': |
| 281 | 281 | // sort bottom to top |
| 282 | 282 | $tagCollection = $tagCollection->getArrayCopy(); |
| 283 | - uasort($tagCollection, function ($t1, $t2) { |
|
| 283 | + uasort($tagCollection, function($t1, $t2) { |
|
| 284 | 284 | if ($t1->depth == $t2->depth) return 0; |
| 285 | 285 | return ($t1->depth > $t2->depth) ? -1 : 1; |
| 286 | 286 | }); |