@@ -599,8 +599,9 @@ |
||
| 599 | 599 | */ |
| 600 | 600 | public function getCurrentContext($migrationName) |
| 601 | 601 | { |
| 602 | - if (!isset($this->migrationContext[$migrationName])) |
|
| 603 | - return null; |
|
| 602 | + if (!isset($this->migrationContext[$migrationName])) { |
|
| 603 | + return null; |
|
| 604 | + } |
|
| 604 | 605 | $context = $this->migrationContext[$migrationName]; |
| 605 | 606 | // avoid attempting to store the current outputInterface when saving the context |
| 606 | 607 | if (isset($context['output'])) { |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 313 | - throw new MigrationBundleException("Can not execute " . $this->getEntityName($migrationDefinition). " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); |
|
| 313 | + throw new MigrationBundleException("Can not execute " . $this->getEntityName($migrationDefinition) . " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /// @todo add support for setting in $migrationContext a userContentType, userGroupContentType ? |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | try { |
| 346 | 346 | |
| 347 | - $i = $stepOffset+1; |
|
| 347 | + $i = $stepOffset + 1; |
|
| 348 | 348 | $finalStatus = Migration::STATUS_DONE; |
| 349 | 349 | $finalMessage = null; |
| 350 | 350 | |
@@ -481,12 +481,12 @@ discard block |
||
| 481 | 481 | public function resumeMigration(Migration $migration, $useTransaction = true, array $forcedReferences = array()) |
| 482 | 482 | { |
| 483 | 483 | if ($migration->status != Migration::STATUS_SUSPENDED) { |
| 484 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status"); |
|
| 484 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': it is not in suspended status"); |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | $migrationDefinitions = $this->getMigrationsDefinitions(array($migration->path)); |
| 488 | 488 | if (!count($migrationDefinitions)) { |
| 489 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': its definition is missing"); |
|
| 489 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': its definition is missing"); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | $defs = $migrationDefinitions->getArrayCopy(); |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | |
| 495 | 495 | $migrationDefinition = $this->parseMigrationDefinition($migrationDefinition); |
| 496 | 496 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 497 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': {$migrationDefinition->parsingError}"); |
|
| 497 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': {$migrationDefinition->parsingError}"); |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | // restore context |
@@ -507,11 +507,11 @@ discard block |
||
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | if (!isset($this->migrationContext[$migration->name])) { |
| 510 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is missing"); |
|
| 510 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is missing"); |
|
| 511 | 511 | } |
| 512 | 512 | $restoredContext = $this->migrationContext[$migration->name]; |
| 513 | 513 | if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'])) { |
| 514 | - throw new MigrationBundleException("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is invalid"); |
|
| 514 | + throw new MigrationBundleException("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is invalid"); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | // update migration status |
@@ -145,7 +145,9 @@ discard block |
||
| 145 | 145 | // q: when getting a query via QueryType, should we always inject offset/limit? |
| 146 | 146 | $query->limit = $limit != 0 ? $limit : $this->queryLimit; |
| 147 | 147 | $query->offset = $offset; |
| 148 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 148 | + if (isset($query->performCount)) { |
|
| 149 | + $query->performCount = false; |
|
| 150 | + } |
|
| 149 | 151 | if (!empty($sort)) { |
| 150 | 152 | $query->sortClauses = $this->getSortClauses($sort); |
| 151 | 153 | } else { |
@@ -271,7 +273,9 @@ discard block |
||
| 271 | 273 | { |
| 272 | 274 | $query = new Query(); |
| 273 | 275 | $query->limit = $this->queryLimit; |
| 274 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 276 | + if (isset($query->performCount)) { |
|
| 277 | + $query->performCount = false; |
|
| 278 | + } |
|
| 275 | 279 | $query->filter = new Query\Criterion\ParentLocationId($parentLocationIds); |
| 276 | 280 | $results = $this->getSearchService()->findContent($query); |
| 277 | 281 | |
@@ -311,7 +315,9 @@ discard block |
||
| 311 | 315 | { |
| 312 | 316 | $query = new Query(); |
| 313 | 317 | $query->limit = $this->queryLimit; |
| 314 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 318 | + if (isset($query->performCount)) { |
|
| 319 | + $query->performCount = false; |
|
| 320 | + } |
|
| 315 | 321 | $query->filter = new Query\Criterion\ContentTypeIdentifier($contentTypeIdentifiers); |
| 316 | 322 | // sort objects by depth, lower to higher, so that deleting them has less chances of failure |
| 317 | 323 | // NB: we only do this in eZP versions that allow depth sorting on content queries |
@@ -339,7 +345,9 @@ discard block |
||
| 339 | 345 | { |
| 340 | 346 | $query = new Query(); |
| 341 | 347 | $query->limit = $this->queryLimit; |
| 342 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 348 | + if (isset($query->performCount)) { |
|
| 349 | + $query->performCount = false; |
|
| 350 | + } |
|
| 343 | 351 | $query->filter = new Query\Criterion\ContentTypeId($contentTypeIds); |
| 344 | 352 | // sort objects by depth, lower to higher, so that deleting them has less chances of failure |
| 345 | 353 | // NB: we only do this in eZP versions that allow depth sorting on content queries |
@@ -107,7 +107,9 @@ discard block |
||
| 107 | 107 | if (!empty($sort)) { |
| 108 | 108 | $query->sortClauses = $this->getSortClauses($sort); |
| 109 | 109 | } |
| 110 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 110 | + if (isset($query->performCount)) { |
|
| 111 | + $query->performCount = false; |
|
| 112 | + } |
|
| 111 | 113 | |
| 112 | 114 | $results = $this->getSearchService()->findLocations($query); |
| 113 | 115 | |
@@ -254,7 +256,9 @@ discard block |
||
| 254 | 256 | { |
| 255 | 257 | $query = new LocationQuery(); |
| 256 | 258 | $query->limit = self::INT_MAX_16BIT; |
| 257 | - if (isset($query->performCount)) $query->performCount = false; |
|
| 259 | + if (isset($query->performCount)) { |
|
| 260 | + $query->performCount = false; |
|
| 261 | + } |
|
| 258 | 262 | $query->filter = new Query\Criterion\ParentLocationId($parentLocationIds); |
| 259 | 263 | |
| 260 | 264 | $results = $this->getSearchService()->findLocations($query); |
@@ -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; |
@@ -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 | } |
@@ -120,6 +120,6 @@ |
||
| 120 | 120 | { |
| 121 | 121 | $rootDir = realpath($this->kernel->getRootDir() . '/..') . '/'; |
| 122 | 122 | // note: we handle the case of 'path = root dir', but path is expected to include a filename... |
| 123 | - return $path === $rootDir ? './' : preg_replace('#^' . preg_quote($rootDir, '#'). '#', '', $path); |
|
| 123 | + return $path === $rootDir ? './' : preg_replace('#^' . preg_quote($rootDir, '#') . '#', '', $path); |
|
| 124 | 124 | } |
| 125 | 125 | } |
@@ -45,12 +45,12 @@ |
||
| 45 | 45 | return array( |
| 46 | 46 | new ExpressionFunction( |
| 47 | 47 | 'resolve', |
| 48 | - function ($str) { |
|
| 48 | + function($str) { |
|
| 49 | 49 | /// @todo we could implement this via eg a static class var which holds a pointer to $this->referenceResolver |
| 50 | 50 | //return sprintf('(is_string(%1$s) ? FakerResolver::resolveExpressionLanguageReference(%1$s) : %1$s)', $str); |
| 51 | 51 | return "throw new MigrationBundleException('The \'resolve\' expression language operator can not be compiled, only evaluated'"; |
| 52 | 52 | }, |
| 53 | - function ($arguments, $str) use ($resolver) { |
|
| 53 | + function($arguments, $str) use ($resolver) { |
|
| 54 | 54 | if (!is_string($str)) { |
| 55 | 55 | return $str; |
| 56 | 56 | } |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | $refs = array(); |
| 133 | 133 | |
| 134 | 134 | foreach ($this->resolvers as $resolver) { |
| 135 | - if (! $resolver instanceof EnumerableReferenceResolverInterface) { |
|
| 135 | + if (!$resolver instanceof EnumerableReferenceResolverInterface) { |
|
| 136 | 136 | // Disabled - we now allow chaining enumerable and non-enumerable sets |
| 137 | 137 | //throw new MigrationBundleException("Could not enumerate references because of chained resolver of type: " . get_class($resolver)); |
| 138 | 138 | continue; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | throw new MigrationBundleException("Invalid step definition: file '$fileName' for saving references already exists"); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if (! $this->referenceResolver instanceof EnumerableReferenceResolverInterface) { |
|
| 166 | + if (!$this->referenceResolver instanceof EnumerableReferenceResolverInterface) { |
|
| 167 | 167 | throw new MigrationBundleException("Can not save references as resolver is not enumerable"); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $value = $this->dumpVar($this->referenceResolver->resolveReference($dsl['identifier'])); |
| 209 | 209 | |
| 210 | 210 | if (isset($context['output']) && $context['output'] instanceof OutputInterface) { |
| 211 | - $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW|OutputInterface::VERBOSITY_NORMAL); |
|
| 211 | + $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_NORMAL); |
|
| 212 | 212 | } else { |
| 213 | 213 | echo $label . $value; |
| 214 | 214 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $dumper->dump( |
| 232 | 232 | $cloner->cloneVar($var), |
| 233 | - function ($line, $depth) use (&$output) { |
|
| 233 | + function($line, $depth) use (&$output) { |
|
| 234 | 234 | // A negative depth means "end of dump" |
| 235 | 235 | if ($depth >= 0) { |
| 236 | 236 | // Adds a two spaces indentation to the line |