Test Setup Failed
Push — master ( fe5747...32c7c7 )
by Josh
03:18
created
src/Blender.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param UserInteractionHandler $userInteractionHandler
82 82
      * @param array $config
83 83
      */
84
-    public function __construct(modX $modx, UserInteractionHandler $userInteractionHandler, $config=[])
84
+    public function __construct(modX $modx, UserInteractionHandler $userInteractionHandler, $config = [])
85 85
     {
86 86
         $this->modx = $modx;
87 87
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
         $this->userInteractionHandler = $userInteractionHandler;
91 91
 
92
-        if (version_compare($this->modx_version_info['full_version'], '3.0') >= 0 ) {
92
+        if (version_compare($this->modx_version_info['full_version'], '3.0') >= 0) {
93 93
             $this->xpdo_version = 3;
94 94
             $this->blend_class_object = 'LCI\\Blend\\Model\\xPDO\\BlendMigrations';
95 95
             $this->blend_package = 'LCI\\Blend\\Model\\xPDO';
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
         }
105 105
 
106 106
         $this->config = [
107
-            'migration_templates_path' => __DIR__. '/Migrations/templates/',
107
+            'migration_templates_path' => __DIR__.'/Migrations/templates/',
108 108
             'migrations_path' => $blend_modx_migration_dir.'database/migrations/',
109 109
             'seeds_path' => $blend_modx_migration_dir.'database/seeds/',
110
-            'model_dir' => __DIR__ . ($this->xpdo_version >= 3 ? '/' : '/xpdo2/'),
110
+            'model_dir' => __DIR__.($this->xpdo_version >= 3 ? '/' : '/xpdo2/'),
111 111
             'extras' => [
112 112
                 'tagger' => false
113 113
             ]
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
         $this->seeds_dir = date('Y_m_d_His');
118 118
 
119
-        $tagger_path = $this->modx->getOption('tagger.core_path', null, $this->modx->getOption('core_path') . 'components/tagger/') . 'model/tagger/';
119
+        $tagger_path = $this->modx->getOption('tagger.core_path', null, $this->modx->getOption('core_path').'components/tagger/').'model/tagger/';
120 120
         if (is_dir($tagger_path)) {
121 121
             $this->config['extras']['tagger'] = true;
122 122
             /** @var \Tagger $tagger */
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
      * @param null $directory_key
179 179
      * @return string
180 180
      */
181
-    public function getSeedsPath($directory_key=null)
181
+    public function getSeedsPath($directory_key = null)
182 182
     {
183 183
         $seed_path = $this->config['seeds_path'];
184 184
         if (!empty($directory_key)) {
185
-            $seed_path .= trim($directory_key, '/') . DIRECTORY_SEPARATOR;
185
+            $seed_path .= trim($directory_key, '/').DIRECTORY_SEPARATOR;
186 186
         }
187 187
         return $seed_path;
188 188
     }
@@ -204,21 +204,21 @@  discard block
 block discarded – undo
204 204
      *
205 205
      * @return array ~ array of \BlendMigrations
206 206
      */
207
-    public function getBlendMigrationCollection($reload=false, $dir='ASC', $count=0, $id=0, $name=null)
207
+    public function getBlendMigrationCollection($reload = false, $dir = 'ASC', $count = 0, $id = 0, $name = null)
208 208
     {
209 209
         if (!$this->blendMigrations || $reload) {
210 210
             $blendMigrations = [];
211 211
 
212 212
             /** @var \xPDOQuery $query */
213 213
             $query = $this->modx->newQuery($this->blend_class_object);
214
-            if ($id > 0 ) {
214
+            if ($id > 0) {
215 215
                 $query->where(['id' => $id]);
216 216
             } elseif (!empty($name)) {
217 217
                 $query->where(['name' => $name]);
218 218
             }
219 219
             // @TODO need a ran sequence column to better order of down
220 220
             $query->sortBy('name', $dir);
221
-            if ($count > 0 ) {
221
+            if ($count > 0) {
222 222
                 $query->limit($count);
223 223
             }
224 224
             $query->prepare();
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         return $this->tagger;
243 243
     }
244 244
 
245
-    public function getCategoryMap($refresh=false)
245
+    public function getCategoryMap($refresh = false)
246 246
     {
247 247
         if (count($this->category_map) == 0 || $refresh) {
248 248
             $this->category_map = [
@@ -287,14 +287,14 @@  discard block
 block discarded – undo
287 287
     public function getBlendableChunk($name)
288 288
     {
289 289
         /** @var \LCI\Blend\Blendable\Chunk $chunk */
290
-        $chunk =  new Chunk($this->modx, $this, $name);
290
+        $chunk = new Chunk($this->modx, $this, $name);
291 291
         return $chunk->setSeedsDir($this->getSeedsDir());
292 292
     }
293 293
     /**
294 294
      * @param array $chunks
295 295
      * @param string $seeds_dir
296 296
      */
297
-    public function blendManyChunks($chunks=[], $seeds_dir='')
297
+    public function blendManyChunks($chunks = [], $seeds_dir = '')
298 298
     {
299 299
         // will update if element does exist or create new
300 300
         foreach ($chunks as $seed_key) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
             if ($blendChunk->blendFromSeed($seed_key)) {
307 307
                 $this->out($seed_key.' has been blended into ID: ');
308 308
 
309
-            } elseif($blendChunk->isExists()) {
309
+            } elseif ($blendChunk->isExists()) {
310 310
                 // @TODO prompt Do you want to blend Y/N/Compare
311 311
                 $this->out($seed_key.' chunk already exists', true);
312 312
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      * @param array $chunks
325 325
      * @param string $seeds_dir
326 326
      */
327
-    public function revertBlendManyChunks($chunks=[], $seeds_dir='')
327
+    public function revertBlendManyChunks($chunks = [], $seeds_dir = '')
328 328
     {
329 329
         // will update if system setting does exist or create new
330 330
         foreach ($chunks as $seed_key) {
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
                 $blendChunk->setSeedsDir($seeds_dir);
335 335
             }
336 336
 
337
-            if ( $blendChunk->revertBlend() ) {
337
+            if ($blendChunk->revertBlend()) {
338 338
                 $this->out($blendChunk->getFieldName().' chunk has been reverted to '.$seeds_dir);
339 339
 
340 340
             } else {
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
     public function getBlendableContext($key)
352 352
     {
353 353
         /** @var \LCI\Blend\Blendable\Context $chunk */
354
-        $context =  new Context($this->modx, $this, $key);
354
+        $context = new Context($this->modx, $this, $key);
355 355
         return $context->setSeedsDir($this->getSeedsDir());
356 356
     }
357 357
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
      * @param array $contexts
360 360
      * @param string $seeds_dir
361 361
      */
362
-    public function blendManyContexts($contexts=[], $seeds_dir='')
362
+    public function blendManyContexts($contexts = [], $seeds_dir = '')
363 363
     {
364 364
         // will update if element does exist or create new
365 365
         foreach ($contexts as $seed_key) {
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             if ($blendContext->blendFromSeed($seed_key)) {
372 372
                 $this->out($seed_key.' has been blended ');
373 373
 
374
-            } elseif($blendContext->isExists()) {
374
+            } elseif ($blendContext->isExists()) {
375 375
                 // @TODO prompt Do you want to blend Y/N/Compare
376 376
                 $this->out($seed_key.' chunk already exists', true);
377 377
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
      * @param array $contexts
390 390
      * @param string $seeds_dir
391 391
      */
392
-    public function revertBlendManyContexts($contexts=[], $seeds_dir='')
392
+    public function revertBlendManyContexts($contexts = [], $seeds_dir = '')
393 393
     {
394 394
         // will update if system setting does exist or create new
395 395
         foreach ($contexts as $seed_key) {
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
                 $blendContext->setSeedsDir($seeds_dir);
400 400
             }
401 401
 
402
-            if ( $blendContext->revertBlend() ) {
402
+            if ($blendContext->revertBlend()) {
403 403
                 $this->out($blendContext->getFieldKey().' context has been reverted to '.$seeds_dir);
404 404
 
405 405
             } else {
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
     public function getBlendableMediaSource($name)
417 417
     {
418 418
         /** @var \LCI\Blend\Blendable\MediaSource $mediaSource */
419
-        $mediaSource =  new MediaSource($this->modx, $this, $name);
419
+        $mediaSource = new MediaSource($this->modx, $this, $name);
420 420
         return $mediaSource
421 421
             ->setFieldName($name)
422 422
             ->setSeedsDir($this->getSeedsDir());
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
      * @param array $media_sources
427 427
      * @param string $seeds_dir
428 428
      */
429
-    public function blendManyMediaSources($media_sources=[], $seeds_dir='')
429
+    public function blendManyMediaSources($media_sources = [], $seeds_dir = '')
430 430
     {
431 431
         // will update if element does exist or create new
432 432
         foreach ($media_sources as $seed_key) {
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
             if ($blendMediaSource->blendFromSeed($seed_key)) {
439 439
                 $this->out($seed_key.' has been blended into ID: ');
440 440
 
441
-            } elseif($blendMediaSource->isExists()) {
441
+            } elseif ($blendMediaSource->isExists()) {
442 442
                 // @TODO add Compare as option
443 443
                 $this->out($seed_key.' media source already exists', true);
444 444
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      * @param array $media_sources
457 457
      * @param string $seeds_dir
458 458
      */
459
-    public function revertBlendManyMediaSources($media_sources=[], $seeds_dir='')
459
+    public function revertBlendManyMediaSources($media_sources = [], $seeds_dir = '')
460 460
     {
461 461
         // will update if system setting does exist or create new
462 462
         foreach ($media_sources as $seed_key) {
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
                 $blendMediaSource->setSeedsDir($seeds_dir);
467 467
             }
468 468
 
469
-            if ( $blendMediaSource->revertBlend() ) {
469
+            if ($blendMediaSource->revertBlend()) {
470 470
                 $this->out($blendMediaSource->getFieldName().' media source has been reverted to '.$seeds_dir);
471 471
 
472 472
             } else {
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
     public function getBlendablePlugin($name)
484 484
     {
485 485
         /** @var \LCI\Blend\Blendable\Plugin $plugin */
486
-        $plugin =  new Plugin($this->modx, $this, $name);
486
+        $plugin = new Plugin($this->modx, $this, $name);
487 487
         return $plugin->setSeedsDir($this->getSeedsDir());
488 488
     }
489 489
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
      * @param array $plugins
492 492
      * @param string $seeds_dir
493 493
      */
494
-    public function blendManyPlugins($plugins=[], $seeds_dir='')
494
+    public function blendManyPlugins($plugins = [], $seeds_dir = '')
495 495
     {
496 496
         // will update if element does exist or create new
497 497
         foreach ($plugins as $seed_key) {
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
             if ($blendPlugin->blendFromSeed($seed_key)) {
504 504
                 $this->out($seed_key.' has been blended into ID: ');
505 505
 
506
-            } elseif($blendPlugin->isExists()) {
506
+            } elseif ($blendPlugin->isExists()) {
507 507
                 // @TODO prompt Do you want to blend Y/N/Compare
508 508
                 $this->out($seed_key.' plugin already exists', true);
509 509
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
      * @param array $plugins
522 522
      * @param string $seeds_dir
523 523
      */
524
-    public function revertBlendManyPlugins($plugins=[], $seeds_dir='')
524
+    public function revertBlendManyPlugins($plugins = [], $seeds_dir = '')
525 525
     {
526 526
         // will update if system setting does exist or create new
527 527
         foreach ($plugins as $seed_key) {
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
                 $blendPlugin->setSeedsDir($seeds_dir);
532 532
             }
533 533
 
534
-            if ( $blendPlugin->revertBlend() ) {
534
+            if ($blendPlugin->revertBlend()) {
535 535
                 $this->out($blendPlugin->getFieldName().' plugin has been reverted to '.$seeds_dir);
536 536
 
537 537
             } else {
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     public function getBlendableSnippet($name)
549 549
     {
550 550
         /** @var Snippet $snippet */
551
-        $snippet =  new Snippet($this->modx, $this, $name);
551
+        $snippet = new Snippet($this->modx, $this, $name);
552 552
         return $snippet->setSeedsDir($this->getSeedsDir());
553 553
     }
554 554
 
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      * @param array $snippets
557 557
      * @param string $seeds_dir
558 558
      */
559
-    public function blendManySnippets($snippets=[], $seeds_dir='')
559
+    public function blendManySnippets($snippets = [], $seeds_dir = '')
560 560
     {
561 561
         // will update if element does exist or create new
562 562
         foreach ($snippets as $seed_key) {
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
             if ($blendSnippet->blendFromSeed($seed_key)) {
569 569
                 $this->out($seed_key.' has been blended');
570 570
 
571
-            } elseif($blendSnippet->isExists()) {
571
+            } elseif ($blendSnippet->isExists()) {
572 572
                 // @TODO prompt Do you want to blend Y/N/Compare
573 573
                 $this->out($seed_key.' snippet already exists', true);
574 574
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
      * @param array $snippets
586 586
      * @param string $seeds_dir
587 587
      */
588
-    public function revertBlendManySnippets($snippets=[], $seeds_dir='')
588
+    public function revertBlendManySnippets($snippets = [], $seeds_dir = '')
589 589
     {
590 590
         // will update if system setting does exist or create new
591 591
         foreach ($snippets as $seed_key) {
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
                 $blendSnippet->setSeedsDir($seeds_dir);
596 596
             }
597 597
 
598
-            if ( $blendSnippet->revertBlend() ) {
598
+            if ($blendSnippet->revertBlend()) {
599 599
                 $this->out($blendSnippet->getFieldName().' snippet has been reverted to '.$seeds_dir);
600 600
 
601 601
             } else {
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
     public function getBlendableTemplate($name)
613 613
     {
614 614
         /** @var \LCI\Blend\Blendable\Template $template */
615
-        $template =  new Template($this->modx, $this, $name);
615
+        $template = new Template($this->modx, $this, $name);
616 616
         return $template->setSeedsDir($this->seeds_dir);
617 617
     }
618 618
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
      * @param string $seeds_dir
622 622
      * @param bool $overwrite
623 623
      */
624
-    public function blendManyTemplates($templates=[], $seeds_dir='', $overwrite=false)
624
+    public function blendManyTemplates($templates = [], $seeds_dir = '', $overwrite = false)
625 625
     {
626 626
         // will update if template does exist or create new
627 627
         foreach ($templates as $seed_key) {
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
             if ($blendTemplate->blendFromSeed($seed_key, $overwrite)) {
635 635
                 $this->out($seed_key.' has been blended');
636 636
 
637
-            } elseif($blendTemplate->isExists()) {
637
+            } elseif ($blendTemplate->isExists()) {
638 638
                 $this->out($seed_key.' template already exists', true);
639 639
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
640 640
                     if ($blendTemplate->blendFromSeed($seed_key, true)) {
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
      * @param array $templates
652 652
      * @param string $seeds_dir
653 653
      */
654
-    public function revertBlendManyTemplates($templates=[], $seeds_dir='')
654
+    public function revertBlendManyTemplates($templates = [], $seeds_dir = '')
655 655
     {
656 656
         // will update if system setting does exist or create new
657 657
         foreach ($templates as $seed_key) {
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
                 $blendTemplate->setSeedsDir($seeds_dir);
662 662
             }
663 663
 
664
-            if ( $blendTemplate->revertBlend() ) {
664
+            if ($blendTemplate->revertBlend()) {
665 665
                 $this->out($blendTemplate->getFieldName().' template has been reverted to '.$seeds_dir);
666 666
 
667 667
             } else {
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
     public function getBlendableTemplateVariable($name)
679 679
     {
680 680
         /** @var \LCI\Blend\Blendable\TemplateVariable $tv */
681
-        $tv =  new TemplateVariable($this->modx, $this, $name);
681
+        $tv = new TemplateVariable($this->modx, $this, $name);
682 682
         return $tv->setSeedsDir($this->seeds_dir);
683 683
     }
684 684
 
@@ -687,10 +687,10 @@  discard block
 block discarded – undo
687 687
      * @param  string $context
688 688
      * @return \LCI\Blend\Blendable\Resource
689 689
      */
690
-    public function getBlendableResource($alias, $context='web')
690
+    public function getBlendableResource($alias, $context = 'web')
691 691
     {
692 692
         /** @var \LCI\Blend\Blendable\Resource $resource */
693
-        $resource =  new Resource($this->modx, $this, $alias, $context);
693
+        $resource = new Resource($this->modx, $this, $alias, $context);
694 694
         return $resource
695 695
             ->setSeedsDir($this->getSeedsDir());
696 696
     }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
      *
702 702
      * @return bool
703 703
      */
704
-    public function blendManyResources($resources=[], $seeds_dir='', $overwrite=false)
704
+    public function blendManyResources($resources = [], $seeds_dir = '', $overwrite = false)
705 705
     {
706 706
         $saved = true;
707 707
         // will update if resource does exist or create new
@@ -715,19 +715,19 @@  discard block
 block discarded – undo
715 715
                 }
716 716
 
717 717
                 if ($blendResource->blendFromSeed($seed_key, $overwrite)) {
718
-                    $this->out($seed_key . ' has been blended into ID: ');
718
+                    $this->out($seed_key.' has been blended into ID: ');
719 719
 
720 720
                 } elseif ($blendResource->isExists()) {
721 721
                     // @TODO prompt Do you want to blend Y/N/Compare
722
-                    $this->out($seed_key . ' already exists', true);
722
+                    $this->out($seed_key.' already exists', true);
723 723
                     if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
724 724
                         if ($blendResource->blendFromSeed($seed_key, true)) {
725
-                            $this->out($seed_key . ' has been blended into ID: ');
725
+                            $this->out($seed_key.' has been blended into ID: ');
726 726
                         }
727 727
                     }
728 728
                 } else {
729
-                    $this->out('There was an error saving ' . $seed_key, true);
730
-                    echo 'There was an error saving ' . $seed_key; exit();
729
+                    $this->out('There was an error saving '.$seed_key, true);
730
+                    echo 'There was an error saving '.$seed_key; exit();
731 731
                     $saved = false;
732 732
                 }
733 733
             }
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
      *
744 744
      * @return bool
745 745
      */
746
-    public function revertBlendManyResources($resources=[], $seeds_dir='', $overwrite=false)
746
+    public function revertBlendManyResources($resources = [], $seeds_dir = '', $overwrite = false)
747 747
     {
748 748
         $saved = true;
749 749
         // will update if resource does exist or create new
@@ -756,10 +756,10 @@  discard block
 block discarded – undo
756 756
                     $blendResource->setSeedsDir($seeds_dir);
757 757
                 }
758 758
                 if ($blendResource->revertBlend()) {
759
-                    $this->out($seed_key . ' has been reverted ');
759
+                    $this->out($seed_key.' has been reverted ');
760 760
 
761 761
                 } else {
762
-                    $this->out('There was an error reverting resource ' . $seed_key, true);
762
+                    $this->out('There was an error reverting resource '.$seed_key, true);
763 763
                     $saved = false;
764 764
                 }
765 765
             }
@@ -772,10 +772,10 @@  discard block
 block discarded – undo
772 772
      * @param string $key
773 773
      * @return \LCI\Blend\Blendable\SystemSetting
774 774
      */
775
-    public function getBlendableSystemSetting($key='')
775
+    public function getBlendableSystemSetting($key = '')
776 776
     {
777 777
         /** @var \LCI\Blend\Blendable\SystemSetting $systemSetting */
778
-        $systemSetting =  new SystemSetting($this->modx, $this, $key);
778
+        $systemSetting = new SystemSetting($this->modx, $this, $key);
779 779
         return $systemSetting->setSeedsDir($this->getSeedsDir());
780 780
     }
781 781
 
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
      *
786 786
      * @return bool
787 787
      */
788
-    public function blendManySystemSettings($settings=[], $seeds_dir='')
788
+    public function blendManySystemSettings($settings = [], $seeds_dir = '')
789 789
     {
790 790
         $success = true;
791 791
         // will update if system setting does exist or create new
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
      *
831 831
      * @return bool
832 832
      */
833
-    public function revertBlendManySystemSettings($settings=[], $seeds_dir='')
833
+    public function revertBlendManySystemSettings($settings = [], $seeds_dir = '')
834 834
     {
835 835
         $success = true;
836 836
         // will update if system setting does exist or create new
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
                 $systemSetting->setSeedsDir($seeds_dir);
861 861
             }
862 862
 
863
-            if ( $systemSetting->revertBlend() ) {
863
+            if ($systemSetting->revertBlend()) {
864 864
                 $this->out($systemSetting->getFieldName().' setting has been reverted to '.$seeds_dir);
865 865
 
866 866
             } else {
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
      *
879 879
      * @return mixed
880 880
      */
881
-    protected function prompt($question, $default='')
881
+    protected function prompt($question, $default = '')
882 882
     {
883 883
         return $this->userInteractionHandler->promptInput($question, $default);
884 884
     }
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
      * @param bool $default
889 889
      * @return bool
890 890
      */
891
-    protected function promptConfirm($question, $default=true)
891
+    protected function promptConfirm($question, $default = true)
892 892
     {
893 893
         return $this->userInteractionHandler->promptConfirm($question, $default);
894 894
     }
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
      * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...]
900 900
      * @return mixed ~ selected value
901 901
      */
902
-    protected function promptSelectOneOption($question, $default, $options=[])
902
+    protected function promptSelectOneOption($question, $default, $options = [])
903 903
     {
904 904
         return $this->userInteractionHandler->promptSelectOneOption($question, $default, $options);
905 905
     }
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
      * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...]
911 911
      * @return array ~ array of selected values
912 912
      */
913
-    protected function promptSelectMultipleOptions($question, $default, $options=[])
913
+    protected function promptSelectMultipleOptions($question, $default, $options = [])
914 914
     {
915 915
         return $this->userInteractionHandler->promptSelectMultipleOptions($question, $default, $options);
916 916
     }
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
      * @param string $message
920 920
      * @param bool $error
921 921
      */
922
-    public function out($message, $error=false)
922
+    public function out($message, $error = false)
923 923
     {
924 924
         if ($error) {
925 925
             $this->userInteractionHandler->tellUser($message, userInteractionHandler::MASSAGE_ERROR);
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
      *
945 945
      * @return bool
946 946
      */
947
-    public function createBlankMigrationClassFile($name, $server_type='master', $migration_path=null)
947
+    public function createBlankMigrationClassFile($name, $server_type = 'master', $migration_path = null)
948 948
     {
949 949
         $migrationCreator = new MigrationsCreator($this->userInteractionHandler);
950 950
 
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
      *
973 973
      * @return array
974 974
      */
975
-    public function makeChunkSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
975
+    public function makeChunkSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
976 976
     {
977 977
         $keys = [];
978 978
         $collection = $this->modx->getCollection('modChunk', $criteria);
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
      *
1013 1013
      * @return array
1014 1014
      */
1015
-    public function makeContextSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
1015
+    public function makeContextSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
1016 1016
     {
1017 1017
         $keys = [];
1018 1018
         $collection = $this->modx->getCollection('modContext', $criteria);
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
      *
1053 1053
      * @return array
1054 1054
      */
1055
-    public function makeMediaSourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
1055
+    public function makeMediaSourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
1056 1056
     {
1057 1057
         $keys = [];
1058 1058
         $collection = $this->modx->getCollection('modMediaSource', $criteria);
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
      *
1093 1093
      * @return array
1094 1094
      */
1095
-    public function makePluginSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
1095
+    public function makePluginSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
1096 1096
     {
1097 1097
         $keys = [];
1098 1098
         $collection = $this->modx->getCollection('modPlugin', $criteria);
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
      *
1133 1133
      * @return array
1134 1134
      */
1135
-    public function makeResourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
1135
+    public function makeResourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
1136 1136
     {
1137 1137
         $keys = [
1138 1138
             'web' => []
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
      *
1179 1179
      * @return array
1180 1180
      */
1181
-    public function makeSnippetSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
1181
+    public function makeSnippetSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
1182 1182
     {
1183 1183
         $keys = [];
1184 1184
         $collection = $this->modx->getCollection('modSnippet', $criteria);
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
      *
1219 1219
      * @return array
1220 1220
      */
1221
-    public function makeSystemSettingSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
1221
+    public function makeSystemSettingSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
1222 1222
     {
1223 1223
         $collection = $this->modx->getCollection('modSystemSetting', $criteria);
1224 1224
 
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
      *
1264 1264
      * @return array
1265 1265
      */
1266
-    public function makeTemplateSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
1266
+    public function makeTemplateSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
1267 1267
     {
1268 1268
         $keys = [];
1269 1269
         $collection = $this->modx->getCollection('modTemplate', $criteria);
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
      * @param string $server_type
1301 1301
      * @param null|string $name
1302 1302
      */
1303
-    public function makeSiteSeed($server_type='master', $name=null)
1303
+    public function makeSiteSeed($server_type = 'master', $name = null)
1304 1304
     {
1305 1305
         $site_data = [
1306 1306
             'mediaSources' => $this->makeMediaSourceSeeds(null, $server_type, $name, false),
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
      * @param string $method
1332 1332
      * @param bool $prompt
1333 1333
      */
1334
-    public function install($method='up', $prompt=false)
1334
+    public function install($method = 'up', $prompt = false)
1335 1335
     {
1336 1336
         $migration_name = 'install_blender';
1337 1337
         $custom_migration_dir = __DIR__.'/Migrations/Blend/';
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
      * @param string $method
1347 1347
      * @param bool $prompt
1348 1348
      */
1349
-    protected function runInstallMigration($migration_name, $custom_migration_path=null, $seed_root_path=null, $method='up', $prompt=false)
1349
+    protected function runInstallMigration($migration_name, $custom_migration_path = null, $seed_root_path = null, $method = 'up', $prompt = false)
1350 1350
     {
1351 1351
         // new blender for each instance
1352 1352
         $config = $this->config;
@@ -1381,10 +1381,10 @@  discard block
 block discarded – undo
1381 1381
                 $migration->set('status', 'up_complete');
1382 1382
                 $migration->set('created_at', date('Y-m-d H:i:s'));
1383 1383
                 $migration->set('processed_at', date('Y-m-d H:i:s'));
1384
-                if ($migration->save() ) {
1384
+                if ($migration->save()) {
1385 1385
                     $this->outSuccess($migration_name.' ran and logged');
1386 1386
                 } else {
1387
-                    $this->out($migration_name . ' did not log correctly', true);
1387
+                    $this->out($migration_name.' did not log correctly', true);
1388 1388
                 }
1389 1389
 
1390 1390
                 // does the migration directory exist?
@@ -1399,12 +1399,12 @@  discard block
 block discarded – undo
1399 1399
                     }
1400 1400
                     if ($create) {
1401 1401
                         mkdir($this->getMigrationPath(), 0700, true);
1402
-                        $this->outSuccess('Created migration directory: '. $this->getMigrationPath());
1402
+                        $this->outSuccess('Created migration directory: '.$this->getMigrationPath());
1403 1403
                     }
1404 1404
                 }
1405 1405
 
1406 1406
             } else {
1407
-                $this->out($migration_name . ' did not log correctly', true);
1407
+                $this->out($migration_name.' did not log correctly', true);
1408 1408
             }
1409 1409
 
1410 1410
         } elseif ($method == 'down') {
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
     /**
1428 1428
      * @param string $method
1429 1429
      */
1430
-    public function update($method='up')
1430
+    public function update($method = 'up')
1431 1431
     {
1432 1432
         $current_vesion = $this->modx->getOption('blend.version');
1433 1433
 
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
         $blender = new Blender($this->modx, $this->getUserInteractionHandler(), $config);
1439 1439
 
1440 1440
         foreach ($this->update_migrations as $v => $migration_name) {
1441
-            if (version_compare($v, $current_vesion) === 1 ) {
1441
+            if (version_compare($v, $current_vesion) === 1) {
1442 1442
                 // can not use as xPDO get queries fill the SELECT with the DB fields and since we are adding one this is a SQL error
1443 1443
                 //$blender->runMigration($method, 'master', 0, 0, $migration_name);
1444 1444
 
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
                         $migration->set('status', 'up_complete');
1464 1464
                         $migration->set('created_at', date('Y-m-d H:i:s'));
1465 1465
                         $migration->set('processed_at', date('Y-m-d H:i:s'));
1466
-                        if ($migration->save() ) {
1466
+                        if ($migration->save()) {
1467 1467
                             $this->outSuccess('Blend updated to '.$v);
1468 1468
                         } else {
1469 1469
                             $this->out('Blend did not update to '.$v, true);
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 
1504 1504
         $current_vesion = $this->modx->getOption('blend.version');
1505 1505
         //                                      FILE version,        DB Version
1506
-        if ( $this->isBlendInstalledInModx() && ( !$current_vesion || version_compare($this->getVersion(), $current_vesion)) ) {
1506
+        if ($this->isBlendInstalledInModx() && (!$current_vesion || version_compare($this->getVersion(), $current_vesion))) {
1507 1507
             $upgrade = true;
1508 1508
         }
1509 1509
 
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
      * @param int $id
1549 1549
      * @param string $name
1550 1550
      */
1551
-    public function runMigration($method='up', $type='master', $count=0, $id=0, $name=null)
1551
+    public function runMigration($method = 'up', $type = 'master', $count = 0, $id = 0, $name = null)
1552 1552
     {
1553 1553
         $dir = 'ASC';
1554 1554
         if ($method == 'down') {
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
             /** @var string $server_type */
1583 1583
             $server_type = $migration->get('type');
1584 1584
 
1585
-            if ( ($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete') ) {
1585
+            if (($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete')) {
1586 1586
                 continue;
1587 1587
             }
1588 1588
 
@@ -1680,7 +1680,7 @@  discard block
 block discarded – undo
1680 1680
         if (file_exists($file)) {
1681 1681
             require_once $file;
1682 1682
 
1683
-            if(class_exists($name)) {
1683
+            if (class_exists($name)) {
1684 1684
                 /** @var Migrations $migrationProcessClass */
1685 1685
                 $migrationProcessClass = new $name($this->modx, $blender);
1686 1686
             }
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
      * @param null $name
1695 1695
      * @return string
1696 1696
      */
1697
-    public function getMigrationName($type, $name=null)
1697
+    public function getMigrationName($type, $name = null)
1698 1698
     {
1699 1699
         $format = new Format($this->seeds_dir);
1700 1700
         return $format->getMigrationName($type, $name);
@@ -1712,21 +1712,21 @@  discard block
 block discarded – undo
1712 1712
         $class_name = $this->getMigrationName($type, $name);
1713 1713
 
1714 1714
         $removed = false;
1715
-        $migration_file = $this->getMigrationPath() . $class_name . '.php';
1715
+        $migration_file = $this->getMigrationPath().$class_name.'.php';
1716 1716
         if (file_exists($migration_file)) {
1717 1717
             if (unlink($migration_file)) {
1718 1718
                 $removed = true;
1719 1719
                 $migration = $this->modx->getObject($this->blend_class_object, ['name' => $class_name]);
1720 1720
                 if (is_object($migration) && $migration->remove()) {
1721
-                    $this->out($class_name . ' migration has been removed from the blend_migrations table');
1721
+                    $this->out($class_name.' migration has been removed from the blend_migrations table');
1722 1722
 
1723 1723
                 }
1724 1724
             } else {
1725
-                $this->out($class_name . ' migration has not been removed from the blend_migrations table', true);
1725
+                $this->out($class_name.' migration has not been removed from the blend_migrations table', true);
1726 1726
             }
1727 1727
 
1728 1728
         } else {
1729
-            $this->out($this->getMigrationPath() . $class_name . '.php migration could not be found to remove', true);
1729
+            $this->out($this->getMigrationPath().$class_name.'.php migration could not be found to remove', true);
1730 1730
         }
1731 1731
 
1732 1732
         return $removed;
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
      *
1765 1765
      * @return bool|int
1766 1766
      */
1767
-    public function getResourceIDFromSeedKey($seed_key, $context='web')
1767
+    public function getResourceIDFromSeedKey($seed_key, $context = 'web')
1768 1768
     {
1769 1769
         if (!isset($this->resource_seek_key_map[$context])) {
1770 1770
             $this->resource_seek_key_map[$context] = [];
Please login to merge, or discard this patch.