@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::CREATED, self::$operatorsMap[$operator], $match); |
| 149 | 149 | |
| 150 | 150 | case self::MATCH_GROUP: |
| 151 | - foreach($values as &$value) { |
|
| 151 | + foreach ($values as &$value) { |
|
| 152 | 152 | if (!ctype_digit($value)) { |
| 153 | 153 | $value = $this->groupMatcher->matchOneByKey($value)->id; |
| 154 | 154 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::MODIFIED, self::$operatorsMap[$operator], $match); |
| 168 | 168 | |
| 169 | 169 | case self::MATCH_OBJECT_STATE: |
| 170 | - foreach($values as &$value) { |
|
| 170 | + foreach ($values as &$value) { |
|
| 171 | 171 | if (!ctype_digit($value)) { |
| 172 | 172 | $value = $this->stateMatcher->matchOneByKey($value)->id; |
| 173 | 173 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | return new Query\Criterion\ObjectStateId($values); |
| 176 | 176 | |
| 177 | 177 | case self::MATCH_OWNER: |
| 178 | - foreach($values as &$value) { |
|
| 178 | + foreach ($values as &$value) { |
|
| 179 | 179 | if (!ctype_digit($value)) { |
| 180 | 180 | $value = $this->userMatcher->matchOneByKey($value)->id; |
| 181 | 181 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | return new Query\Criterion\ParentLocationId($locationIds); |
| 196 | 196 | |
| 197 | 197 | case self::MATCH_SECTION: |
| 198 | - foreach($values as &$value) { |
|
| 198 | + foreach ($values as &$value) { |
|
| 199 | 199 | if (!ctype_digit($value)) { |
| 200 | 200 | $value = $this->sectionMatcher->matchOneByKey($value)->id; |
| 201 | 201 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | case self::MATCH_AND: |
| 218 | 218 | $subCriteria = array(); |
| 219 | - foreach($values as $subCriterion) { |
|
| 219 | + foreach ($values as $subCriterion) { |
|
| 220 | 220 | $value = reset($subCriterion); |
| 221 | 221 | $subCriteria[] = $this->getQueryCriterion(key($subCriterion), $value); |
| 222 | 222 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | case self::MATCH_OR: |
| 226 | 226 | $subCriteria = array(); |
| 227 | - foreach($values as $subCriterion) { |
|
| 227 | + foreach ($values as $subCriterion) { |
|
| 228 | 228 | $value = reset($subCriterion); |
| 229 | 229 | $subCriteria[] = $this->getQueryCriterion(key($subCriterion), $value); |
| 230 | 230 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | $direction = $this->hash2SortOrder($sortItem['sort_order']); |
| 268 | 268 | |
| 269 | - switch($sortItem['sort_field']) { |
|
| 269 | + switch ($sortItem['sort_field']) { |
|
| 270 | 270 | case self::SORT_CONTENT_ID: |
| 271 | 271 | $out[] = new SortClause\ContentId($direction); |
| 272 | 272 | break; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | // allow user to pass in selection values by name |
| 38 | 38 | $fieldSettings = null; |
| 39 | - foreach($fieldValue as $key => $val) { |
|
| 39 | + foreach ($fieldValue as $key => $val) { |
|
| 40 | 40 | |
| 41 | 41 | $val = $this->referenceResolver->resolveReference($val); |
| 42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | if ($fieldSettings === null) { |
| 48 | 48 | $fieldSettings = $this->loadFieldSettings($context['contentTypeIdentifier'], $context['fieldIdentifier']); |
| 49 | 49 | } |
| 50 | - foreach($fieldSettings['options'] as $pos => $name) { |
|
| 50 | + foreach ($fieldSettings['options'] as $pos => $name) { |
|
| 51 | 51 | if ($name === $val) { |
| 52 | 52 | $fieldValue[$key] = $pos; |
| 53 | 53 | break; |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | public static function forceSigchildEnabled($force) |
| 16 | 16 | { |
| 17 | - self::$forceSigchildEnabled = (bool) $force; |
|
| 17 | + self::$forceSigchildEnabled = (bool)$force; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | protected function isSigchildEnabled() |
@@ -22,23 +22,23 @@ |
||
| 22 | 22 | public function getProcess() |
| 23 | 23 | { |
| 24 | 24 | $parentClass = get_parent_class($this); |
| 25 | - $this_prefix = \Closure::bind(function(ProcessBuilder $builder){return $builder->prefix;}, null, $parentClass); |
|
| 25 | + $this_prefix = \Closure::bind(function(ProcessBuilder $builder) {return $builder->prefix; }, null, $parentClass); |
|
| 26 | 26 | $this_prefix = $this_prefix($this); |
| 27 | - $this_arguments = \Closure::bind(function(ProcessBuilder $builder){return $builder->arguments;}, null, $parentClass); |
|
| 27 | + $this_arguments = \Closure::bind(function(ProcessBuilder $builder) {return $builder->arguments; }, null, $parentClass); |
|
| 28 | 28 | $this_arguments = $this_arguments($this); |
| 29 | - $this_options = \Closure::bind(function(ProcessBuilder $builder){return $builder->options;}, null, $parentClass); |
|
| 29 | + $this_options = \Closure::bind(function(ProcessBuilder $builder) {return $builder->options; }, null, $parentClass); |
|
| 30 | 30 | $this_options = $this_options($this); |
| 31 | - $this_inheritEnv = \Closure::bind(function(ProcessBuilder $builder){return $builder->inheritEnv;}, null, $parentClass); |
|
| 31 | + $this_inheritEnv = \Closure::bind(function(ProcessBuilder $builder) {return $builder->inheritEnv; }, null, $parentClass); |
|
| 32 | 32 | $this_inheritEnv = $this_inheritEnv($this); |
| 33 | - $this_env = \Closure::bind(function(ProcessBuilder $builder){return $builder->env;}, null, $parentClass); |
|
| 33 | + $this_env = \Closure::bind(function(ProcessBuilder $builder) {return $builder->env; }, null, $parentClass); |
|
| 34 | 34 | $this_env = $this_env($this); |
| 35 | - $this_cwd = \Closure::bind(function(ProcessBuilder $builder){return $builder->cwd;}, null, $parentClass); |
|
| 35 | + $this_cwd = \Closure::bind(function(ProcessBuilder $builder) {return $builder->cwd; }, null, $parentClass); |
|
| 36 | 36 | $this_cwd = $this_cwd($this); |
| 37 | - $this_input = \Closure::bind(function(ProcessBuilder $builder){return $builder->input;}, null, $parentClass); |
|
| 37 | + $this_input = \Closure::bind(function(ProcessBuilder $builder) {return $builder->input; }, null, $parentClass); |
|
| 38 | 38 | $this_input = $this_input($this); |
| 39 | - $this_timeout = \Closure::bind(function(ProcessBuilder $builder){return $builder->timeout;}, null, $parentClass); |
|
| 39 | + $this_timeout = \Closure::bind(function(ProcessBuilder $builder) {return $builder->timeout; }, null, $parentClass); |
|
| 40 | 40 | $this_timeout = $this_timeout($this); |
| 41 | - $this_outputDisabled = \Closure::bind(function(ProcessBuilder $builder){return $builder->outputDisabled;}, null, $parentClass); |
|
| 41 | + $this_outputDisabled = \Closure::bind(function(ProcessBuilder $builder) {return $builder->outputDisabled; }, null, $parentClass); |
|
| 42 | 42 | $this_outputDisabled = $this_outputDisabled($this); |
| 43 | 43 | |
| 44 | 44 | if (0 === count($this_prefix) && 0 === count($this_arguments)) { |
@@ -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('%.2f', $time)." secs</info>"); |
|
| 189 | + $this->writeln("<info>Time taken: " . sprintf('%.2f', $time) . " secs</info>"); |
|
| 190 | 190 | |
| 191 | 191 | return $subprocessesFailed + $this->migrationsDone[Migration::STATUS_FAILED] + $missed; |
| 192 | 192 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | foreach ($toExecute as $name => $migrationDefinition) { |
| 229 | 229 | // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
| 230 | 230 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 231 | - $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::VERBOSITY_CHILD); |
|
| 231 | + $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::VERBOSITY_CHILD); |
|
| 232 | 232 | $skipped++; |
| 233 | 233 | continue; |
| 234 | 234 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input); |
| 269 | 269 | |
| 270 | 270 | $executed++; |
| 271 | - } catch(\Exception $e) { |
|
| 271 | + } catch (\Exception $e) { |
|
| 272 | 272 | $failed++; |
| 273 | 273 | |
| 274 | 274 | $errorMessage = $e->getMessage(); |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @param string $buffer |
| 302 | 302 | * @param null|\Symfony\Component\Process\Process $process |
| 303 | 303 | */ |
| 304 | - public function onChildProcessOutput($type, $buffer, $process=null) |
|
| 304 | + public function onChildProcessOutput($type, $buffer, $process = null) |
|
| 305 | 305 | { |
| 306 | 306 | $lines = explode("\n", trim($buffer)); |
| 307 | 307 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | // we tag the output with the id of the child process |
| 321 | 321 | if (trim($line) !== '') { |
| 322 | - $msg = '[' . ($process ? $process->getPid() : ''). '] ' . trim($line); |
|
| 322 | + $msg = '[' . ($process ? $process->getPid() : '') . '] ' . trim($line); |
|
| 323 | 323 | if ($type == 'err') { |
| 324 | 324 | $this->writeErrorln($msg, OutputInterface::VERBOSITY_QUIET, OutputInterface::OUTPUT_RAW); |
| 325 | 325 | } else { |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | // filter away all migrations except 'to do' ones |
| 355 | 355 | $toExecute = array(); |
| 356 | - foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
| 356 | + foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
| 357 | 357 | if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && in_array($migration->status, $allowedStatuses))) { |
| 358 | 358 | $toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition; |
| 359 | 359 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | { |
| 396 | 396 | $output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
| 397 | 397 | $output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
| 398 | - ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
| 398 | + ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
| 399 | 399 | if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) { |
| 400 | 400 | $output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>'); |
| 401 | 401 | } |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | protected function groupMigrationsByPath($toExecute) |
| 409 | 409 | { |
| 410 | 410 | $paths = array(); |
| 411 | - foreach($toExecute as $name => $migrationDefinition) { |
|
| 411 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
| 412 | 412 | $path = dirname($migrationDefinition->path); |
| 413 | 413 | if (!isset($paths[$path])) { |
| 414 | 414 | $paths[$path] = 1; |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | $time = microtime(true) - $start; |
| 214 | 214 | if ($input->getOption('separate-process')) { |
| 215 | 215 | // in case of using subprocesses, we can not measure max memory used |
| 216 | - $this->writeln("<info>Time taken: ".sprintf('%.2f', $time)." secs</info>"); |
|
| 216 | + $this->writeln("<info>Time taken: " . sprintf('%.2f', $time) . " secs</info>"); |
|
| 217 | 217 | } else { |
| 218 | - $this->writeln("<info>Time taken: ".sprintf('%.2f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB</info>'); |
|
| 218 | + $this->writeln("<info>Time taken: " . sprintf('%.2f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB</info>'); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | return $failed; |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $builderArgs[] = '--no-debug'; |
| 443 | 443 | } |
| 444 | 444 | if ($input->getOption('siteaccess')) { |
| 445 | - $builderArgs[] = '--siteaccess='.$input->getOption('siteaccess'); |
|
| 445 | + $builderArgs[] = '--siteaccess=' . $input->getOption('siteaccess'); |
|
| 446 | 446 | } |
| 447 | 447 | switch ($this->verbosity) { |
| 448 | 448 | case OutputInterface::VERBOSITY_VERBOSE: |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | // sort tags by depth so that there will be no errors in case we are deleting parent and child |
| 163 | 163 | $tagsCollection = $tagsCollection->getArrayCopy(); |
| 164 | - uasort($tagsCollection, function ($t1, $t2) { |
|
| 164 | + uasort($tagsCollection, function($t1, $t2) { |
|
| 165 | 165 | if ($t1->depth == $t2->depth) return 0; |
| 166 | 166 | return ($t1->depth > $t2->depth) ? -1 : 1; |
| 167 | 167 | }); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | case 'create': |
| 267 | 267 | // sort top to bottom |
| 268 | 268 | $tagCollection = $tagCollection->getArrayCopy(); |
| 269 | - uasort($tagCollection, function ($t1, $t2) { |
|
| 269 | + uasort($tagCollection, function($t1, $t2) { |
|
| 270 | 270 | if ($t1->depth == $t2->depth) return 0; |
| 271 | 271 | return ($t1->depth > $t2->depth) ? 1 : -1; |
| 272 | 272 | }); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | case 'delete': |
| 275 | 275 | // sort bottom to top |
| 276 | 276 | $tagCollection = $tagCollection->getArrayCopy(); |
| 277 | - uasort($tagCollection, function ($t1, $t2) { |
|
| 277 | + uasort($tagCollection, function($t1, $t2) { |
|
| 278 | 278 | if ($t1->depth == $t2->depth) return 0; |
| 279 | 279 | return ($t1->depth > $t2->depth) ? -1 : 1; |
| 280 | 280 | }); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | protected function getTagKeywords($tag) |
| 353 | 353 | { |
| 354 | 354 | $out = array(); |
| 355 | - foreach($tag->languageCodes as $languageCode) { |
|
| 355 | + foreach ($tag->languageCodes as $languageCode) { |
|
| 356 | 356 | $out[$languageCode] = $tag->getKeyword($languageCode); |
| 357 | 357 | } |
| 358 | 358 | return $out; |
@@ -156,7 +156,7 @@ |
||
| 156 | 156 | $childTags = $this->findTagsByParentTagIds(array_keys($parentTags)); |
| 157 | 157 | $tags = array_merge($tags, $childTags); |
| 158 | 158 | $parentTags = $childTags; |
| 159 | - } while (count( $childTags ) > 0); |
|
| 159 | + } while (count($childTags) > 0); |
|
| 160 | 160 | |
| 161 | 161 | return $tags; |
| 162 | 162 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 267 | - throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition). " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); |
|
| 267 | + throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition) . " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}"); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /// @todo add support for setting in $migrationContext a userContentType, userGroupContentType ? |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | try { |
| 300 | 300 | |
| 301 | - $i = $stepOffset+1; |
|
| 301 | + $i = $stepOffset + 1; |
|
| 302 | 302 | $finalStatus = Migration::STATUS_DONE; |
| 303 | 303 | $finalMessage = null; |
| 304 | 304 | |
@@ -433,12 +433,12 @@ discard block |
||
| 433 | 433 | public function resumeMigration(Migration $migration, $useTransaction = true) |
| 434 | 434 | { |
| 435 | 435 | if ($migration->status != Migration::STATUS_SUSPENDED) { |
| 436 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status"); |
|
| 436 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': it is not in suspended status"); |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $migrationDefinitions = $this->getMigrationsDefinitions(array($migration->path)); |
| 440 | 440 | if (!count($migrationDefinitions)) { |
| 441 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': its definition is missing"); |
|
| 441 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': its definition is missing"); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | $defs = $migrationDefinitions->getArrayCopy(); |
@@ -446,18 +446,18 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | $migrationDefinition = $this->parseMigrationDefinition($migrationDefinition); |
| 448 | 448 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
| 449 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': {$migrationDefinition->parsingError}"); |
|
| 449 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': {$migrationDefinition->parsingError}"); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | // restore context |
| 453 | 453 | $this->contextHandler->restoreCurrentContext($migration->name); |
| 454 | 454 | |
| 455 | 455 | if (!isset($this->migrationContext[$migration->name])) { |
| 456 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is missing"); |
|
| 456 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is missing"); |
|
| 457 | 457 | } |
| 458 | 458 | $restoredContext = $this->migrationContext[$migration->name]; |
| 459 | - if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'] )) { |
|
| 460 | - throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is invalid"); |
|
| 459 | + if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'])) { |
|
| 460 | + throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is invalid"); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | // update migration status |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | * @param bool|null $forceSigchildEnabled |
| 479 | 479 | * @return array |
| 480 | 480 | */ |
| 481 | - protected function migrationContextFromParameters($defaultLanguageCode = null, $adminLogin = null, $forceSigchildEnabled = null ) |
|
| 481 | + protected function migrationContextFromParameters($defaultLanguageCode = null, $adminLogin = null, $forceSigchildEnabled = null) |
|
| 482 | 482 | { |
| 483 | 483 | $properties = array(); |
| 484 | 484 | |