@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function getReferenceValue($identifier) |
37 | 37 | { |
38 | - switch(substr($identifier, 5)) { |
|
38 | + switch (substr($identifier, 5)) { |
|
39 | 39 | case 'iteration': |
40 | 40 | $current = end($this->stack); |
41 | 41 | return $current['step']; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $subStep = new MigrationStep($type, $stepDef, array_merge($step->context, array())); |
81 | 81 | try { |
82 | 82 | $result = $stepExecutors[$j]->execute($subStep); |
83 | - } catch(MigrationStepSkippedException $e) { |
|
83 | + } catch (MigrationStepSkippedException $e) { |
|
84 | 84 | // all ok, continue the loop |
85 | 85 | } |
86 | 86 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $subStep = new MigrationStep($type, $stepDef, array_merge($step->context, array())); |
98 | 98 | try { |
99 | 99 | $result = $stepExecutors[$j]->execute($subStep); |
100 | - } catch(MigrationStepSkippedException $e) { |
|
100 | + } catch (MigrationStepSkippedException $e) { |
|
101 | 101 | // all ok, continue the loop |
102 | 102 | } |
103 | 103 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | public function sortField2Hash($value) |
41 | 41 | { |
42 | 42 | $ref = new \ReflectionClass('eZ\Publish\API\Repository\Values\Content\Location'); |
43 | - foreach($ref->getConstants() as $key => $val) { |
|
43 | + foreach ($ref->getConstants() as $key => $val) { |
|
44 | 44 | if (strpos($key, 'SORT_FIELD_') === 0 && $val == $value) { |
45 | 45 | $out = strtolower(substr($key, 11)); |
46 | 46 | if ($out == 'contentobject_id') { |
@@ -149,7 +149,7 @@ |
||
149 | 149 | |
150 | 150 | protected function versionStatusToHash($status) |
151 | 151 | { |
152 | - foreach(ContentVersionMatcher::STATUS_MAP as $own => $ez) { |
|
152 | + foreach (ContentVersionMatcher::STATUS_MAP as $own => $ez) { |
|
153 | 153 | if ($status == $ez) { |
154 | 154 | return $own; |
155 | 155 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $versions = array(); |
46 | 46 | |
47 | 47 | $contentCollection = $this->contentMatcher->match($contentConditions, $sort, $offset, $limit); |
48 | - foreach($contentCollection as $content) { |
|
48 | + foreach ($contentCollection as $content) { |
|
49 | 49 | $versions = array_merge($versions, $this->matchContentVersions($versionConditions, $content)); |
50 | 50 | } |
51 | 51 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | { |
152 | 152 | $versions = array(); |
153 | 153 | foreach ($this->findAllContentVersions($content) as $versionKey => $versionInfo) { |
154 | - foreach($values as $acceptedStatus) { |
|
154 | + foreach ($values as $acceptedStatus) { |
|
155 | 155 | if ($versionInfo->status == self::STATUS_MAP[$acceptedStatus]) { |
156 | 156 | $versions[$versionKey] = $versionInfo; |
157 | 157 | break; |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | $contentVersionsCount = count($contentVersions); |
174 | 174 | $i = 0; |
175 | 175 | foreach ($contentVersions as $versionKey => $versionInfo) { |
176 | - foreach($values as $acceptedVersionNo) { |
|
177 | - if ($acceptedVersionNo > 0 ) { |
|
176 | + foreach ($values as $acceptedVersionNo) { |
|
177 | + if ($acceptedVersionNo > 0) { |
|
178 | 178 | if ($acceptedVersionNo == $versionInfo->versionNo) { |
179 | 179 | $versions[$versionKey] = $versionInfo; |
180 | 180 | break; |
181 | 181 | } |
182 | 182 | } else { |
183 | 183 | // negative $acceptedVersionNo means 'leave the last X versions', eg: -1 = leave the last version |
184 | - if ($i < $contentVersionsCount + $acceptedVersionNo) { |
|
184 | + if ($i < $contentVersionsCount + $acceptedVersionNo) { |
|
185 | 185 | $versions[$versionKey] = $versionInfo; |
186 | 186 | break; |
187 | 187 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $contentVersions = $this->repository->getContentService()->loadVersions($content->contentInfo); |
203 | 203 | // different eZ kernels apparently sort versions in different order... |
204 | 204 | $sortedVersions = array(); |
205 | - foreach($contentVersions as $versionInfo) { |
|
205 | + foreach ($contentVersions as $versionInfo) { |
|
206 | 206 | $sortedVersions[$content->contentInfo->id . '/' . $versionInfo->versionNo] = $versionInfo; |
207 | 207 | } |
208 | 208 | ksort($sortedVersions); |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | $this->writeln("Executed $executed migrations, failed $failed, skipped $skipped"); |
220 | 220 | if ($input->getOption('separate-process')) { |
221 | 221 | // in case of using subprocesses, we can not measure max memory used |
222 | - $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs"); |
|
222 | + $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs"); |
|
223 | 223 | } else { |
224 | - $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB'); |
|
224 | + $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB'); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $builderArgs[] = '--no-debug'; |
370 | 370 | } |
371 | 371 | if ($input->getOption('siteaccess')) { |
372 | - $builderArgs[]='--siteaccess='.$input->getOption('siteaccess'); |
|
372 | + $builderArgs[] = '--siteaccess=' . $input->getOption('siteaccess'); |
|
373 | 373 | } |
374 | 374 | // 'optional' options |
375 | 375 | // note: options 'clear-cache', 'ignore-failures', 'no-interaction', 'path' and 'separate-process' we never propagate |
@@ -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; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $processes = array(); |
120 | 120 | /** @var MigrationDefinition $migrationDefinition */ |
121 | - foreach($paths as $path => $count) { |
|
121 | + foreach ($paths as $path => $count) { |
|
122 | 122 | $this->writeln("<info>Queueing processing of: $path ($count migrations)</info>", OutputInterface::VERBOSITY_VERBOSE); |
123 | 123 | |
124 | 124 | $process = $builder |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | |
169 | 169 | $time = microtime(true) - $start; |
170 | 170 | |
171 | - $this->writeln('<info>'.$this->migrationsDone[0].' migrations executed, '.$this->migrationsDone[1].($failed ? ' or more' : '').' failed, '.$this->migrationsDone[2].' skipped</info>'); |
|
171 | + $this->writeln('<info>' . $this->migrationsDone[0] . ' migrations executed, ' . $this->migrationsDone[1] . ($failed ? ' or more' : '') . ' failed, ' . $this->migrationsDone[2] . ' skipped</info>'); |
|
172 | 172 | |
173 | 173 | // since we use subprocesses, we can not measure max memory used |
174 | - $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs"); |
|
174 | + $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs"); |
|
175 | 175 | |
176 | 176 | return $failed + $this->migrationsDone[1]; |
177 | 177 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | foreach ($toExecute as $name => $migrationDefinition) { |
209 | 209 | // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
210 | 210 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
211 | - $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::VERBOSITY_CHILD); |
|
211 | + $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::VERBOSITY_CHILD); |
|
212 | 212 | $skipped++; |
213 | 213 | continue; |
214 | 214 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input); |
243 | 243 | |
244 | 244 | $executed++; |
245 | - } catch(\Exception $e) { |
|
245 | + } catch (\Exception $e) { |
|
246 | 246 | $failed++; |
247 | 247 | if ($input->getOption('ignore-failures')) { |
248 | 248 | $this->writeErrorln("<error>Migration failed! Path: " . $migrationDefinition->path . ", Reason: " . $e->getMessage() . "</error>", self::VERBOSITY_CHILD); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | //return $failed; |
268 | 268 | } |
269 | 269 | |
270 | - public function onSubProcessOutput($type, $buffer, $process=null) |
|
270 | + public function onSubProcessOutput($type, $buffer, $process = null) |
|
271 | 271 | { |
272 | 272 | $lines = explode("\n", trim($buffer)); |
273 | 273 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | // we tag the output from the different processes |
287 | 287 | if (trim($line) !== '') { |
288 | - $msg = '[' . ($process ? $process->getPid() : ''). '] ' . trim($line); |
|
288 | + $msg = '[' . ($process ? $process->getPid() : '') . '] ' . trim($line); |
|
289 | 289 | if ($type == 'err') { |
290 | 290 | $this->errOutput->writeln($msg, OutputInterface::OUTPUT_RAW); |
291 | 291 | } else { |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | |
319 | 319 | // filter away all migrations except 'to do' ones |
320 | 320 | $toExecute = array(); |
321 | - foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
321 | + foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
322 | 322 | if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && in_array($migration->status, $allowedStatuses))) { |
323 | 323 | $toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition; |
324 | 324 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | { |
361 | 361 | $output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
362 | 362 | $output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
363 | - ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
363 | + ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
364 | 364 | if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) { |
365 | 365 | $output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>'); |
366 | 366 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | protected function groupMigrationsByPath($toExecute) |
374 | 374 | { |
375 | 375 | $paths = array(); |
376 | - foreach($toExecute as $name => $migrationDefinition) { |
|
376 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
377 | 377 | $path = dirname($migrationDefinition->path); |
378 | 378 | if (!isset($paths[$path])) { |
379 | 379 | $paths[$path] = 1; |