Completed
Push — master ( 983a18...1ee05e )
by Gaetano
10:08
created
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/ContentTypeManager.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -652,6 +652,9 @@  discard block
 block discarded – undo
652 652
         return $fieldDefinitionUpdateStruct;
653 653
     }
654 654
 
655
+    /**
656
+     * @param string $contentTypeIdentifier
657
+     */
655 658
     protected function getFieldSettings($value, $fieldTypeIdentifier, $contentTypeIdentifier)
656 659
     {
657 660
         // 1st update any references in the value array
@@ -704,7 +707,7 @@  discard block
 block discarded – undo
704 707
      *
705 708
      * @param string|array $newValue if passed a string, we will use $lang as its language. If passed an array, it will be used as is - expected format [ "eng-GB": "Name", "fre-FR": "Nom", ... ]
706 709
      * @param string $lang ex: eng-GB. Not used when $newValue is an array
707
-     * @param array $currentValue current set of values in all known languages. Will be merged with $newValue, $newValue taking precedence
710
+     * @param string[] $currentValue current set of values in all known languages. Will be merged with $newValue, $newValue taking precedence
708 711
      * @return array in the format [ "eng-GB": "Name", "fre-FR": "Nom", ... ]
709 712
      */
710 713
     protected function getMultilingualValue($newValue, $lang, $currentValue = array())
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                 }
250 250
 
251 251
                 // Add new attributes
