Test Setup Failed
Push — master ( 32c7c7...b19ce7 )
by Josh
03:11
created
src/Console/Seed.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -72,25 +72,25 @@  discard block
 block discarded – undo
72 72
         $id = $input->getOption('id');
73 73
         $date = $input->getOption('date');
74 74
 
75
-        if ( $object == 'c' || $object == 'chunk' ) {
75
+        if ($object == 'c' || $object == 'chunk') {
76 76
             $this->seedChunks($type, $name, $id);
77 77
 
78
-        } elseif ( $object == 'p' || $object == 'plugin' ) {
78
+        } elseif ($object == 'p' || $object == 'plugin') {
79 79
             $this->seedPlugins($type, $name, $id);
80 80
 
81
-        } elseif ( $object == 'r' || $object == 'resource' ) {
81
+        } elseif ($object == 'r' || $object == 'resource') {
82 82
             $this->seedResources($type, $name, $id, $date);
83 83
 
84
-        }  elseif ( $object == 's' || $object == 'snippet' ) {
84
+        }  elseif ($object == 's' || $object == 'snippet') {
85 85
             $this->seedSnippets($type, $name, $id);
86 86
 
87
-        } elseif ( $object == 'x' || $object == 'systemSettings'  ) {
87
+        } elseif ($object == 'x' || $object == 'systemSettings') {
88 88
             $this->seedSystemSettings($type, $name, $id, $date);
89 89
 
90
-        } elseif ( $object == 't' || $object == 'template'  ) {
90
+        } elseif ($object == 't' || $object == 'template') {
91 91
             $this->seedTemplates($type, $name, $id);
92 92
 
93
-        } elseif ( $object == 'a' || $object == 'site'  ) {
93
+        } elseif ($object == 'a' || $object == 'site') {
94 94
             $this->blender->getSeedMaker()->makeSiteSeed($type, $name);
95 95
 
96 96
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                 $query = $this->modx->newQuery('modResource', ['id:IN' => $ids]);
200 200
                 $query->select(['modResource.parent']);
201 201
                 $query->prepare();
202
-                $criteria->orCondition('`modResource`.`id` IN(' . $query->toSQL() . ')');
202
+                $criteria->orCondition('`modResource`.`id` IN('.$query->toSQL().')');
203 203
             }
204 204
 
205 205
             if ($this->consoleUserInteractionHandler->promptConfirm('Would you like to include direct children?')) {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 $query->select(['modResource.id']);
209 209
                 $query->prepare();
210 210
                 $children_sql = $query->toSQL();
211
-                $criteria->orCondition('`modResource`.`id` IN(' . $children_sql . ')');
211
+                $criteria->orCondition('`modResource`.`id` IN('.$children_sql.')');
212 212
 
213 213
                 if ($this->consoleUserInteractionHandler->promptConfirm('Would you like to include direct grand children?')) {
214 214
                     // get grand children
Please login to merge, or discard this patch.
src/SeedMaker.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      *
51 51
      * @return array
52 52
      */
53
-    public function makeChunkSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
53
+    public function makeChunkSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
54 54
     {
55 55
         $keys = [];
56 56
         $collection = $this->modx->getCollection('modChunk', $criteria);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return array
92 92
      */
93
-    public function makeContextSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
93
+    public function makeContextSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
94 94
     {
95 95
         $keys = [];
96 96
         $collection = $this->modx->getCollection('modContext', $criteria);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      *
131 131
      * @return array
132 132
      */
133
-    public function makeMediaSourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
133
+    public function makeMediaSourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
134 134
     {
135 135
         $keys = [];
136 136
         $collection = $this->modx->getCollection('modMediaSource', $criteria);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      *
171 171
      * @return array
172 172
      */
173
-    public function makePluginSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
173
+    public function makePluginSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
174 174
     {
175 175
         $keys = [];
176 176
         $collection = $this->modx->getCollection('modPlugin', $criteria);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      *
211 211
      * @return array
212 212
      */
213
-    public function makeResourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
213
+    public function makeResourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
214 214
     {
215 215
         $keys = [
216 216
             'web' => []
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      *
257 257
      * @return array
258 258
      */
259
-    public function makeSnippetSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
259
+    public function makeSnippetSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
260 260
     {
261 261
         $keys = [];
262 262
         $collection = $this->modx->getCollection('modSnippet', $criteria);
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      *
297 297
      * @return array
298 298
      */
299
-    public function makeSystemSettingSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
299
+    public function makeSystemSettingSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
300 300
     {
301 301
         $collection = $this->modx->getCollection('modSystemSetting', $criteria);
302 302
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      *
342 342
      * @return array
343 343
      */
344
-    public function makeTemplateSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true)
344
+    public function makeTemplateSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true)
345 345
     {
346 346
         $keys = [];
347 347
         $collection = $this->modx->getCollection('modTemplate', $criteria);
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      * @param string $server_type
379 379
      * @param null|string $name
380 380
      */
381
-    public function makeSiteSeed($server_type='master', $name=null)
381
+    public function makeSiteSeed($server_type = 'master', $name = null)
382 382
     {
383 383
         $site_data = [
384 384
             'mediaSources' => $this->makeMediaSourceSeeds(null, $server_type, $name, false),
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     /**
409 409
      * @param array $data
410 410
      */
411
-    protected function logCreatedSeedMigration($data=[])
411
+    protected function logCreatedSeedMigration($data = [])
412 412
     {
413 413
         try {
414 414
             /** @var BlendMigrations $migration */
Please login to merge, or discard this patch.
src/Blender.php 1 patch
Spacing   +83 added lines, -83 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();
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      * @param bool $refresh
247 247
      * @return array
248 248
      */
249
-    public function getCategoryMap($refresh=false)
249
+    public function getCategoryMap($refresh = false)
250 250
     {
251 251
         if (count($this->category_map) == 0 || $refresh) {
252 252
             $this->category_map = [
@@ -291,14 +291,14 @@  discard block
 block discarded – undo
291 291
     public function getBlendableChunk($name)
292 292
     {
293 293
         /** @var \LCI\Blend\Blendable\Chunk $chunk */
294
-        $chunk =  new Chunk($this->modx, $this, $name);
294
+        $chunk = new Chunk($this->modx, $this, $name);
295 295
         return $chunk->setSeedsDir($this->getSeedsDir());
296 296
     }
297 297
     /**
298 298
      * @param array $chunks
299 299
      * @param string $seeds_dir
300 300
      */
301
-    public function blendManyChunks($chunks=[], $seeds_dir='')
301
+    public function blendManyChunks($chunks = [], $seeds_dir = '')
302 302
     {
303 303
         // will update if element does exist or create new
304 304
         foreach ($chunks as $seed_key) {
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
             if ($blendChunk->blendFromSeed($seed_key)) {
311 311
                 $this->out($seed_key.' has been blended into ID: ');
312 312
 
313
-            } elseif($blendChunk->isExists()) {
313
+            } elseif ($blendChunk->isExists()) {
314 314
                 // @TODO prompt Do you want to blend Y/N/Compare
315 315
                 $this->out($seed_key.' chunk already exists', true);
316 316
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      * @param array $chunks
329 329
      * @param string $seeds_dir
330 330
      */
331
-    public function revertBlendManyChunks($chunks=[], $seeds_dir='')
331
+    public function revertBlendManyChunks($chunks = [], $seeds_dir = '')
332 332
     {
333 333
         // will update if system setting does exist or create new
334 334
         foreach ($chunks as $seed_key) {
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                 $blendChunk->setSeedsDir($seeds_dir);
339 339
             }
340 340
 
341
-            if ( $blendChunk->revertBlend() ) {
341
+            if ($blendChunk->revertBlend()) {
342 342
                 $this->out($blendChunk->getFieldName().' chunk has been reverted to '.$seeds_dir);
343 343
 
344 344
             } else {
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     public function getBlendableContext($key)
356 356
     {
357 357
         /** @var \LCI\Blend\Blendable\Context $chunk */
358
-        $context =  new Context($this->modx, $this, $key);
358
+        $context = new Context($this->modx, $this, $key);
359 359
         return $context->setSeedsDir($this->getSeedsDir());
360 360
     }
361 361
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
      * @param array $contexts
364 364
      * @param string $seeds_dir
365 365
      */
366
-    public function blendManyContexts($contexts=[], $seeds_dir='')
366
+    public function blendManyContexts($contexts = [], $seeds_dir = '')
367 367
     {
368 368
         // will update if element does exist or create new
369 369
         foreach ($contexts as $seed_key) {
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
             if ($blendContext->blendFromSeed($seed_key)) {
376 376
                 $this->out($seed_key.' has been blended ');
377 377
 
378
-            } elseif($blendContext->isExists()) {
378
+            } elseif ($blendContext->isExists()) {
379 379
                 // @TODO prompt Do you want to blend Y/N/Compare
380 380
                 $this->out($seed_key.' chunk already exists', true);
381 381
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
      * @param array $contexts
394 394
      * @param string $seeds_dir
395 395
      */
396
-    public function revertBlendManyContexts($contexts=[], $seeds_dir='')
396
+    public function revertBlendManyContexts($contexts = [], $seeds_dir = '')
397 397
     {
398 398
         // will update if system setting does exist or create new
399 399
         foreach ($contexts as $seed_key) {
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
                 $blendContext->setSeedsDir($seeds_dir);
404 404
             }
405 405
 
406
-            if ( $blendContext->revertBlend() ) {
406
+            if ($blendContext->revertBlend()) {
407 407
                 $this->out($blendContext->getFieldKey().' context has been reverted to '.$seeds_dir);
408 408
 
409 409
             } else {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
     public function getBlendableMediaSource($name)
421 421
     {
422 422
         /** @var \LCI\Blend\Blendable\MediaSource $mediaSource */
423
-        $mediaSource =  new MediaSource($this->modx, $this, $name);
423
+        $mediaSource = new MediaSource($this->modx, $this, $name);
424 424
         return $mediaSource
425 425
             ->setFieldName($name)
426 426
             ->setSeedsDir($this->getSeedsDir());
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
      * @param array $media_sources
431 431
      * @param string $seeds_dir
432 432
      */
433
-    public function blendManyMediaSources($media_sources=[], $seeds_dir='')
433
+    public function blendManyMediaSources($media_sources = [], $seeds_dir = '')
434 434
     {
435 435
         // will update if element does exist or create new
436 436
         foreach ($media_sources as $seed_key) {
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
             if ($blendMediaSource->blendFromSeed($seed_key)) {
443 443
                 $this->out($seed_key.' has been blended into ID: ');
444 444
 
445
-            } elseif($blendMediaSource->isExists()) {
445
+            } elseif ($blendMediaSource->isExists()) {
446 446
                 // @TODO add Compare as option
447 447
                 $this->out($seed_key.' media source already exists', true);
448 448
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
      * @param array $media_sources
461 461
      * @param string $seeds_dir
462 462
      */
463
-    public function revertBlendManyMediaSources($media_sources=[], $seeds_dir='')
463
+    public function revertBlendManyMediaSources($media_sources = [], $seeds_dir = '')
464 464
     {
465 465
         // will update if system setting does exist or create new
466 466
         foreach ($media_sources as $seed_key) {
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
                 $blendMediaSource->setSeedsDir($seeds_dir);
471 471
             }
472 472
 
473
-            if ( $blendMediaSource->revertBlend() ) {
473
+            if ($blendMediaSource->revertBlend()) {
474 474
                 $this->out($blendMediaSource->getFieldName().' media source has been reverted to '.$seeds_dir);
475 475
 
476 476
             } else {
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
     public function getBlendablePlugin($name)
488 488
     {
489 489
         /** @var \LCI\Blend\Blendable\Plugin $plugin */
490
-        $plugin =  new Plugin($this->modx, $this, $name);
490
+        $plugin = new Plugin($this->modx, $this, $name);
491 491
         return $plugin->setSeedsDir($this->getSeedsDir());
492 492
     }
493 493
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      * @param array $plugins
496 496
      * @param string $seeds_dir
497 497
      */
498
-    public function blendManyPlugins($plugins=[], $seeds_dir='')
498
+    public function blendManyPlugins($plugins = [], $seeds_dir = '')
499 499
     {
500 500
         // will update if element does exist or create new
501 501
         foreach ($plugins as $seed_key) {
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             if ($blendPlugin->blendFromSeed($seed_key)) {
508 508
                 $this->out($seed_key.' has been blended into ID: ');
509 509
 
510
-            } elseif($blendPlugin->isExists()) {
510
+            } elseif ($blendPlugin->isExists()) {
511 511
                 // @TODO prompt Do you want to blend Y/N/Compare
512 512
                 $this->out($seed_key.' plugin already exists', true);
513 513
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
      * @param array $plugins
526 526
      * @param string $seeds_dir
527 527
      */
528
-    public function revertBlendManyPlugins($plugins=[], $seeds_dir='')
528
+    public function revertBlendManyPlugins($plugins = [], $seeds_dir = '')
529 529
     {
530 530
         // will update if system setting does exist or create new
531 531
         foreach ($plugins as $seed_key) {
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
                 $blendPlugin->setSeedsDir($seeds_dir);
536 536
             }
537 537
 
538
-            if ( $blendPlugin->revertBlend() ) {
538
+            if ($blendPlugin->revertBlend()) {
539 539
                 $this->out($blendPlugin->getFieldName().' plugin has been reverted to '.$seeds_dir);
540 540
 
541 541
             } else {
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
     public function getBlendableSnippet($name)
553 553
     {
554 554
         /** @var Snippet $snippet */
555
-        $snippet =  new Snippet($this->modx, $this, $name);
555
+        $snippet = new Snippet($this->modx, $this, $name);
556 556
         return $snippet->setSeedsDir($this->getSeedsDir());
557 557
     }
558 558
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
      * @param array $snippets
561 561
      * @param string $seeds_dir
562 562
      */
563
-    public function blendManySnippets($snippets=[], $seeds_dir='')
563
+    public function blendManySnippets($snippets = [], $seeds_dir = '')
564 564
     {
565 565
         // will update if element does exist or create new
566 566
         foreach ($snippets as $seed_key) {
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
             if ($blendSnippet->blendFromSeed($seed_key)) {
573 573
                 $this->out($seed_key.' has been blended');
574 574
 
575
-            } elseif($blendSnippet->isExists()) {
575
+            } elseif ($blendSnippet->isExists()) {
576 576
                 // @TODO prompt Do you want to blend Y/N/Compare
577 577
                 $this->out($seed_key.' snippet already exists', true);
578 578
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      * @param array $snippets
590 590
      * @param string $seeds_dir
591 591
      */
592
-    public function revertBlendManySnippets($snippets=[], $seeds_dir='')
592
+    public function revertBlendManySnippets($snippets = [], $seeds_dir = '')
593 593
     {
594 594
         // will update if system setting does exist or create new
595 595
         foreach ($snippets as $seed_key) {
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
                 $blendSnippet->setSeedsDir($seeds_dir);
600 600
             }
601 601
 
602
-            if ( $blendSnippet->revertBlend() ) {
602
+            if ($blendSnippet->revertBlend()) {
603 603
                 $this->out($blendSnippet->getFieldName().' snippet has been reverted to '.$seeds_dir);
604 604
 
605 605
             } else {
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
     public function getBlendableTemplate($name)
617 617
     {
618 618
         /** @var \LCI\Blend\Blendable\Template $template */
619
-        $template =  new Template($this->modx, $this, $name);
619
+        $template = new Template($this->modx, $this, $name);
620 620
         return $template->setSeedsDir($this->seeds_dir);
621 621
     }
622 622
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
      * @param string $seeds_dir
626 626
      * @param bool $overwrite
627 627
      */
628
-    public function blendManyTemplates($templates=[], $seeds_dir='', $overwrite=false)
628
+    public function blendManyTemplates($templates = [], $seeds_dir = '', $overwrite = false)
629 629
     {
630 630
         // will update if template does exist or create new
631 631
         foreach ($templates as $seed_key) {
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
             if ($blendTemplate->blendFromSeed($seed_key, $overwrite)) {
639 639
                 $this->out($seed_key.' has been blended');
640 640
 
641
-            } elseif($blendTemplate->isExists()) {
641
+            } elseif ($blendTemplate->isExists()) {
642 642
                 $this->out($seed_key.' template already exists', true);
643 643
                 if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
644 644
                     if ($blendTemplate->blendFromSeed($seed_key, true)) {
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
      * @param array $templates
656 656
      * @param string $seeds_dir
657 657
      */
658
-    public function revertBlendManyTemplates($templates=[], $seeds_dir='')
658
+    public function revertBlendManyTemplates($templates = [], $seeds_dir = '')
659 659
     {
660 660
         // will update if system setting does exist or create new
661 661
         foreach ($templates as $seed_key) {
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                 $blendTemplate->setSeedsDir($seeds_dir);
666 666
             }
667 667
 
668
-            if ( $blendTemplate->revertBlend() ) {
668
+            if ($blendTemplate->revertBlend()) {
669 669
                 $this->out($blendTemplate->getFieldName().' template has been reverted to '.$seeds_dir);
670 670
 
671 671
             } else {
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
     public function getBlendableTemplateVariable($name)
683 683
     {
684 684
         /** @var \LCI\Blend\Blendable\TemplateVariable $tv */
685
-        $tv =  new TemplateVariable($this->modx, $this, $name);
685
+        $tv = new TemplateVariable($this->modx, $this, $name);
686 686
         return $tv->setSeedsDir($this->seeds_dir);
687 687
     }
688 688
 
@@ -691,10 +691,10 @@  discard block
 block discarded – undo
691 691
      * @param  string $context
692 692
      * @return \LCI\Blend\Blendable\Resource
693 693
      */
694
-    public function getBlendableResource($alias, $context='web')
694
+    public function getBlendableResource($alias, $context = 'web')
695 695
     {
696 696
         /** @var \LCI\Blend\Blendable\Resource $resource */
697
-        $resource =  new Resource($this->modx, $this, $alias, $context);
697
+        $resource = new Resource($this->modx, $this, $alias, $context);
698 698
         return $resource
699 699
             ->setSeedsDir($this->getSeedsDir());
700 700
     }
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
      *
706 706
      * @return bool
707 707
      */
708
-    public function blendManyResources($resources=[], $seeds_dir='', $overwrite=false)
708
+    public function blendManyResources($resources = [], $seeds_dir = '', $overwrite = false)
709 709
     {
710 710
         $saved = true;
711 711
         // will update if resource does exist or create new
@@ -719,19 +719,19 @@  discard block
 block discarded – undo
719 719
                 }
720 720
 
721 721
                 if ($blendResource->blendFromSeed($seed_key, $overwrite)) {
722
-                    $this->out($seed_key . ' has been blended into ID: ');
722
+                    $this->out($seed_key.' has been blended into ID: ');
723 723
 
724 724
                 } elseif ($blendResource->isExists()) {
725 725
                     // @TODO prompt Do you want to blend Y/N/Compare
726
-                    $this->out($seed_key . ' already exists', true);
726
+                    $this->out($seed_key.' already exists', true);
727 727
                     if ($this->prompt('Would you like to update?', 'Y') === 'Y') {
728 728
                         if ($blendResource->blendFromSeed($seed_key, true)) {
729
-                            $this->out($seed_key . ' has been blended into ID: ');
729
+                            $this->out($seed_key.' has been blended into ID: ');
730 730
                         }
731 731
                     }
732 732
                 } else {
733
-                    $this->out('There was an error saving ' . $seed_key, true);
734
-                    echo 'There was an error saving ' . $seed_key; exit();
733
+                    $this->out('There was an error saving '.$seed_key, true);
734
+                    echo 'There was an error saving '.$seed_key; exit();
735 735
                     $saved = false;
736 736
                 }
737 737
             }
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
      *
748 748
      * @return bool
749 749
      */
750
-    public function revertBlendManyResources($resources=[], $seeds_dir='', $overwrite=false)
750
+    public function revertBlendManyResources($resources = [], $seeds_dir = '', $overwrite = false)
751 751
     {
752 752
         $saved = true;
753 753
         // will update if resource does exist or create new
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
                     $blendResource->setSeedsDir($seeds_dir);
761 761
                 }
762 762
                 if ($blendResource->revertBlend()) {
763
-                    $this->out($seed_key . ' has been reverted ');
763
+                    $this->out($seed_key.' has been reverted ');
764 764
 
765 765
                 } else {
766
-                    $this->out('There was an error reverting resource ' . $seed_key, true);
766
+                    $this->out('There was an error reverting resource '.$seed_key, true);
767 767
                     $saved = false;
768 768
                 }
769 769
             }
@@ -776,10 +776,10 @@  discard block
 block discarded – undo
776 776
      * @param string $key
777 777
      * @return \LCI\Blend\Blendable\SystemSetting
778 778
      */
779
-    public function getBlendableSystemSetting($key='')
779
+    public function getBlendableSystemSetting($key = '')
780 780
     {
781 781
         /** @var \LCI\Blend\Blendable\SystemSetting $systemSetting */
782
-        $systemSetting =  new SystemSetting($this->modx, $this, $key);
782
+        $systemSetting = new SystemSetting($this->modx, $this, $key);
783 783
         return $systemSetting->setSeedsDir($this->getSeedsDir());
784 784
     }
785 785
 
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
      *
790 790
      * @return bool
791 791
      */
792
-    public function blendManySystemSettings($settings=[], $seeds_dir='')
792
+    public function blendManySystemSettings($settings = [], $seeds_dir = '')
793 793
     {
794 794
         $success = true;
795 795
         // will update if system setting does exist or create new
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
      *
835 835
      * @return bool
836 836
      */
837
-    public function revertBlendManySystemSettings($settings=[], $seeds_dir='')
837
+    public function revertBlendManySystemSettings($settings = [], $seeds_dir = '')
838 838
     {
839 839
         $success = true;
840 840
         // will update if system setting does exist or create new
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
                 $systemSetting->setSeedsDir($seeds_dir);
865 865
             }
866 866
 
867
-            if ( $systemSetting->revertBlend() ) {
867
+            if ($systemSetting->revertBlend()) {
868 868
                 $this->out($systemSetting->getFieldName().' setting has been reverted to '.$seeds_dir);
869 869
 
870 870
             } else {
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
      *
883 883
      * @return mixed
884 884
      */
885
-    protected function prompt($question, $default='')
885
+    protected function prompt($question, $default = '')
886 886
     {
887 887
         return $this->userInteractionHandler->promptInput($question, $default);
888 888
     }
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
      * @param bool $default
893 893
      * @return bool
894 894
      */
895
-    protected function promptConfirm($question, $default=true)
895
+    protected function promptConfirm($question, $default = true)
896 896
     {
897 897
         return $this->userInteractionHandler->promptConfirm($question, $default);
898 898
     }
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
      * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...]
904 904
      * @return mixed ~ selected value
905 905
      */
906
-    protected function promptSelectOneOption($question, $default, $options=[])
906
+    protected function promptSelectOneOption($question, $default, $options = [])
907 907
     {
908 908
         return $this->userInteractionHandler->promptSelectOneOption($question, $default, $options);
909 909
     }
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
      * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...]
915 915
      * @return array ~ array of selected values
916 916
      */
917
-    protected function promptSelectMultipleOptions($question, $default, $options=[])
917
+    protected function promptSelectMultipleOptions($question, $default, $options = [])
918 918
     {
919 919
         return $this->userInteractionHandler->promptSelectMultipleOptions($question, $default, $options);
920 920
     }
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
      * @param string $message
924 924
      * @param bool $error
925 925
      */
926
-    public function out($message, $error=false)
926
+    public function out($message, $error = false)
927 927
     {
928 928
         if ($error) {
929 929
             $this->userInteractionHandler->tellUser($message, userInteractionHandler::MASSAGE_ERROR);
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
      *
949 949
      * @return bool
950 950
      */
951
-    public function createBlankMigrationClassFile($name, $server_type='master', $migration_path=null)
951
+    public function createBlankMigrationClassFile($name, $server_type = 'master', $migration_path = null)
952 952
     {
953 953
         $migrationCreator = new MigrationsCreator($this->userInteractionHandler);
954 954
 
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
      * @param string $method
981 981
      * @param bool $prompt
982 982
      */
983
-    public function install($method='up', $prompt=false)
983
+    public function install($method = 'up', $prompt = false)
984 984
     {
985 985
         $migration_name = 'install_blender';
986 986
         $custom_migration_dir = __DIR__.'/Migrations/Blend/';
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
      * @param string $method
996 996
      * @param bool $prompt
997 997
      */
998
-    protected function runInstallMigration($migration_name, $custom_migration_path=null, $seed_root_path=null, $method='up', $prompt=false)
998
+    protected function runInstallMigration($migration_name, $custom_migration_path = null, $seed_root_path = null, $method = 'up', $prompt = false)
999 999
     {
1000 1000
         // new blender for each instance
1001 1001
         $config = $this->config;
@@ -1030,10 +1030,10 @@  discard block
 block discarded – undo
1030 1030
                 $migration->set('status', 'up_complete');
1031 1031
                 $migration->set('created_at', date('Y-m-d H:i:s'));
1032 1032
                 $migration->set('processed_at', date('Y-m-d H:i:s'));
1033
-                if ($migration->save() ) {
1033
+                if ($migration->save()) {
1034 1034
                     $this->outSuccess($migration_name.' ran and logged');
1035 1035
                 } else {
1036
-                    $this->out($migration_name . ' did not log correctly', true);
1036
+                    $this->out($migration_name.' did not log correctly', true);
1037 1037
                 }
1038 1038
 
1039 1039
                 // does the migration directory exist?
@@ -1048,12 +1048,12 @@  discard block
 block discarded – undo
1048 1048
                     }
1049 1049
                     if ($create) {
1050 1050
                         mkdir($this->getMigrationPath(), 0700, true);
1051
-                        $this->outSuccess('Created migration directory: '. $this->getMigrationPath());
1051
+                        $this->outSuccess('Created migration directory: '.$this->getMigrationPath());
1052 1052
                     }
1053 1053
                 }
1054 1054
 
1055 1055
             } else {
1056
-                $this->out($migration_name . ' did not log correctly', true);
1056
+                $this->out($migration_name.' did not log correctly', true);
1057 1057
             }
1058 1058
 
1059 1059
         } elseif ($method == 'down') {
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
     /**
1077 1077
      * @param string $method
1078 1078
      */
1079
-    public function update($method='up')
1079
+    public function update($method = 'up')
1080 1080
     {
1081 1081
         $current_vesion = $this->modx->getOption('blend.version');
1082 1082
 
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
         $blender = new Blender($this->modx, $this->getUserInteractionHandler(), $config);
1088 1088
 
1089 1089
         foreach ($this->update_migrations as $v => $migration_name) {
1090
-            if (version_compare($v, $current_vesion) === 1 ) {
1090
+            if (version_compare($v, $current_vesion) === 1) {
1091 1091
                 // 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
1092 1092
                 //$blender->runMigration($method, 'master', 0, 0, $migration_name);
1093 1093
 
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
                         $migration->set('status', 'up_complete');
1113 1113
                         $migration->set('created_at', date('Y-m-d H:i:s'));
1114 1114
                         $migration->set('processed_at', date('Y-m-d H:i:s'));
1115
-                        if ($migration->save() ) {
1115
+                        if ($migration->save()) {
1116 1116
                             $this->outSuccess('Blend updated to '.$v);
1117 1117
                         } else {
1118 1118
                             $this->out('Blend did not update to '.$v, true);
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 
1153 1153
         $current_vesion = $this->modx->getOption('blend.version');
1154 1154
         //                                      FILE version,        DB Version
1155
-        if ( $this->isBlendInstalledInModx() && ( !$current_vesion || version_compare($this->getVersion(), $current_vesion)) ) {
1155
+        if ($this->isBlendInstalledInModx() && (!$current_vesion || version_compare($this->getVersion(), $current_vesion))) {
1156 1156
             $upgrade = true;
1157 1157
         }
1158 1158
 
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
      * @param int $id
1198 1198
      * @param string $name
1199 1199
      */
1200
-    public function runMigration($method='up', $type='master', $count=0, $id=0, $name=null)
1200
+    public function runMigration($method = 'up', $type = 'master', $count = 0, $id = 0, $name = null)
1201 1201
     {
1202 1202
         $dir = 'ASC';
1203 1203
         if ($method == 'down') {
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
             /** @var string $server_type */
1232 1232
             $server_type = $migration->get('type');
1233 1233
 
1234
-            if ( ($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete') ) {
1234
+            if (($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete')) {
1235 1235
                 continue;
1236 1236
             }
1237 1237
 
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
         if (file_exists($file)) {
1330 1330
             require_once $file;
1331 1331
 
1332
-            if(class_exists($name)) {
1332
+            if (class_exists($name)) {
1333 1333
                 /** @var Migrations $migrationProcessClass */
1334 1334
                 $migrationProcessClass = new $name($this->modx, $blender);
1335 1335
             }
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
      * @param null $name
1344 1344
      * @return string
1345 1345
      */
1346
-    public function getMigrationName($type, $name=null)
1346
+    public function getMigrationName($type, $name = null)
1347 1347
     {
1348 1348
         $format = new Format($this->seeds_dir);
1349 1349
         return $format->getMigrationName($type, $name);
@@ -1361,21 +1361,21 @@  discard block
 block discarded – undo
1361 1361
         $class_name = $this->getMigrationName($type, $name);
1362 1362
 
1363 1363
         $removed = false;
1364
-        $migration_file = $this->getMigrationPath() . $class_name . '.php';
1364
+        $migration_file = $this->getMigrationPath().$class_name.'.php';
1365 1365
         if (file_exists($migration_file)) {
1366 1366
             if (unlink($migration_file)) {
1367 1367
                 $removed = true;
1368 1368
                 $migration = $this->modx->getObject($this->blend_class_object, ['name' => $class_name]);
1369 1369
                 if (is_object($migration) && $migration->remove()) {
1370
-                    $this->out($class_name . ' migration has been removed from the blend_migrations table');
1370
+                    $this->out($class_name.' migration has been removed from the blend_migrations table');
1371 1371
 
1372 1372
                 }
1373 1373
             } else {
1374
-                $this->out($class_name . ' migration has not been removed from the blend_migrations table', true);
1374
+                $this->out($class_name.' migration has not been removed from the blend_migrations table', true);
1375 1375
             }
1376 1376
 
1377 1377
         } else {
1378
-            $this->out($this->getMigrationPath() . $class_name . '.php migration could not be found to remove', true);
1378
+            $this->out($this->getMigrationPath().$class_name.'.php migration could not be found to remove', true);
1379 1379
         }
1380 1380
 
1381 1381
         return $removed;
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
      *
1414 1414
      * @return bool|int
1415 1415
      */
1416
-    public function getResourceIDFromSeedKey($seed_key, $context='web')
1416
+    public function getResourceIDFromSeedKey($seed_key, $context = 'web')
1417 1417
     {
1418 1418
         if (!isset($this->resource_seek_key_map[$context])) {
1419 1419
             $this->resource_seek_key_map[$context] = [];
Please login to merge, or discard this patch.