@@ -331,7 +331,7 @@ |
||
331 | 331 | |
332 | 332 | /** |
333 | 333 | * @param string $paths |
334 | - * @param $migrationService |
|
334 | + * @param \Kaliop\eZMigrationBundle\Core\MigrationService $migrationService |
|
335 | 335 | * @param bool $isChild when not in child mode, do not waste time parsing migrations |
336 | 336 | * @return MigrationDefinition[] parsed or unparsed, depending on |
337 | 337 | * |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | $concurrency = $input->getOption('concurrency'); |
92 | - $this->writeln("Executing migrations using ".count($paths)." processes with a concurrency of $concurrency"); |
|
92 | + $this->writeln("Executing migrations using " . count($paths) . " processes with a concurrency of $concurrency"); |
|
93 | 93 | |
94 | 94 | $kernel = $this->getContainer()->get('kernel'); |
95 | 95 | $builder = new ProcessBuilder(); |
@@ -110,23 +110,23 @@ discard block |
||
110 | 110 | $builderArgs[] = '--no-debug'; |
111 | 111 | } |
112 | 112 | if ($input->getOption('default-language')) { |
113 | - $builderArgs[]='--default-language='.$input->getOption('default-language'); |
|
113 | + $builderArgs[] = '--default-language=' . $input->getOption('default-language'); |
|
114 | 114 | } |
115 | 115 | if ($input->getOption('no-transactions')) { |
116 | - $builderArgs[]='--no-transactions'; |
|
116 | + $builderArgs[] = '--no-transactions'; |
|
117 | 117 | } |
118 | 118 | if ($input->getOption('siteaccess')) { |
119 | - $builderArgs[]='--siteaccess='.$input->getOption('siteaccess'); |
|
119 | + $builderArgs[] = '--siteaccess=' . $input->getOption('siteaccess'); |
|
120 | 120 | } |
121 | 121 | if ($input->getOption('ignore-failures')) { |
122 | - $builderArgs[]='--ignore-failures'; |
|
122 | + $builderArgs[] = '--ignore-failures'; |
|
123 | 123 | } |
124 | 124 | if ($input->getOption('separate-process')) { |
125 | - $builderArgs[]='--separate-process'; |
|
125 | + $builderArgs[] = '--separate-process'; |
|
126 | 126 | } |
127 | 127 | $processes = array(); |
128 | 128 | /** @var MigrationDefinition $migrationDefinition */ |
129 | - foreach($paths as $path => $count) { |
|
129 | + foreach ($paths as $path => $count) { |
|
130 | 130 | $this->writeln("<info>Queueing processing of: $path ($count migrations)</info>", OutputInterface::VERBOSITY_VERBOSE); |
131 | 131 | |
132 | 132 | $process = $builder |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | |
164 | 164 | $time = microtime(true) - $start; |
165 | 165 | |
166 | - $this->writeln('<info>'.$this->migrationsDone[0].' migrations executed, '.$this->migrationsDone[1].' failed, '.$this->migrationsDone[2].' skipped</info>'); |
|
166 | + $this->writeln('<info>' . $this->migrationsDone[0] . ' migrations executed, ' . $this->migrationsDone[1] . ' failed, ' . $this->migrationsDone[2] . ' skipped</info>'); |
|
167 | 167 | $this->writeln("<info>Import finished</info>\n"); |
168 | 168 | |
169 | 169 | // since we use subprocesses, we can not measure max memory used |
170 | - $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs"); |
|
170 | + $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs"); |
|
171 | 171 | |
172 | 172 | return $failed; |
173 | 173 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | foreach ($toExecute as $name => $migrationDefinition) { |
207 | 207 | // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway |
208 | 208 | if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) { |
209 | - $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::VERBOSITY_CHILD); |
|
209 | + $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::VERBOSITY_CHILD); |
|
210 | 210 | $skipped++; |
211 | 211 | continue; |
212 | 212 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | ); |
281 | 281 | |
282 | 282 | $executed++; |
283 | - } catch(\Exception $e) { |
|
283 | + } catch (\Exception $e) { |
|
284 | 284 | $failed++; |
285 | 285 | if ($input->getOption('ignore-failures')) { |
286 | 286 | $this->writeln("<error>Migration failed! Path: " . $migrationDefinition->path . ", Reason: " . $e->getMessage() . "</error>", self::VERBOSITY_CHILD); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | - public function onSubProcessOutput($type, $buffer, $process=null) |
|
309 | + public function onSubProcessOutput($type, $buffer, $process = null) |
|
310 | 310 | { |
311 | 311 | $lines = explode("\n", trim($buffer)); |
312 | 312 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | |
325 | 325 | // we tag the output from the different processes |
326 | 326 | if (trim($line) !== '') { |
327 | - echo '[' . ($process ? $process->getPid() : ''). '] ' . trim($line) . "\n"; |
|
327 | + echo '[' . ($process ? $process->getPid() : '') . '] ' . trim($line) . "\n"; |
|
328 | 328 | } |
329 | 329 | } |
330 | 330 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | // filter away all migrations except 'to do' ones |
348 | 348 | $toExecute = array(); |
349 | - foreach($migrationDefinitions as $name => $migrationDefinition) { |
|
349 | + foreach ($migrationDefinitions as $name => $migrationDefinition) { |
|
350 | 350 | if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && $migration->status == Migration::STATUS_TODO)) { |
351 | 351 | $toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition; |
352 | 352 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | { |
389 | 389 | $output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories'); |
390 | 390 | $output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] . |
391 | - ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
391 | + ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | protected function askForConfirmation(InputInterface $input, OutputInterface $output) |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | protected function groupMigrationsByPath($toExecute) |
420 | 420 | { |
421 | 421 | $paths = array(); |
422 | - foreach($toExecute as $name => $migrationDefinition) { |
|
422 | + foreach ($toExecute as $name => $migrationDefinition) { |
|
423 | 423 | $path = dirname($migrationDefinition->path); |
424 | 424 | if (!isset($paths[$path])) { |
425 | 425 | $paths[$path] = 1; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $currentProcesses = array_splice($processesQueue, 0, $maxParallel); |
29 | 29 | // start the initial stack of processes |
30 | 30 | foreach ($currentProcesses as $process) { |
31 | - $process->start(function ($type, $buffer) use ($callback, $process) { |
|
31 | + $process->start(function($type, $buffer) use ($callback, $process) { |
|
32 | 32 | if ($callback) { |
33 | 33 | $callback($type, $buffer, $process); |
34 | 34 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // directly add and start new process after the previous finished |
45 | 45 | if (count($processesQueue) > 0) { |
46 | 46 | $nextProcess = array_shift($processesQueue); |
47 | - $nextProcess->start(function ($type, $buffer) use ($callback, $nextProcess) { |
|
47 | + $nextProcess->start(function($type, $buffer) use ($callback, $nextProcess) { |
|
48 | 48 | if ($callback) { |
49 | 49 | $callback($type, $buffer, $nextProcess); |
50 | 50 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $builderArgs[] = '--no-transactions'; |
125 | 125 | } |
126 | 126 | if ($input->getOption('siteaccess')) { |
127 | - $builderArgs[]='--siteaccess='.$input->getOption('siteaccess'); |
|
127 | + $builderArgs[] = '--siteaccess=' . $input->getOption('siteaccess'); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | $this->writeln("Executed $executed migrations, failed $failed, skipped $skipped"); |
234 | 234 | if ($input->getOption('separate-process')) { |
235 | 235 | // in case of using subprocesses, we can not measure max memory used |
236 | - $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs"); |
|
236 | + $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs"); |
|
237 | 237 | } else { |
238 | - $this->writeln("Time taken: ".sprintf('%.2f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB'); |
|
238 | + $this->writeln("Time taken: " . sprintf('%.2f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB'); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 |
@@ -74,7 +74,7 @@ |
||
74 | 74 | } else { |
75 | 75 | $args = array(); |
76 | 76 | } |
77 | - foreach($args as &$val) { |
|
77 | + foreach ($args as &$val) { |
|
78 | 78 | $val = $this->resolveReferencesRecursively($val); |
79 | 79 | } |
80 | 80 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @param array $dsl |
70 | 70 | * @param array $context |
71 | - * @return string |
|
71 | + * @return boolean |
|
72 | 72 | * @throws \Exception |
73 | 73 | */ |
74 | 74 | protected function exists($dsl, $context) |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * @param array $dsl |
198 | 198 | * @param array $context |
199 | - * @return true |
|
199 | + * @return boolean |
|
200 | 200 | * @throws \Exception |
201 | 201 | */ |
202 | 202 | protected function copy($dsl, $context) |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | /** |
229 | 229 | * @param array $dsl |
230 | 230 | * @param array $context |
231 | - * @return true |
|
231 | + * @return boolean |
|
232 | 232 | * @throws \Exception |
233 | 233 | */ |
234 | 234 | protected function move($dsl, $context) |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | /** |
261 | 261 | * @param array $dsl |
262 | 262 | * @param array $context |
263 | - * @return true |
|
263 | + * @return boolean |
|
264 | 264 | * @throws \Exception |
265 | 265 | */ |
266 | 266 | protected function delete($dsl, $context) |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | public function hasEmbeddedReferences($string) |
19 | 19 | { |
20 | 20 | $regexp = $this->getEmbeddedRegexp(); |
21 | - return (bool) preg_match_all($regexp, $string, $matches); |
|
21 | + return (bool)preg_match_all($regexp, $string, $matches); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | // we need to alter the regexp we usr for std ref resolving, as it will be used to match parts of text, not the whole string |
54 | 54 | $regexp = substr($this->getRegexp(), 1, -1); |
55 | - return '/' . preg_quote($this->beginToken). preg_replace(array('/^\^/'), array(''), $regexp) . '[^' . $this->endToken . ']+' . preg_quote($this->endToken) . '/'; |
|
55 | + return '/' . preg_quote($this->beginToken) . preg_replace(array('/^\^/'), array(''), $regexp) . '[^' . $this->endToken . ']+' . preg_quote($this->endToken) . '/'; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function setReferenceResolver(ReferenceResolverInterface $referenceResolver) |
13 | 13 | { |
14 | - if (! $referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
14 | + if (!$referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
15 | 15 | throw new \Exception("Reference resolver injected into EzRichText field handler should implement EmbeddedReferenceResolverInterface"); |
16 | 16 | } |
17 | 17 | parent::setReferenceResolver($referenceResolver); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function setReferenceResolver(ReferenceResolverInterface $referenceResolver) |
13 | 13 | { |
14 | - if (! $referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
14 | + if (!$referenceResolver instanceof EmbeddedReferenceResolverInterface) { |
|
15 | 15 | throw new \Exception("Reference resolver injected into EzXmlText field handler should implement EmbeddedReferenceResolverInterface"); |
16 | 16 | } |
17 | 17 | parent::setReferenceResolver($referenceResolver); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function getReferenceValue($identifier) |
33 | 33 | { |
34 | - switch(substr($identifier, 5)) { |
|
34 | + switch (substr($identifier, 5)) { |
|
35 | 35 | case 'iteration': |
36 | 36 | return end($this->stack); |
37 | 37 | case 'depth': |