@@ -98,7 +98,7 @@ |
||
| 98 | 98 | $refs = array(); |
| 99 | 99 | |
| 100 | 100 | foreach ($this->resolvers as $resolver) { |
| 101 | - if (! $resolver instanceof EnumerableReferenceResolverInterface) { |
|
| 101 | + if (!$resolver instanceof EnumerableReferenceResolverInterface) { |
|
| 102 | 102 | throw new \Exception("Could not enumerate references because of chained resolver of type: " . get_class($resolver)); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | switch ($key) { |
| 83 | 83 | case self::MATCH_AND: |
| 84 | - foreach($values as $subCriterion) { |
|
| 84 | + foreach ($values as $subCriterion) { |
|
| 85 | 85 | $value = $this->match($subCriterion); |
| 86 | 86 | if (!reset($value)) { |
| 87 | 87 | return $value; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return array(true); |
| 91 | 91 | |
| 92 | 92 | case self::MATCH_OR: |
| 93 | - foreach($values as $subCriterion) { |
|
| 93 | + foreach ($values as $subCriterion) { |
|
| 94 | 94 | $value = $this->match($subCriterion); |
| 95 | 95 | if (reset($value)) { |
| 96 | 96 | return $value; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function storeCurrentContext($migrationName) |
| 36 | 36 | { |
| 37 | 37 | $context = array(); |
| 38 | - foreach($this->providers as $label => $provider) { |
|
| 38 | + foreach ($this->providers as $label => $provider) { |
|
| 39 | 39 | $context[$label] = $provider->getCurrentContext($migrationName); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | if (!is_array($context)) { |
| 53 | 53 | throw new \Exception("No execution context found associated with migration '$migrationName'"); |
| 54 | 54 | } |
| 55 | - foreach($this->providers as $label => $provider) { |
|
| 55 | + foreach ($this->providers as $label => $provider) { |
|
| 56 | 56 | if (isset($context[$label])) { |
| 57 | 57 | $provider->restoreContext($migrationName, $context[$label]); |
| 58 | 58 | } |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | |
| 96 | 96 | $output->writeln('<info>Migration: ' . $migration->name . '</info>'); |
| 97 | 97 | $output->writeln('Status: ' . $status); |
| 98 | - $output->writeln('Executed on: <info>' . ($migration->executionDate != null ? date("Y-m-d H:i:s", $migration->executionDate) : '--'). '</info>'); |
|
| 98 | + $output->writeln('Executed on: <info>' . ($migration->executionDate != null ? date("Y-m-d H:i:s", $migration->executionDate) : '--') . '</info>'); |
|
| 99 | 99 | $output->writeln('Execution notes: <info>' . $migration->executionError . '</info>'); |
| 100 | 100 | |
| 101 | 101 | if ($migration->status == Migration::STATUS_SUSPENDED) { |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | /** |
| 49 | 49 | * @param array $dsl |
| 50 | 50 | * @param array $context |
| 51 | - * @return true |
|
| 51 | + * @return boolean |
|
| 52 | 52 | * @throws \Exception |
| 53 | 53 | */ |
| 54 | 54 | protected function send($dsl, $context) |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $body = isset($dsl['body']) ? $this->resolveReferencesInText($dsl['body']) : null; |
| 68 | 68 | |
| 69 | 69 | if (isset($dsl['client'])) { |
| 70 | - $client = $this->container->get('httplug.client.'.$dsl['client']); |
|
| 70 | + $client = $this->container->get('httplug.client.' . $dsl['client']); |
|
| 71 | 71 | } else { |
| 72 | 72 | $client = $this->container->get('httplug.client'); |
| 73 | 73 | } |
@@ -447,6 +447,9 @@ |
||
| 447 | 447 | ); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | + /** |
|
| 451 | + * @param APIMigration $migration |
|
| 452 | + */ |
|
| 450 | 453 | protected function getEntityName($migration) |
| 451 | 454 | { |
| 452 | 455 | return end(explode('\\', get_class($migration))); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | public function endMigration(APIMigration $migration, $force = false) |
| 172 | 172 | { |
| 173 | 173 | if ($migration->status == APIMigration::STATUS_STARTED) { |
| 174 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be ended as its status is 'started'..."); |
|
| 174 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be ended as its status is 'started'..."); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $this->createTableIfNeeded(); |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | if (!is_array($existingMigrationData)) { |
| 199 | 199 | // commit to release the lock |
| 200 | 200 | $conn->commit(); |
| 201 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be ended as it is not found"); |
|
| 201 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be ended as it is not found"); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | if (($existingMigrationData['status'] != APIMigration::STATUS_STARTED) && !$force) { |
| 205 | 205 | // commit to release the lock |
| 206 | 206 | $conn->commit(); |
| 207 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be ended as it is not executing"); |
|
| 207 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be ended as it is not executing"); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | $conn->update( |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | if (!is_array($existingMigrationData)) { |
| 356 | 356 | // commit immediately, to release the lock and avoid deadlocks |
| 357 | 357 | $conn->commit(); |
| 358 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be resumed as it is not found"); |
|
| 358 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be resumed as it is not found"); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | // migration exists |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | if ($existingMigrationData['status'] != APIMigration::STATUS_SUSPENDED) { |
| 365 | 365 | // commit to release the lock |
| 366 | 366 | $conn->commit(); |
| 367 | - throw new \Exception($this->getEntityName($migration)." '{$migration->name}' can not be resumed as it is not suspended"); |
|
| 367 | + throw new \Exception($this->getEntityName($migration) . " '{$migration->name}' can not be resumed as it is not suspended"); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | $migration = new APIMigration( |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | use Kaliop\eZMigrationBundle\API\Collection\MigrationCollection; |
| 11 | 11 | use Kaliop\eZMigrationBundle\API\Value\Migration as APIMigration; |
| 12 | 12 | use Kaliop\eZMigrationBundle\API\Value\MigrationDefinition; |
| 13 | - |
|
| 14 | 13 | use Kaliop\eZMigrationBundle\API\ConfigResolverInterface; |
| 15 | 14 | |
| 16 | 15 | /** |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $builderArgs = array($this->referenceResolver->resolveReference($dsl['command'])); |
| 64 | 64 | |
| 65 | 65 | if (isset($dsl['arguments'])) { |
| 66 | - foreach($dsl['arguments'] as $arg) { |
|
| 66 | + foreach ($dsl['arguments'] as $arg) { |
|
| 67 | 67 | $builderArgs[] = $this->referenceResolver->resolveReference($arg); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $executed = 0; |
| 94 | 94 | $failed = 0; |
| 95 | 95 | |
| 96 | - foreach($suspendedMigrations as $suspendedMigration) { |
|
| 96 | + foreach ($suspendedMigrations as $suspendedMigration) { |
|
| 97 | 97 | $output->writeln("<info>Resuming {$suspendedMigration->name}</info>"); |
| 98 | 98 | |
| 99 | 99 | try { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $time = microtime(true) - $start; |
| 115 | 115 | $output->writeln("Resumed $executed migrations, failed $failed"); |
| 116 | - $output->writeln("Time taken: ".sprintf('%.2f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB'); |
|
| 116 | + $output->writeln("Time taken: " . sprintf('%.2f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB'); |
|
| 117 | 117 | |
| 118 | 118 | if ($failed) { |
| 119 | 119 | return 2; |