Passed
Push — master ( 77a6e6...0cc661 )
by Gaetano
08:48
created
Command/AbstractCommand.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,8 +78,7 @@
 block discarded – undo
78 78
                 $this->errOutput->setVerbosity(OutputInterface::VERBOSITY_NORMAL);
79 79
                 $this->errOutput->writeln($message, $type);
80 80
                 $this->errOutput->setVerbosity(OutputInterface::VERBOSITY_QUIET);
81
-            }
82
-            else
81
+            } else
83 82
             {
84 83
                 $this->errOutput->writeln($message, $type);
85 84
             }
Please login to merge, or discard this patch.
Command/MassMigrateCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         $processes = array();
134 134
         /** @var MigrationDefinition $migrationDefinition */
135
-        foreach($paths as $path => $count) {
135
+        foreach ($paths as $path => $count) {
136 136
             $this->writeln("<info>Queueing processing of: $path ($count migrations)</info>", OutputInterface::VERBOSITY_VERBOSE);
137 137
 
138 138
             $process = $builder
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
         }
180 180
 
181 181
         $missed = $total - $this->migrationsDone[Migration::STATUS_DONE] - $this->migrationsDone[Migration::STATUS_FAILED] - $this->migrationsDone[Migration::STATUS_SKIPPED];
182
-        $this->writeln("\nExecuted ".$this->migrationsDone[Migration::STATUS_DONE].' migrations'.
183
-            ', failed '.$this->migrationsDone[Migration::STATUS_FAILED].
184
-            ', skipped '.$this->migrationsDone[Migration::STATUS_SKIPPED].
182
+        $this->writeln("\nExecuted " . $this->migrationsDone[Migration::STATUS_DONE] . ' migrations' .
183
+            ', failed ' . $this->migrationsDone[Migration::STATUS_FAILED] .
184
+            ', skipped ' . $this->migrationsDone[Migration::STATUS_SKIPPED] .
185 185
             ($missed ? ", missed $missed" : ''));
186 186
 
187 187
         $time = microtime(true) - $start;
188 188
         // since we use subprocesses, we can not measure max memory used
189
-        $this->writeln("<info>Time taken: ".sprintf('%.2f', $time)." secs</info>");
189
+        $this->writeln("<info>Time taken: " . sprintf('%.2f', $time) . " secs</info>");
190 190
 
191 191
         return $subprocessesFailed + $this->migrationsDone[Migration::STATUS_FAILED] + $missed;
192 192
     }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         foreach ($toExecute as  $name => $migrationDefinition) {
229 229
             // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway
230 230
             if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
231
-                $this->writeln("<comment>Skipping migration (invalid definition?) Path: ".$migrationDefinition->path."</comment>", self::VERBOSITY_CHILD);
231
+                $this->writeln("<comment>Skipping migration (invalid definition?) Path: " . $migrationDefinition->path . "</comment>", self::VERBOSITY_CHILD);
232 232
                 $skipped++;
233 233
                 continue;
234 234
             }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                     $this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input);
269 269
 
270 270
                     $executed++;
