Completed
Pull Request — master (#133)
by Damian
07:53
created
Core/Executor/MigrationExecutor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
         $dsl['mode'] = 'load';
106 106
         // be kind to users and allow them not to specify this explicitly
107 107
         if (isset($dsl['references'])) {
108
-            foreach($dsl['references'] as &$refDef) {
108
+            foreach ($dsl['references'] as &$refDef) {
109 109
                 $refDef['overwrite'] = true;
110 110
             }
111 111
         }
112 112
         $step = new MigrationStep($dsl['type'], $dsl, $context);
113 113
 
114
-        switch($dsl['type']) {
114
+        switch ($dsl['type']) {
115 115
             case 'content':
116 116
                 return $this->contentManager->execute($step);
117 117
             case 'location':
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                     return $this->matchConditions($values);
140 140
 
141 141
                 default:
142
-                    throw new \Exception("Unknown until condition: '$key' when suspending a migration ".var_export($conditions, true));
142
+                    throw new \Exception("Unknown until condition: '$key' when suspending a migration " . var_export($conditions, true));
143 143
             }
144 144
         }
145 145
     }
Please login to merge, or discard this patch.
Command/ResumeCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Core/MigrationService.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         }
255 255
 
256 256
         if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
257
-            throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition). " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}");
257
+            throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition) . " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}");
258 258
         }
259 259
 
