Passed
Push — master ( 20caea...cf7f72 )
by Gaetano
03:43
created
Core/Executor/MigrationDefinitionExecutor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         foreach ($dsl['references'] as $key => $reference) {
170 170
             // BC
171
-            if (is_array($reference) && isset($reference['json_path']) && !isset($reference['attribute'] )) {
171
+            if (is_array($reference) && isset($reference['json_path']) && !isset($reference['attribute'])) {
172 172
                 $reference['attribute'] = $reference['json_path'];
173 173
             }
174 174
             $reference = $this->parseReferenceDefinition($key, $reference);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     {
198 198
         $migrationService = $this->migrationService;
199 199
         $executors = $migrationService->listExecutors();
200
-        foreach($executors as $key => $name) {
200
+        foreach ($executors as $key => $name) {
201 201
             $executor = $migrationService->getExecutor($name);
202 202
             if (!$executor instanceof MigrationGeneratorInterface) {
203 203
                 unset($executors[$key]);
Please login to merge, or discard this patch.
Core/Executor/RepositoryExecutor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
         $multivalued = ($this->expectedResultsType($step) == self::$RESULT_TYPE_MULTIPLE);
218 218
 
219
-        if ($item instanceof AbstractCollection  || is_array($item)) {
219
+        if ($item instanceof AbstractCollection || is_array($item)) {
220 220
             $items = $item;
221 221
         } else {
222 222
             $items = array($item);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         // allow setting *some* refs even when we have 0 or N matches
262 262
         foreach ($referencesDefinition as $key => $reference) {
263 263
             $reference = $this->parseReferenceDefinition($key, $reference);
264
-            switch($reference['attribute']) {
264
+            switch ($reference['attribute']) {
265 265
 
266 266
                 case 'count':
267 267
                     $value = count($entity);
Please login to merge, or discard this patch.
Core/MigrationService.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         }
284 284
 
285 285
         if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
286
-            throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition). " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}");
286
+            throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition) . " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}");
287 287
         }
288 288
 
289 289
         /// @todo add support for setting in $migrationContext a userContentType, userGroupContentType ?
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
         try {
319 319
 
320
-            $i = $stepOffset+1;
320
+            $i = $stepOffset + 1;
321 321
             $finalStatus = Migration::STATUS_DONE;
322 322
             $finalMessage = null;
323 323
 
@@ -454,12 +454,12 @@  discard block
 block discarded – undo
454 454
     public function resumeMigration(Migration $migration, $useTransaction = true, array $forcedReferences = array())
455 455
     {
456 456
         if ($migration->status != Migration::STATUS_SUSPENDED) {
457
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status");
457
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': it is not in suspended status");
458 458
         }
459 459
 
460 460
         $migrationDefinitions = $this->getMigrationsDefinitions(array($migration->path));
461 461
         if (!count($migrationDefinitions)) {
462
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': its definition is missing");
462
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': its definition is missing");
463 463
         }
464 464
 
465 465
         $defs = $migrationDefinitions->getArrayCopy();
@@ -467,24 +467,24 @@  discard block
 block discarded – undo
467 467
 
468 468
         $migrationDefinition = $this->parseMigrationDefinition($migrationDefinition);
469 469
         if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
470
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': {$migrationDefinition->parsingError}");
470
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': {$migrationDefinition->parsingError}");
471 471
         }
472 472
 
473 473
         // restore context
474 474
         $this->contextHandler->restoreCurrentContext($migration->name);
475 475
 
476 476
         if ($forcedReferences) {
477
-            foreach($forcedReferences as $name => $value) {
477
+            foreach ($forcedReferences as $name => $value) {
478 478
                 $this->referenceResolver->addReference($name, $value, true);
479 479
             }
480 480
         }
481 481
 
482 482
         if (!isset($this->migrationContext[$migration->name])) {
483
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is missing");
483
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is missing");
484 484
         }
485 485
         $restoredContext = $this->migrationContext[$migration->name];
486
-        if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'] )) {
487
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is invalid");
486
+        if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'])) {
487
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is invalid");
488 488
         }
489 489
 
490 490
         // update migration status
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
      * @param bool|null $forceSigchildEnabled
506 506
      * @return array
507 507
      */
508
-    protected function migrationContextFromParameters($defaultLanguageCode = null, $adminLogin = null, $forceSigchildEnabled = null )
508
+    protected function migrationContextFromParameters($defaultLanguageCode = null, $adminLogin = null, $forceSigchildEnabled = null)
509 509
     {
510 510
         $properties = array();
511 511
 
Please login to merge, or discard this patch.
Command/ResumeCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $forcedRefs = array();
98 98
         if ($input->getOption('set-reference') /*&& !$input->getOption('separate-process')*/) {
99 99
             $refResolver = $this->getContainer()->get('ez_migration_bundle.reference_resolver.customreference');
100
-            foreach($input->getOption('set-reference') as $refSpec) {
100
+            foreach ($input->getOption('set-reference') as $refSpec) {
101 101
                 $ref = explode(':', $refSpec, 2);
102 102
                 if (count($ref) < 2 || $ref[0] === '') {
103 103
                     throw new \Exception("Invalid reference specification: '$refSpec'");
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $executed = 0;
110 110
         $failed = 0;
111 111
 
112
-        foreach($suspendedMigrations as $suspendedMigration) {
112
+        foreach ($suspendedMigrations as $suspendedMigration) {
113 113
             $output->writeln("<info>Resuming {$suspendedMigration->name}</info>");
114 114
 
115 115
             try {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
         $time = microtime(true) - $start;
131 131
         $output->writeln("Resumed $executed migrations, failed $failed");
132
-        $output->writeln("Time taken: ".sprintf('%.3f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB');
132
+        $output->writeln("Time taken: " . sprintf('%.3f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB');
133 133
 
134 134
         if ($failed) {
135 135
             return 2;
Please login to merge, or discard this patch.
Core/Executor/ReferenceExecutor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             throw new \Exception("Invalid step definition: file '$fileName' for saving references already exists");
161 161
         }
162 162
 
163
-        if (! $this->referenceResolver instanceof EnumerableReferenceResolverInterface) {
163
+        if (!$this->referenceResolver instanceof EnumerableReferenceResolverInterface) {
164 164
             throw new \Exception("Can not save references as resolver is not enumerable");
165 165
         }
166 166
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         $value = $this->dumpVar($this->referenceResolver->resolveReference($dsl['identifier']));
206 206
 
207 207
         if (isset($context['output']) && $context['output'] instanceof OutputInterface) {
208
-            $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW|OutputInterface::VERBOSITY_NORMAL);
208
+            $context['output']->write($label . $value, false, OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_NORMAL);
209 209
         } else {
210 210
             echo $label . $value;
211 211
         }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         $dumper->dump(
229 229
             $cloner->cloneVar($var),
230
-            function ($line, $depth) use (&$output) {
230
+            function($line, $depth) use (&$output) {
231 231
                 // A negative depth means "end of dump"
232 232
                 if ($depth >= 0) {
233 233
                     // Adds a two spaces indentation to the line
Please login to merge, or discard this patch.
Core/FieldHandler/FileFieldHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     protected $ioDecorator;
11 11
     protected $ioService;
12 12
 
13
-    public function __construct($ioRootDir, UrlDecorator $ioDecorator=null, $ioService=null)
13
+    public function __construct($ioRootDir, UrlDecorator $ioDecorator = null, $ioService = null)
14 14
     {
15 15
         $this->ioRootDir = $ioRootDir;
16 16
         $this->ioDecorator = $ioDecorator;
Please login to merge, or discard this patch.
Command/AbstractCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,13 +94,13 @@
 block discarded – undo
94 94
     protected function normalizePaths($paths)
95 95
     {
96 96
         $rootDir = realpath($this->getContainer()->get('kernel')->getRootDir() . '/..') . '/';
97
-        foreach($paths as $i => $path) {
97
+        foreach ($paths as $i => $path) {
98 98
             if ($path === $rootDir || $path === './') {
99 99
                 $paths[$i] = './';
100 100
             } else if (strpos($path, './') === 0) {
101 101
                 $paths[$i] = substr($path, 2);
102 102
             // q: should we also call realpath on $path? what if there are symlinks at play?
103
-            } elseif (strpos($path, $rootDir) === 0 ) {
103
+            } elseif (strpos($path, $rootDir) === 0) {
104 104
                 $paths[$i] = substr($path, strlen($rootDir));
105 105
             } elseif ($path === '') {
106 106
                 unset($paths[$i]);
Please login to merge, or discard this patch.
Command/StatusCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         // which is misleading. We add the following loop to fix that, so that the status command will match more closely
94 94
         // the 'migrate' command
95 95
         if (count($paths)) {
96
-            foreach($index as $migrationName => $data) {
96
+            foreach ($index as $migrationName => $data) {
97 97
                 if (!isset($data['migration'])) {
98 98
                     $migration = $migrationsService->getMigration($migrationName);
99 99
                     if ($migration !== null) {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
         if ($input->getOption('todo')) {
233 233
             foreach ($data as $migrationData) {
234
-                $output->writeln("$migrationData", OutputInterface::OUTPUT_RAW|OutputInterface::VERBOSITY_QUIET);
234
+                $output->writeln("$migrationData", OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_QUIET);
235 235
             }
236 236
             return 0;
237 237
         }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     protected function sortMigrationIndex(array &$index, $sortBy)
262 262
     {
263
-        switch($sortBy) {
263
+        switch ($sortBy) {
264 264
             case 'execution':
265 265
                 uasort($index, function($m1, $m2) {
266 266
                     if (isset($m1['migration']) && $m1['migration']->executionDate !== null) {
Please login to merge, or discard this patch.
Command/MigrateCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 $prefix = array($php);
120 120
 
121 121
                 if ($input->getOption('child-process-php-ini-config')) {
122
-                    foreach($input->getOption('child-process-php-ini-config') as $iniSpec) {
122
+                    foreach ($input->getOption('child-process-php-ini-config') as $iniSpec) {
123 123
                         $ini = explode(':', $iniSpec, 2);
124 124
                         if (count($ini) < 2 || $ini[0] === '') {
125 125
                             throw new \Exception("Invalid php ini specification: '$iniSpec'");
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
         if ($input->getOption('set-reference') && !$input->getOption('separate-process')) {
147 147
             $refResolver = $this->getContainer()->get('ez_migration_bundle.reference_resolver.customreference');
148
-            foreach($input->getOption('set-reference') as $refSpec) {
148
+            foreach ($input->getOption('set-reference') as $refSpec) {
149 149
                 $ref = explode(':', $refSpec, 2);
150 150
                 if (count($ref) < 2 || $ref[0] === '') {
151 151
                     throw new \Exception("Invalid reference specification: '$refSpec'");
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
         $time = microtime(true) - $start;
247 247
         if ($input->getOption('separate-process')) {
248 248
             // in case of using subprocesses, we can not measure max memory used
249
-            $this->writeln("<info>Time taken: ".sprintf('%.3f', $time)." secs</info>");
249
+            $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs</info>");
250 250
         } else {
251
-            $this->writeln("<info>Time taken: ".sprintf('%.3f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB</info>');
251
+            $this->writeln("<info>Time taken: " . sprintf('%.3f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB</info>');
252 252
         }
253 253
 
254 254
         return $failed;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
             $builderArgs[] = '--no-debug';
481 481
         }
482 482
         if ($input->getOption('siteaccess')) {
483
-            $builderArgs[] = '--siteaccess='.$input->getOption('siteaccess');
483
+            $builderArgs[] = '--siteaccess=' . $input->getOption('siteaccess');
484 484
         }
485 485
         switch ($this->verbosity) {
486 486
             case OutputInterface::VERBOSITY_VERBOSE:
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
             $builderArgs[] = '--no-transactions';
513 513
         }
514 514
         if ($input->getOption('set-reference')) {
515
-            foreach($input->getOption('set-reference') as $refSpec) {
515
+            foreach ($input->getOption('set-reference') as $refSpec) {
516 516
                 $builderArgs[] = '--set-reference=' . $refSpec;
517 517
             }
518 518
         }
Please login to merge, or discard this patch.