271
-                } catch(\Exception $e) {
271
+                } catch (\Exception $e) {
272 272
                     $failed++;
273 273
 
274 274
                     $errorMessage = $e->getMessage();
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
      * @param string $buffer
302 302
      * @param null|\Symfony\Component\Process\Process $process
303 303
      */
304
-    public function onChildProcessOutput($type, $buffer, $process=null)
304
+    public function onChildProcessOutput($type, $buffer, $process = null)
305 305
     {
306 306
         $lines = explode("\n", trim($buffer));
307 307
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
             // we tag the output with the id of the child process
321 321
             if (trim($line) !== '') {
322
-                $msg = '[' . ($process ? $process->getPid() : ''). '] ' . trim($line);
322
+                $msg = '[' . ($process ? $process->getPid() : '') . '] ' . trim($line);
323 323
                 if ($type == 'err') {
324 324
                     $this->writeErrorln($msg, OutputInterface::VERBOSITY_QUIET, OutputInterface::OUTPUT_RAW);
325 325
                 } else {
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 
354 354
         // filter away all migrations except 'to do' ones
355 355
         $toExecute = array();
356
-        foreach($migrationDefinitions as $name => $migrationDefinition) {
356
+        foreach ($migrationDefinitions as $name => $migrationDefinition) {
357 357
             if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && in_array($migration->status, $allowedStatuses))) {
358 358
                 $toExecute[$name] = $isChild ? $migrationService->parseMigrationDefinition($migrationDefinition) : $migrationDefinition;
359 359
             }
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     {
396 396
         $output->writeln('Found ' . count($toExecute) . ' migrations in ' . count($paths) . ' directories');
397 397
         $output->writeln('In the same directories, migrations previously executed: ' . $this->migrationsAlreadyDone[Migration::STATUS_DONE] .
398
-            ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: '. $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]);
398
+            ', failed: ' . $this->migrationsAlreadyDone[Migration::STATUS_FAILED] . ', skipped: ' . $this->migrationsAlreadyDone[Migration::STATUS_SKIPPED]);
399 399
         if ($this->migrationsAlreadyDone[Migration::STATUS_STARTED]) {
400 400
             $output->writeln('<info>In the same directories, migrations currently executing: ' . $this->migrationsAlreadyDone[Migration::STATUS_STARTED] . '</info>');
401 401
         }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     protected function groupMigrationsByPath($toExecute)
409 409
     {
410 410
         $paths = array();
411
-        foreach($toExecute as $name => $migrationDefinition) {
411
+        foreach ($toExecute as $name => $migrationDefinition) {
412 412
             $path = dirname($migrationDefinition->path);
413 413
             if (!isset($paths[$path])) {
414 414
                 $paths[$path] = 1;
Please login to merge, or discard this patch.
Command/MigrateCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
         $time = microtime(true) - $start;
214 214
         if ($input->getOption('separate-process')) {
215 215
             // in case of using subprocesses, we can not measure max memory used
216
-            $this->writeln("<info>Time taken: ".sprintf('%.2f', $time)." secs</info>");
216
+            $this->writeln("<info>Time taken: " . sprintf('%.2f', $time) . " secs</info>");
217 217
         } else {
218
-            $this->writeln("<info>Time taken: ".sprintf('%.2f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB</info>');
218
+            $this->writeln("<info>Time taken: " . sprintf('%.2f', $time) . " secs, memory: " . sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)) . ' MB</info>');
219 219
         }
220 220
 
221 221
         return $failed;
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
             $builderArgs[] = '--no-debug';
443 443
         }
444 444
         if ($input->getOption('siteaccess')) {
445
-            $builderArgs[] = '--siteaccess='.$input->getOption('siteaccess');
445
+            $builderArgs[] = '--siteaccess=' . $input->getOption('siteaccess');
446 446
         }
447 447
         switch ($this->verbosity) {
448 448
             case OutputInterface::VERBOSITY_VERBOSE:
Please login to merge, or discard this patch.
Core/Executor/TagManager.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
         // sort tags by depth so that there will be no errors in case we are deleting parent and child
163 163
         $tagsCollection = $tagsCollection->getArrayCopy();
164
-        uasort($tagsCollection, function ($t1, $t2) {
164
+        uasort($tagsCollection, function($t1, $t2) {
165 165
             if ($t1->depth == $t2->depth) return 0;
166 166
             return ($t1->depth > $t2->depth) ? -1 : 1;
167 167
         });
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             case 'create':
267 267
                 // sort top to bottom
268 268
                 $tagCollection = $tagCollection->getArrayCopy();
269
-                uasort($tagCollection, function ($t1, $t2) {
269
+                uasort($tagCollection, function($t1, $t2) {
270 270
                     if ($t1->depth == $t2->depth) return 0;
271 271
                     return ($t1->depth > $t2->depth) ? 1 : -1;
272 272
                 });
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
             case 'delete':
275 275
                 // sort bottom to top
276 276
                 $tagCollection = $tagCollection->getArrayCopy();
277
-                uasort($tagCollection, function ($t1, $t2) {
277
+                uasort($tagCollection, function($t1, $t2) {
278 278
                     if ($t1->depth == $t2->depth) return 0;
279 279
                     return ($t1->depth > $t2->depth) ? -1 : 1;
280 280
                 });
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     protected function getTagKeywords($tag)
353 353
     {
354 354
         $out = array();
355
-        foreach($tag->languageCodes as $languageCode) {
355
+        foreach ($tag->languageCodes as $languageCode) {
356 356
             $out[$languageCode] = $tag->getKeyword($languageCode);
357 357
         }
358 358
         return $out;
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -162,7 +162,9 @@  discard block
 block discarded – undo
162 162
         // sort tags by depth so that there will be no errors in case we are deleting parent and child
163 163
         $tagsCollection = $tagsCollection->getArrayCopy();
164 164
         uasort($tagsCollection, function ($t1, $t2) {
165
-            if ($t1->depth == $t2->depth) return 0;
165
+            if ($t1->depth == $t2->depth) {
166
+                return 0;
167
+            }
166 168
             return ($t1->depth > $t2->depth) ? -1 : 1;
167 169
         });
168 170
 
@@ -267,7 +269,9 @@  discard block
 block discarded – undo
267 269
                 // sort top to bottom
268 270
                 $tagCollection = $tagCollection->getArrayCopy();
269 271
                 uasort($tagCollection, function ($t1, $t2) {
270
-                    if ($t1->depth == $t2->depth) return 0;
272
+                    if ($t1->depth == $t2->depth) {
273
+                        return 0;
274
+                    }
271 275
                     return ($t1->depth > $t2->depth) ? 1 : -1;
272 276
                 });
273 277
                 break;
@@ -275,7 +279,9 @@  discard block
 block discarded – undo
275 279
                 // sort bottom to top
276 280
                 $tagCollection = $tagCollection->getArrayCopy();
277 281
                 uasort($tagCollection, function ($t1, $t2) {
278
-                    if ($t1->depth == $t2->depth) return 0;
282
+                    if ($t1->depth == $t2->depth) {
283
+                        return 0;
284
+                    }
279 285
                     return ($t1->depth > $t2->depth) ? -1 : 1;
280 286
                 });
281 287
                 break;
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
@@ -56,7 +56,9 @@
 block discarded – undo
56 56
 
57 57
             $query = new Query();
58 58
             $query->limit = $this->queryLimit;
59
-            if (isset($query->performCount)) $query->performCount = false;
59
+            if (isset($query->performCount)) {
60
+                $query->performCount = false;
61
+            }
60 62
             $query->filter = $this->getQueryCriterion($key, $values);
61 63
             $results = $this->repository->getTrashService()->findTrashItems($query);
62 64
 
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
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         }
265 265
 
266 266
         if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
267
-            throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition). " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}");
267
+            throw new \Exception("Can not execute " . $this->getEntityName($migrationDefinition) . " '{$migrationDefinition->name}': {$migrationDefinition->parsingError}");
268 268
         }
269 269
 
270 270
         /// @todo add support for setting in $migrationContext a userContentType, userGroupContentType ?
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 
299 299
         try {
300 300
 
301
-            $i = $stepOffset+1;
301
+            $i = $stepOffset + 1;
302 302
             $finalStatus = Migration::STATUS_DONE;
303 303
             $finalMessage = null;
304 304
 
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
     public function resumeMigration(Migration $migration, $useTransaction = true)
434 434
     {
435 435
         if ($migration->status != Migration::STATUS_SUSPENDED) {
436
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': it is not in suspended status");
436
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': it is not in suspended status");
437 437
         }
438 438
 
439 439
         $migrationDefinitions = $this->getMigrationsDefinitions(array($migration->path));
440 440
         if (!count($migrationDefinitions)) {
441
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': its definition is missing");
441
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': its definition is missing");
442 442
         }
443 443
 
444 444
         $defs = $migrationDefinitions->getArrayCopy();
@@ -446,18 +446,18 @@  discard block
 block discarded – undo
446 446
 
447 447
         $migrationDefinition = $this->parseMigrationDefinition($migrationDefinition);
448 448
         if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
449
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': {$migrationDefinition->parsingError}");
449
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': {$migrationDefinition->parsingError}");
450 450
         }
451 451
 
452 452
         // restore context
453 453
         $this->contextHandler->restoreCurrentContext($migration->name);
454 454
 
455 455
         if (!isset($this->migrationContext[$migration->name])) {
456
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is missing");
456
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is missing");
457 457
         }
458 458
         $restoredContext = $this->migrationContext[$migration->name];
459
-        if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'] )) {
460
-            throw new \Exception("Can not resume ".$this->getEntityName($migration)." '{$migration->name}': the stored context is invalid");
459
+        if (!is_array($restoredContext) || !isset($restoredContext['context']) || !isset($restoredContext['step'])) {
460
+            throw new \Exception("Can not resume " . $this->getEntityName($migration) . " '{$migration->name}': the stored context is invalid");
461 461
         }
462 462
 
463 463
         // update migration status
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
      * @param bool|null $forceSigchildEnabled
479 479
      * @return array
480 480
      */
481
-    protected function migrationContextFromParameters($defaultLanguageCode = null, $adminLogin = null, $forceSigchildEnabled = null )
481
+    protected function migrationContextFromParameters($defaultLanguageCode = null, $adminLogin = null, $forceSigchildEnabled = null)
482 482
     {
483 483
         $properties = array();
484 484
 
Please login to merge, or discard this patch.
Core/Matcher/LocationMatcher.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,7 +87,9 @@  discard block
 block discarded – undo
87 87
             if (!empty($sort)) {
88 88
                 $query->sortClauses = $this->getSortClauses($sort);
89 89
             }
90
-            if (isset($query->performCount)) $query->performCount = false;
90
+            if (isset($query->performCount)) {
91
+                $query->performCount = false;
92
+            }
91 93
             $query->filter = $this->getQueryCriterion($key, $values);
92 94
             $results = $this->getSearchService()->findLocations($query);
93 95
 
@@ -234,7 +236,9 @@  discard block
 block discarded – undo
234 236
     {
235 237
         $query = new LocationQuery();
236 238
         $query->limit = self::INT_MAX_16BIT;
237
-        if (isset($query->performCount)) $query->performCount = false;
239
+        if (isset($query->performCount)) {
240
+            $query->performCount = false;
241
+        }
238 242
         $query->filter = new Query\Criterion\ParentLocationId($parentLocationIds);
239 243
 
240 244
         $results = $this->getSearchService()->findLocations($query);
Please login to merge, or discard this patch.
Core/Matcher/ContentMatcher.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -120,7 +120,9 @@  discard block
 block discarded – undo
120 120
                     $query = new Query();
121 121
                     $query->limit = $limit != 0 ? $limit : $this->queryLimit;
122 122
                     $query->offset = $offset;
123
-                    if (isset($query->performCount)) $query->performCount = false;
123
+                    if (isset($query->performCount)) {
124
+                        $query->performCount = false;
125
+                    }
124 126
                     $query->filter = $this->getQueryCriterion($key, $values);
125 127
                     if (!empty($sort)) {
126 128
                         $query->sortClauses = $this->getSortClauses($sort);
@@ -246,7 +248,9 @@  discard block
 block discarded – undo
246 248
     {
247 249
         $query = new Query();
248 250
         $query->limit = $this->queryLimit;
249
-        if (isset($query->performCount)) $query->performCount = false;
251
+        if (isset($query->performCount)) {
252
+            $query->performCount = false;
253
+        }
250 254
         $query->filter = new Query\Criterion\ParentLocationId($parentLocationIds);
251 255
         $results = $this->getSearchService()->findContent($query);
252 256
 
@@ -286,7 +290,9 @@  discard block
 block discarded – undo
286 290
     {
287 291
         $query = new Query();
288 292
         $query->limit = $this->queryLimit;
289
-        if (isset($query->performCount)) $query->performCount = false;
293
+        if (isset($query->performCount)) {
294
+            $query->performCount = false;
295
+        }
290 296
         $query->filter = new Query\Criterion\ContentTypeIdentifier($contentTypeIdentifiers);
291 297
         // sort objects by depth, lower to higher, so that deleting them has less chances of failure
292 298
         // NB: we only do this in eZP versions that allow depth sorting on content queries
@@ -314,7 +320,9 @@  discard block
 block discarded – undo
314 320
     {
315 321
         $query = new Query();
316 322
         $query->limit = $this->queryLimit;
317
-        if (isset($query->performCount)) $query->performCount = false;
323
+        if (isset($query->performCount)) {
324
+            $query->performCount = false;
325
+        }
318 326
         $query->filter = new Query\Criterion\ContentTypeId($contentTypeIds);
319 327
         // sort objects by depth, lower to higher, so that deleting them has less chances of failure
320 328
         // NB: we only do this in eZP versions that allow depth sorting on content queries
Please login to merge, or discard this patch.
Command/StatusCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@
 block discarded – undo
226 226
      */
227 227
     protected function sortMigrationIndex(array &$index, $sortBy)
228 228
     {
229
-        switch($sortBy) {
229
+        switch ($sortBy) {
230 230
             case 'execution':
231 231
                 uasort($index, function($m1, $m2) {
232 232
                     if (isset($m1['migration']) && $m1['migration']->executionDate !== null) {
Please login to merge, or discard this patch.