Test Setup Failed
Push — master ( 32c7c7...b19ce7 )
by Josh
03:11
created
src/Properties.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      *
50 50
      * @return $this
51 51
      */
52
-    public function mergePropertiesFromArray(array $data=[])
52
+    public function mergePropertiesFromArray(array $data = [])
53 53
     {
54 54
         if ($this->verifyArray($data)) {
55 55
             $this->data = array_merge($data, $this->data);
Please login to merge, or discard this patch.
src/Blendable/Blendable.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
      * @param Blender $blender
82 82
      * @param string|array $unique_value
83 83
      */
84
-    public function __construct(\modx $modx, Blender $blender, $unique_value='')
84
+    public function __construct(\modx $modx, Blender $blender, $unique_value = '')
85 85
     {
86 86
         $this->modx = $modx;
87 87
         $this->blender = $blender;
88
-        if (method_exists($this, 'loadProperties') ) {
88
+        if (method_exists($this, 'loadProperties')) {
89 89
             $this->loadProperties();
90 90
         }
91 91
 
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function setSeedsDir($dir)
136 136
     {
137
-        $this->seeds_dir = (string) $dir;
137
+        $this->seeds_dir = (string)$dir;
138 138
         if (!empty($this->seeds_dir)) {
139
-            $this->cacheOptions[\xPDO::OPT_CACHE_PATH] = $this->blender->getSeedsPath() . $dir . '/';
139
+            $this->cacheOptions[\xPDO::OPT_CACHE_PATH] = $this->blender->getSeedsPath().$dir.'/';
140 140
         }
141 141
         return $this;
142 142
     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param string $type ~ seed or revert
170 170
      * @return string
171 171
      */
172
-    public function getSeedKey($type='seed')
172
+    public function getSeedKey($type = 'seed')
173 173
     {
174 174
         $name = $this->blendable_xpdo_simple_object_data[$this->unique_key_column];
175 175
         if (method_exists($this, 'getFieldName')) {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
         switch ($type) {
181 181
             case 'revert':
182
-                $seed_key = 'revert-' . $key;
182
+                $seed_key = 'revert-'.$key;
183 183
                 break;
184 184
 
185 185
             case 'seed':
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      * @param bool $overwrite
205 205
      * @return bool
206 206
      */
207
-    public function blendFromArray($data, $overwrite=false)
207
+    public function blendFromArray($data, $overwrite = false)
208 208
     {
209 209
         if (isset($data['columns'])) {
210 210
             $this->blendable_xpdo_simple_object_data = $data['columns'];
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
      *
230 230
      * @return bool
231 231
      */
232
-    public function blendFromSeed($seed_key, $overwrite=false)
232
+    public function blendFromSeed($seed_key, $overwrite = false)
233 233
     {
234 234
         $this->loadObjectDataFromSeed($seed_key);
235 235
         return $this->blend($overwrite);
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      *
241 241
      * @return bool
242 242
      */
243
-    public function blend($overwrite=false)
243
+    public function blend($overwrite = false)
244 244
     {
245 245
         if ($this->type == 'blend') {
246 246
             /** @var \LCI\Blend\Blendable\Blendable $currentVersion */
@@ -285,26 +285,26 @@  discard block
 block discarded – undo
285 285
      * @param bool $make_revert_seed
286 286
      * @return bool
287 287
      */
288
-    public function delete($make_revert_seed=true)
288
+    public function delete($make_revert_seed = true)
289 289
     {
290 290
         if ($make_revert_seed) {
291 291
             $this->seed('revert');
292 292
         }
293 293
         $removed = false;
294 294
         if (!is_object($this->xPDOSimpleObject)) {
295
-            $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column] . ' of xPDO class '.
295
+            $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column].' of xPDO class '.
296 296
                 $this->xpdo_simple_object_class.' was not found, could not be removed/deleted', true);
297 297
 
298 298
         } elseif ($this->xPDOSimpleObject->remove()) {
299 299
             $this->onDeleteRevertRelatedPieces();
300 300
             if ($this->isDebug()) {
301
-                $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column] . ' has been removed/deleted');
301
+                $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column].' has been removed/deleted');
302 302
             }
303 303
             $removed = true;
304 304
 
305 305
         } else {
306 306
             if ($this->isDebug()) {
307
-                $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column] . ' did not remove/delete', true);
307
+                $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column].' did not remove/delete', true);
308 308
             }
309 309
         }
310 310
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      * @param string $type ~ seed or revert
330 330
      * @return string ~ the related seed key
331 331
      */
332
-    public function seed($type='seed')
332
+    public function seed($type = 'seed')
333 333
     {
334 334
         $data = false;
335 335
         // No IDs! must get the alias and get a seed key,
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
      * @param string $seed_key
354 354
      * @return array
355 355
      */
356
-    public function seedToArray($type='seed', $seed_key='')
356
+    public function seedToArray($type = 'seed', $seed_key = '')
357 357
     {
358 358
         if (is_object($this->xPDOSimpleObject)) {
359 359
             $this->current_xpdo_simple_object_data = $this->xPDOSimpleObject->toArray();
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                 }
365 365
                 // Any child class can create a seed method, an example for modResource:
366 366
                 // seedTemplate(1) and would return the string name
367
-                $method = 'seed' . $this->makeStudyCase($column);
367
+                $method = 'seed'.$this->makeStudyCase($column);
368 368
                 if (method_exists($this, $method)) {
369 369
                     $value = $this->$method($value);
370 370
                 }
@@ -420,15 +420,15 @@  discard block
 block discarded – undo
420 420
      *
421 421
      * @return bool
422 422
      */
423
-    protected function save($overwrite=false)
423
+    protected function save($overwrite = false)
424 424
     {
425 425
         $saved = false;
426 426
 
427 427
         if (is_object($this->xPDOSimpleObject)) {
428 428
             if (!$overwrite) {
429 429
                 $this->error = true;
430
-                $this->error_messages['exits'] = $this->xpdo_simple_object_class.': ' .
431
-                    $this->blendable_xpdo_simple_object_data[$this->unique_key_column] . ' already exists ';
430
+                $this->error_messages['exits'] = $this->xpdo_simple_object_class.': '.
431
+                    $this->blendable_xpdo_simple_object_data[$this->unique_key_column].' already exists ';
432 432
                 return $saved;
433 433
             }
434 434
         } else {
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
         if ($this->xPDOSimpleObject->save()) {
457 457
             $this->attachRelatedPiecesAfterSave();
458 458
             if ($this->isDebug()) {
459
-                $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column] . ' has been installed/saved');
459
+                $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column].' has been installed/saved');
460 460
             }
461 461
             $saved = true;
462 462
 
463 463
         } else {
464 464
             if ($this->isDebug()) {
465
-                $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column] . ' did not install/update', true);
465
+                $this->blender->out($this->blendable_xpdo_simple_object_data[$this->unique_key_column].' did not install/update', true);
466 466
             }
467 467
 
468 468
         }
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
      *
510 510
      * @return $this
511 511
      */
512
-    protected function loadFromArray($data=[])
512
+    protected function loadFromArray($data = [])
513 513
     {
514 514
         foreach ($data as $column => $value) {
515 515
             $method_name = 'seed'.$this->makeStudyCase($column);
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                 }
538 538
                 $this->$method_name($value);
539 539
                 
540
-            } elseif($this->isDebug()) {
540
+            } elseif ($this->isDebug()) {
541 541
                 $this->blender->out(__METHOD__.' missing: '.$method_name.' V: '.$value, true);
542 542
             }
543 543
         }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     /**
627 627
      * @var string $type blend or revert
628 628
      */
