@@ -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 | } |
@@ -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 | // NB: this might result in double reference-resolving when the original value is a string, given preResolveReferences... |
42 | 42 | $val = $this->referenceResolver->resolveReference($val); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if ($fieldSettings === null) { |
49 | 49 | $fieldSettings = $this->loadFieldSettings($context['contentTypeIdentifier'], $context['fieldIdentifier']); |
50 | 50 | } |
51 | - foreach($fieldSettings['options'] as $pos => $name) { |
|
51 | + foreach ($fieldSettings['options'] as $pos => $name) { |
|
52 | 52 | if ($name === $val) { |
53 | 53 | $fieldValue[$key] = $pos; |
54 | 54 | break; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | return new Query\Criterion\Field($attribute, self::$operatorsMap[$operator], $match); |
156 | 156 | } else { |
157 | 157 | /// @todo make the list of unary operators more flexible |
158 | - switch($spec) { |
|
158 | + switch ($spec) { |
|
159 | 159 | case 'empty': |
160 | 160 | return new Query\Criterion\IsFieldEmpty($attribute); |
161 | 161 | default: |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::CREATED, self::$operatorsMap[$operator], $match); |
181 | 181 | |
182 | 182 | case self::MATCH_GROUP: |
183 | - foreach($values as &$value) { |
|
183 | + foreach ($values as &$value) { |
|
184 | 184 | if (!ctype_digit($value)) { |
185 | 185 | $value = $this->groupMatcher->matchOneByKey($value)->id; |
186 | 186 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | return new Query\Criterion\DateMetadata(Query\Criterion\DateMetadata::MODIFIED, self::$operatorsMap[$operator], $match); |
200 | 200 | |
201 | 201 | case self::MATCH_OBJECT_STATE: |
202 | - foreach($values as &$value) { |
|
202 | + foreach ($values as &$value) { |
|
203 | 203 | if (!ctype_digit($value)) { |
204 | 204 | $value = $this->stateMatcher->matchOneByKey($value)->id; |
205 | 205 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | return new Query\Criterion\ObjectStateId($values); |
208 | 208 | |
209 | 209 | case self::MATCH_OWNER: |
210 | - foreach($values as &$value) { |
|
210 | + foreach ($values as &$value) { |
|
211 | 211 | if (!ctype_digit($value)) { |
212 | 212 | $value = $this->userMatcher->matchOneByKey($value)->id; |
213 | 213 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | return new Query\Criterion\ParentLocationId($locationIds); |
228 | 228 | |
229 | 229 | case self::MATCH_SECTION: |
230 | - foreach($values as &$value) { |
|
230 | + foreach ($values as &$value) { |
|
231 | 231 | if (!ctype_digit($value)) { |
232 | 232 | $value = $this->sectionMatcher->matchOneByKey($value)->id; |
233 | 233 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | case self::MATCH_AND: |
250 | 250 | $subCriteria = array(); |
251 | - foreach($values as $subCriterion) { |
|
251 | + foreach ($values as $subCriterion) { |
|
252 | 252 | $value = reset($subCriterion); |
253 | 253 | $subCriteria[] = $this->getQueryCriterion(key($subCriterion), $value); |
254 | 254 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | case self::MATCH_OR: |
258 | 258 | $subCriteria = array(); |
259 | - foreach($values as $subCriterion) { |
|
259 | + foreach ($values as $subCriterion) { |
|
260 | 260 | $value = reset($subCriterion); |
261 | 261 | $subCriteria[] = $this->getQueryCriterion(key($subCriterion), $value); |
262 | 262 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | $direction = $this->hash2SortOrder($sortItem['sort_order']); |
303 | 303 | |
304 | - switch($sortItem['sort_field']) { |
|
304 | + switch ($sortItem['sort_field']) { |
|
305 | 305 | case self::SORT_CONTENT_ID: |
306 | 306 | $out[] = new SortClause\ContentId($direction); |
307 | 307 | break; |
@@ -93,7 +93,7 @@ |
||
93 | 93 | // return unique contents |
94 | 94 | $urlWildcard = $this->repository->getURLWildcardService()->load($urlId); |
95 | 95 | $urls[$urlWildcard->id] = $urlWildcard; |
96 | - } catch(NotFoundException $e) { |
|
96 | + } catch (NotFoundException $e) { |
|
97 | 97 | if (!$tolerateMisses) { |
98 | 98 | throw $e; |
99 | 99 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // return unique items |
109 | 109 | $UrlAlias = $this->repository->getUrlAliasService()->load($urlId); |
110 | 110 | $urls[$UrlAlias->id] = $UrlAlias; |
111 | - } catch(NotFoundException $e) { |
|
111 | + } catch (NotFoundException $e) { |
|
112 | 112 | if (!$tolerateMisses) { |
113 | 113 | throw $e; |
114 | 114 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // return unique contents |
134 | 134 | $UrlAlias = $this->repository->getUrlAliasService()->lookup($url); |
135 | 135 | $urls[$UrlAlias->id] = $UrlAlias; |
136 | - } catch(NotFoundException $e) { |
|
136 | + } catch (NotFoundException $e) { |
|
137 | 137 | if (!$tolerateMisses) { |
138 | 138 | throw $e; |
139 | 139 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $urls[$UrlAlias->id] = $UrlAlias; |
174 | 174 | } |
175 | 175 | } |
176 | - } catch(NotFoundException $e) { |
|
176 | + } catch (NotFoundException $e) { |
|
177 | 177 | if (!$tolerateMisses) { |
178 | 178 | throw $e; |
179 | 179 | } |
@@ -65,11 +65,11 @@ |
||
65 | 65 | $data = array(); |
66 | 66 | |
67 | 67 | if ($this->usingLegacyFieldType()) { |
68 | - foreach($fieldValue->rows as $row) { |
|
68 | + foreach ($fieldValue->rows as $row) { |
|
69 | 69 | $data[] = $row->toArray(); |
70 | 70 | } |
71 | 71 | } else { |
72 | - foreach($fieldValue->getRows() as $row) { |
|
72 | + foreach ($fieldValue->getRows() as $row) { |
|
73 | 73 | $data[] = $row->getCells(); |
74 | 74 | } |
75 | 75 | } |
@@ -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('%.3f', $time)." secs</info>"); |
|
189 | + $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs</info>"); |
|
190 | 190 | |
191 | 191 | return $subprocessesFailed + $this->migrationsDone[Migration::STATUS_FAILED] + $missed; |
192 | 192 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $prefix = array($php); |
212 | 212 | |
213 | 213 | if ($input->getOption('child-process-php-ini-config')) { |
214 | - foreach($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
214 | + foreach ($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
215 | 215 | $ini = explode(':', $iniSpec, 2); |
216 | 216 | if (count($ini) < 2 || $ini[0] === '') { |
217 | 217 | throw new \Exception("Invalid php ini specification: '$iniSpec'"); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | foreach ($toExecute as $name => $migrationDefinition) { |
241 | 241 | // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
242 | 242 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
243 | - $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::$VERBOSITY_CHILD); |
|
243 | + $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::$VERBOSITY_CHILD); |
|
244 | 244 | $skipped++; |
245 | 245 | continue; |
246 | 246 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input); |
281 | 281 | |
282 | 282 | $executed++; |
283 | - } catch(\Exception $e) { |
|
283 | + } catch (\Exception $e) { |
|
284 | 284 | $failed++; |
285 | 285 | |
286 | 286 | $errorMessage = $e->getMessage(); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * @param string $buffer |
314 | 314 | * @param null|\Symfony\Component\Process\Process $process |
315 | 315 | */ |
316 | - public function onChildProcessOutput($type, $buffer, $process=null) |
|
316 | + public function onChildProcessOutput($type, $buffer, $process = null) |
|
317 | 317 | { |
318 | 318 | $lines = explode("\n", trim($buffer)); |
319 | 319 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | // we tag the output with the id of the child process |
333 | 333 | if (trim($line) !== '') { |
334 | - $msg = '[' . ($process ? $process->getPid() : ''). '] ' . trim($line); |
|
334 | + $msg = '[' . ($process ? $process->getPid() : '') . '] ' . trim($line); |
|
335 | 335 | if ($type == 'err') { |
336 | 336 | $this->writeErrorln($msg, OutputInterface::VERBOSITY_QUIET, OutputInterface::OUTPUT_RAW); |
337 | 337 | } else { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | |
366 | 366 | // filter away all migrations except 'to do' ones |
367 | 367 | $toExecute = array(); |
368 | - foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
368 | + foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
369 | 369 | if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && in_array($migration->status, $allowedStatuses))) { |
370 | 370 | $toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition; |
371 | 371 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | { |
408 | 408 | $output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
409 | 409 | $output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
410 | - ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
410 | + ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
411 | 411 | if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) { |
412 | 412 | $output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>'); |
413 | 413 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | protected function groupMigrationsByPath($toExecute) |
421 | 421 | { |
422 | 422 | $paths = array(); |
423 | - foreach($toExecute as $name => $migrationDefinition) { |
|
423 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
424 | 424 | $path = dirname($migrationDefinition->path); |
425 | 425 | if (!isset($paths[$path])) { |
426 | 426 | $paths[$path] = 1; |
@@ -497,12 +497,12 @@ discard block |
||
497 | 497 | $builderArgs[] = '--separate-process'; |
498 | 498 | } |
499 | 499 | if ($input->getOption('set-reference')) { |
500 | - foreach($input->getOption('set-reference') as $refSpec) { |
|
500 | + foreach ($input->getOption('set-reference') as $refSpec) { |
|
501 | 501 | $builderArgs[] = '--set-reference=' . $refSpec; |
502 | 502 | } |
503 | 503 | } |
504 | 504 | if ($input->getOption('child-process-php-ini-config')) { |
505 | - foreach($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
505 | + foreach ($input->getOption('child-process-php-ini-config') as $iniSpec) { |
|
506 | 506 | $builderArgs[] = '--child-process-php-ini-config=' . $iniSpec; |
507 | 507 | } |
508 | 508 | } |