260 260
         /// @todo add support for setting in $migrationContext a userContentType ?
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
         try {
290 290
 
291
-            $i = $stepOffset+1;
291
+            $i = $stepOffset + 1;
292 292
             $finalStatus = Migration::STATUS_DONE;
293 293
             $finalMessage = null;
294 294
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                     if ($previousUserId && $e2->getMessage() == 'There is no active transaction.') {
376 376
                         // since the migration succeeded and it was committed, no use to mark it as failed...
377 377
                         $finalStatus = Migration::STATUS_DONE;
378
-                        $errorMessage = 'Error post '.$this->getEntityName($migration).' execution: ' . $this->getFullExceptionMessage($e2) .
378
+                        $errorMessage = 'Error post ' . $this->getEntityName($migration) . ' execution: ' . $this->getFullExceptionMessage($e2) .
379 379
                             ' in file ' . $e2->getFile() . ' line ' . $e2->getLine();
380 380
                     } else {
381 381
                         $errorMessage .= '. In addition, an exception was thrown while rolling back: ' .
@@ -413,12 +413,12 @@  discard block
 block discarded – undo
413 413
     public function resumeMigration(Migration $migration, $useTransaction = true)
414 414
     {
415 415
         if ($migration->status != Migration::STATUS_SUSPENDED) {
416
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status");
416
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': it is not in suspended status");
417 417
         }
418 418
 
419 419
         $migrationDefinitions = $this->getMigrationsDefinitions(array($migration->path));
420 420
         if (!count($migrationDefinitions)) {
421
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': its definition is missing");
421
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': its definition is missing");
422 422
         }
423 423
 
424 424
         $defs = $migrationDefinitions->getArrayCopy();
@@ -426,18 +426,18 @@  discard block
 block discarded – undo
426 426
 
427 427
         $migrationDefinition = $this->parseMigrationDefinition($migrationDefinition);
428 428
         if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
429
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': {$migrationDefinition->parsingError}");
429
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': {$migrationDefinition->parsingError}");
430 430
         }
431 431
 
432 432
         // restore context
433 433
         $this->contextHandler->restoreCurrentContext($migration->name);
434 434
 
435 435
         if (!isset($this->migrationContext[$migration->name])) {
436
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is missing");
436
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is missing");
437 437
         }
438 438
         $restoredContext = $this->migrationContext[$migration->name];
439
-        if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'] )) {
440
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is invalid");
439
+        if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'])) {
440
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is invalid");
441 441
         }
442 442
 
443 443
         // update migration status
Please login to merge, or discard this patch.
Core/Matcher/ContentMatcher.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 
47 47
         foreach ($conditions as $key => $values) {
48 48
 
49
-            switch($key) {
49
+            switch ($key) {
50 50
 
51 51
                 case self::MATCH_RELATES_TO:
52 52
                     $contentService = $this->repository->getContentService();
53 53
                     $contents = array();
54 54
                     // allow to specify the objects to relate to using different ways
55 55
                     $relatedContents = $this->match($values);
56
-                    foreach($relatedContents as $relatedContent) {
57
-                        foreach($contentService->loadReverseRelations($relatedContent->contentInfo) as $relatingContent) {
56
+                    foreach ($relatedContents as $relatedContent) {
57
+                        foreach ($contentService->loadReverseRelations($relatedContent->contentInfo) as $relatingContent) {
58 58
                             $contents[$relatingContent->contentInfo->id] = $relatingContent;
59 59
                         }
60 60
                     }
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
                     $contents = array();
66 66
                     // allow to specify the objects we relate to using different ways
67 67
                     $relatingContents = $this->match($values);
68
-                    foreach($relatingContents as $relatingContent) {
69
-                        foreach($contentService->loadRelations($relatingContent->contentInfo) as $relatedContent) {
68
+                    foreach ($relatingContents as $relatingContent) {
69
+                        foreach ($contentService->loadRelations($relatingContent->contentInfo) as $relatedContent) {
70 70
                             $contents[$relatedContent->contentInfo->id] = $relatedContent;
71 71
                         }
72 72
                     }
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
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     {
162 162
         // allow setting *some* refs even when we have 0 or N matches
163 163
         foreach ($referencesDefinition as $key => $reference) {
164
-            switch($reference['attribute']) {
164
+            switch ($reference['attribute']) {
165 165
 
166 166
                 case 'count':
167 167
                     $value = count($entity);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                     throw new \InvalidArgumentException($this->getSelfName() . ' does not support setting references for multiple ' . $this->getCollectionName($entity) . 's');
198 198
                 }
199 199
                 if (count($entity) == 0) {
200
-                    throw new \InvalidArgumentException($this->getSelfName() . ' does not support setting references for no ' . $this->getCollectionName($entity). 's');
200
+                    throw new \InvalidArgumentException($this->getSelfName() . ' does not support setting references for no ' . $this->getCollectionName($entity) . 's');
201 201
                 }
202 202
             }
203 203
 
Please login to merge, or discard this patch.
Core/FieldHandler/EzDateAndTime.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,26 +58,26 @@
 block discarded – undo
58 58
     {
59 59
         $format = array();
60 60
         if (0 != $dateInterval->y) {
61
-            $format[] = $dateInterval->y.' years';
61
+            $format[] = $dateInterval->y . ' years';
62 62
         }
63 63
         if (0 != $dateInterval->m) {
64
-            $format[] = $dateInterval->m.' months';
64
+            $format[] = $dateInterval->m . ' months';
65 65
         }
66 66
         if (0 != $dateInterval->d) {
67
-            $format[] = $dateInterval->d.' days';
67
+            $format[] = $dateInterval->d . ' days';
68 68
         }
69 69
         //if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) {
70 70
         //    $format .= 'T';
71 71
         //}
72 72
         if (0 != $dateInterval->h) {
73
-            $format[] = $dateInterval->h.' hours';
73
+            $format[] = $dateInterval->h . ' hours';
74 74
         }
75 75
         if (0 != $dateInterval->i) {
76
-            $format[] = $dateInterval->i.' minutes';
76
+            $format[] = $dateInterval->i . ' minutes';
77 77
         }
78 78
         if (0 != $dateInterval->s) {
79
-            $format[] = $dateInterval->s.' seconds';
79
+            $format[] = $dateInterval->s . ' seconds';
80 80
         }
81
-        return implode( ', ', $format);
81
+        return implode(', ', $format);
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
Core/Executor/ContentVersionManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@
 block discarded – undo
29 29
         $versions = (array)$step->dsl['versions'];
30 30
 
31 31
         foreach ($contentCollection as $content) {
32
-            foreach($versions as $versionId) {
32
+            foreach ($versions as $versionId) {
33 33
                 try {
34 34
                     if ($versionId < 0) {
35 35
                         $contentVersions = $contentService->loadVersions($content->contentInfo);
36 36
                         // different eZ kernels apparently sort versions in different order...
37 37
                         $sortedVersions = array();
38
-                        foreach($contentVersions as $versionInfo) {
38
+                        foreach ($contentVersions as $versionInfo) {
39 39
                             $sortedVersions[$versionInfo->versionNo] = $versionInfo;
40 40
                         }
41 41
                         ksort($sortedVersions);
42 42
                         $sortedVersions = array_slice($sortedVersions, 0, $versionId);
43
-                        foreach($sortedVersions as $versionInfo) {
43
+                        foreach ($sortedVersions as $versionInfo) {
44 44
                             $contentService->deleteVersion($versionInfo);
45 45
                         }
46 46
                     } else {
Please login to merge, or discard this patch.