629
-    protected function seedRelated($type='blend')
629
+    protected function seedRelated($type = 'blend')
630 630
     {
631 631
         // load related data:
632 632
         $this->loadRelatedData();
Please login to merge, or discard this patch.
src/Console/ActivePackageCommands.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
         foreach ($commands as $command) {
102 102
             $class = new $command();
103 103
 
104
-            if (is_object($class) ) {
104
+            if (is_object($class)) {
105 105
                 if (method_exists($class, 'setConsole')) {
106 106
                     $class->setConsole($this->console);
107 107
                 }
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
         return new InputDefinition(array(
32 32
             new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
33 33
 
34
-            new InputOption('--help',           '-h', InputOption::VALUE_NONE, 'Display this help message.'),
34
+            new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'),
35 35
             //new InputOption('--verbose',        '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.'),
36
-            new InputOption('--version',        '-V', InputOption::VALUE_NONE, 'Display the Blend version.'),
36
+            new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display the Blend version.'),
37 37
         ));
38 38
     }
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
src/Migrations/MigrationsCreator.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -410,7 +410,7 @@
 block discarded – undo
410 410
         else {
411 411
             try {
412 412
                 $write = file_put_contents($this->migrations_path . $class_name . '.php', $file_contents);
413
-                 $this->log_data = [
413
+                    $this->log_data = [
414 414
                     'name' => $class_name,
415 415
                     'type' => $this->getServerType(),
416 416
                     'description' => $this->getDescription(),
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param UserInteractionHandler $userInteractionHandler
54 54
      * @param array $class_data
55 55
      */
56
-    public function __construct(UserInteractionHandler $userInteractionHandler, $class_data=[])
56
+    public function __construct(UserInteractionHandler $userInteractionHandler, $class_data = [])
57 57
     {
58 58
         $this->class_data = $class_data;
59 59
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
         $this->path_time_stamp = date('Y_m_d_His');
63 63
         $this->format = new Format($this->path_time_stamp);
64 64
 
65
-        $this->migration_templates_path = __DIR__. '/templates/';
66
-        $this->setBaseMigrationsPath(dirname(__DIR__) . DIRECTORY_SEPARATOR);
65
+        $this->migration_templates_path = __DIR__.'/templates/';
66
+        $this->setBaseMigrationsPath(dirname(__DIR__).DIRECTORY_SEPARATOR);
67 67
     }
68 68
 
69 69
     /**
@@ -71,20 +71,20 @@  discard block
 block discarded – undo
71 71
      * @param bool $append ~ if true will create database/migrations with in the path
72 72
      * @return $this
73 73
      */
74
-    public function setMigrationsPath($path, $append=false)
74
+    public function setMigrationsPath($path, $append = false)
75 75
     {
76 76
         $this->migrations_path = $path;
77 77
 
78 78
         if (file_exists($path) && $append) {
79
-            if (!file_exists($path . 'database')) {
80
-                mkdir($path . 'database');
79
+            if (!file_exists($path.'database')) {
80
+                mkdir($path.'database');
81 81
             }
82
-            if (!file_exists($path . 'database/migrations')) {
83
-                mkdir($path . 'database/migrations');
82
+            if (!file_exists($path.'database/migrations')) {
83
+                mkdir($path.'database/migrations');
84 84
             }
85
-            $this->migrations_path = $path . 'database/migrations/';
85
+            $this->migrations_path = $path.'database/migrations/';
86 86
 
87
-        } elseif( !file_exists($path) && !$append) {
87
+        } elseif (!file_exists($path) && !$append) {
88 88
             // @TODO review:
89 89
             mkdir($path, 0777, true);
90 90
         }
@@ -96,20 +96,20 @@  discard block
 block discarded – undo
96 96
      * @param bool $append ~ if true will create database/seeds with in the path
97 97
      * @return $this
98 98
      */
99
-    public function setSeedsPath($path, $append=false)
99
+    public function setSeedsPath($path, $append = false)
100 100
     {
101 101
         $this->seeds_path = $path;
102 102
 
103 103
         if (file_exists($path) && $append) {
104
-            if (!file_exists($path . 'database')) {
105
-                mkdir($path . 'database');
104
+            if (!file_exists($path.'database')) {
105
+                mkdir($path.'database');
106 106
             }
107
-            if (!file_exists($path . 'database/seeds')) {
108
-                mkdir($path . 'database/seeds');
107
+            if (!file_exists($path.'database/seeds')) {
108
+                mkdir($path.'database/seeds');
109 109
             }
110
-            $this->seeds_path = $path . 'database/seeds/';
110
+            $this->seeds_path = $path.'database/seeds/';
111 111
 
112
-        } elseif( !file_exists($path) && !$append) {
112
+        } elseif (!file_exists($path) && !$append) {
113 113
             // @TODO review:
114 114
             mkdir($path, 0777, true);
115 115
         }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      */
365 365
     protected function writeMigrationClassFile()
366 366
     {
367
-        $class_name = $this->format->getMigrationName(substr($this->migration_template, 0,-4), $this->name);
367
+        $class_name = $this->format->getMigrationName(substr($this->migration_template, 0, -4), $this->name);
368 368
 
369 369
         $placeholders = array_merge(
370 370
             [
@@ -383,22 +383,22 @@  discard block
 block discarded – undo
383 383
 
384 384
         $file_contents = '';
385 385
 
386
-        $migration_template = $this->migration_templates_path . $this->migration_template;
386
+        $migration_template = $this->migration_templates_path.$this->migration_template;
387 387
         if (file_exists($migration_template)) {
388 388
             $file_contents = file_get_contents($migration_template);
389 389
         } else {
390
-            $this->out('Migration template file not found: ' . $migration_template, true);
390
+            $this->out('Migration template file not found: '.$migration_template, true);
391 391
         }
392 392
 
393 393
         foreach ($placeholders as $name => $value) {
394 394
             $file_contents = str_replace('[[+'.$name.']]', $value, $file_contents);
395 395
         }
396 396
 
397
-        $this->out($this->migrations_path . $class_name.'.php');
397
+        $this->out($this->migrations_path.$class_name.'.php');
398 398
 
399 399
         $write = false;
400
-        if (file_exists($this->migrations_path . $class_name . '.php')) {
401
-            $this->out($this->migrations_path . $class_name . '.php migration file already exists', true);
400
+        if (file_exists($this->migrations_path.$class_name.'.php')) {
401
+            $this->out($this->migrations_path.$class_name.'.php migration file already exists', true);
402 402
 
403 403
         }
404 404
         /**
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         } */
410 410
         else {
411 411
             try {
412
-                $write = file_put_contents($this->migrations_path . $class_name . '.php', $file_contents);
412
+                $write = file_put_contents($this->migrations_path.$class_name.'.php', $file_contents);
413 413
                  $this->log_data = [
414 414
                     'name' => $class_name,
415 415
                     'type' => $this->getServerType(),
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
             }
424 424
 
425 425
             if (!$write) {
426
-                $this->out($this->migrations_path . $class_name . '.php Did not write to file', true);
426
+                $this->out($this->migrations_path.$class_name.'.php Did not write to file', true);
427 427
                 $this->out('Verify that the folders exists and are writable by PHP', true);
428 428
             }
429 429
         }
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      * @param string $message
436 436
      * @param bool $error
437 437
      */
438
-    public function out($message, $error=false)
438
+    public function out($message, $error = false)
439 439
     {
440 440
         if ($error) {
441 441
             $this->userInteractionHandler->tellUser($message, userInteractionHandler::MASSAGE_ERROR);
Please login to merge, or discard this patch.
src/Helpers/Format.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      * Format constructor.
18 18
      * @param null $path_time_stamp
19 19
      */
20
-    public function __construct($path_time_stamp=null)
20
+    public function __construct($path_time_stamp = null)
21 21
     {
22 22
         if (!empty($path_time_stamp)) {
23 23
             $this->path_time_stamp = $path_time_stamp;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @param null $name
32 32
      * @return string
33 33
      */
34
-    public function getMigrationName($type, $name=null)
34
+    public function getMigrationName($type, $name = null)
35 35
     {
36 36
         $dir_name = 'm'.$this->path_time_stamp.'_';
37 37
         if (empty($name)) {
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @return string
54 54
      */
55
-    public function prettyVarExport($data, $tabs=1)
55
+    public function prettyVarExport($data, $tabs = 1)
56 56
     {
57
-        $spacing = str_repeat(' ', 4*$tabs);
57
+        $spacing = str_repeat(' ', 4 * $tabs);
58 58
 
59 59
         $string = '';
60 60
         $parts = preg_split('/\R/', var_export($data, true));
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.