252
-                foreach($newFieldDefinitions as $newFieldDefinition) {
252
+                foreach ($newFieldDefinitions as $newFieldDefinition) {
253 253
                     if ($newFieldDefinition->position == 0) {
254 254
                         $newFieldDefinition->position = ++$maxFieldDefinitionPos;
255 255
                     }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                     break;
371 371
                 case 'content_type_groups_ids':
372 372
                     $value = [];
373
-                    foreach($contentType->contentTypeGroups as $existingGroup) {
373
+                    foreach ($contentType->contentTypeGroups as $existingGroup) {
374 374
                         $value[] = $existingGroup->id;
375 375
                     }
376 376
                     break;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
         $contentTypeGroup = $this->contentTypeGroupMatcher->matchOneByKey($contentTypeGroupId);
767 767
         $contentTypeGroupId = $contentTypeGroup->id;
768 768
 
769
-        foreach($contentType->contentTypeGroups as $existingGroup) {
769
+        foreach ($contentType->contentTypeGroups as $existingGroup) {
770 770
             if ($existingGroup->id === $contentTypeGroupId) {
771 771
                 return;
772 772
             }
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         $contentTypeGroup = $this->contentTypeGroupMatcher->matchOneByKey($contentTypeGroupId);
783 783
         $contentTypeGroupId = $contentTypeGroup->id;
784 784
 
785
-        foreach($contentType->contentTypeGroups as $existingGroup) {
785
+        foreach ($contentType->contentTypeGroups as $existingGroup) {
786 786
             if ($existingGroup->id === $contentTypeGroupId) {
787 787
                 $contentTypeService = $this->repository->getContentTypeService();
788 788
                 $contentTypeService->unassignContentTypeGroup($contentType, $contentTypeGroup);
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.
Core/Executor/ContentManager.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use eZ\Publish\API\Repository\Values\ContentType\ContentType;
6 6
 use eZ\Publish\API\Repository\Values\ContentType\FieldDefinition;
7
-use eZ\Publish\API\Repository\Values\Content\Location;
8 7
 use eZ\Publish\API\Repository\Values\Content\Content;
9 8
 use eZ\Publish\API\Repository\Values\Content\ContentCreateStruct;
10 9
 use eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
                     $locations = $locationService->loadLocations($content->contentInfo);
521 521
                     if (count($locations) > 1) {
522 522
                         $otherParentLocations = array();
523
-                        foreach($locations as $otherLocation) {
523
+                        foreach ($locations as $otherLocation) {
524 524
                             if ($otherLocation->id != $location->id) {
525 525
                                 $otherParentLocations[] = $otherLocation->parentLocationId;
526 526
                             }
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
             },
697 697
             array_filter(
698 698
                 $this->repository->getContentLanguageService()->loadLanguages(),
699
-                function ($language) {
699
+                function($language) {
700 700
                     return $language->enabled;
701 701
                 }
702 702
             )
Please login to merge, or discard this patch.
Core/Matcher/TrashMatcher.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
 
37 37
             $query = new Query();
38 38
             $query->limit = self::INT_MAX_16BIT;
39
-            if (isset($query->performCount)) $query->performCount = false;
39
+            if (isset($query->performCount)) {
40
+                $query->performCount = false;
41
+            }
40 42
             $query->filter = $this->getQueryCriterion($key, $values);
41 43
             $results = $this->repository->getTrashService()->findTrashItems($query);
42 44
 
Please login to merge, or discard this patch.
Core/Matcher/ContentMatcherDirectLoad.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@
 block discarded – undo
22 22
             $contents = array();
23 23
             switch ($key) {
24 24
                 case self::MATCH_CONTENT_ID:
25
-                    foreach($match as $contentId) {
25
+                    foreach ($match as $contentId) {
26 26
                         $content = $this->repository->getContentService()->loadContent($contentId);
27 27
                         $contents[$content->id] = $content;
28 28
                     }
29 29
                     break;
30 30
                 case self::MATCH_CONTENT_REMOTE_ID:
31
-                    foreach($match as $contentRemoteId) {
31
+                    foreach ($match as $contentRemoteId) {
32 32
                         $content = $this->repository->getContentService()->loadContentByRemoteId($contentRemoteId);
33 33
                         $contents[$content->id] = $content;
34 34
                     }
Please login to merge, or discard this patch.
Core/Matcher/LocationMatcherDirectLoad.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@
 block discarded – undo
24 24
             $locations = array();
25 25
             switch ($key) {
26 26
                 case self::MATCH_LOCATION_ID:
27
-                    foreach($match as $locationId) {
27
+                    foreach ($match as $locationId) {
28 28
                         $location = $this->repository->getLocationService()->loadLocation($locationId);
29 29
                         $locations[$location->id] = $location;
30 30
                     }
31 31
                     break;
32 32
                 case self::MATCH_LOCATION_REMOTE_ID:
33
-                    foreach($match as $locationRemoteId) {
33
+                    foreach ($match as $locationRemoteId) {
34 34
                         $location = $this->repository->getLocationService()->loadLocationByRemoteId($locationRemoteId);
35 35
                         $locations[$location->id] = $location;
36 36
                     }
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
      * @param array $sort
16 16
      * @param int $offset
17 17
      * @param int $limit
18
-
19 18
      * @return LocationCollection
20 19
      */
21 20
     public function matchLocation(array $conditions, array $sort = array(), $offset = 0, $limit = 0)
Please login to merge, or discard this patch.
Core/Loader/FilesystemRecursive.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         if (empty($paths)) {
58 58
             $paths = array();
59 59
             /** @var $bundle \Symfony\Component\HttpKernel\Bundle\BundleInterface */
60
-            foreach($this->kernel->getBundles() as $bundle)
60
+            foreach ($this->kernel->getBundles() as $bundle)
61 61
             {
62 62
                 $path = $bundle->getPath() . "/" . $this->versionDirectory;
63 63
                 if (is_dir($path)) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         }
68 68
 
69 69
         $definitions = array();
70
-        foreach($paths as $path) {
70
+        foreach ($paths as $path) {
71 71
             if (is_file($path)) {
72 72
                 $definitions[basename($path)] = $returnFilename ? $path : new MigrationDefinition(
73 73
                     basename($path),
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@
 block discarded – undo
60 60
                         }
61 61
                     }
62 62
                 }
63
-            }
64
-            else {
63
+            } else {
65 64
                 throw new \Exception("Path '$path' is neither a file nor directory");
66 65
             }
67 66
         }
Please login to merge, or discard this patch.
Command/MassMigrateCommand.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -331,7 +331,7 @@
 block discarded – undo
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
      *
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.