@@ -410,7 +410,7 @@ |
||
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(), |
@@ -53,7 +53,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -81,7 +81,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
204 | 204 | * |
205 | 205 | * @return array ~ array of \BlendMigrations |
206 | 206 | */ |
207 | - public function getBlendMigrationCollection($reload=false, $dir='ASC', $count=0, $id=0, $name=null) |
|
207 | + public function getBlendMigrationCollection($reload = false, $dir = 'ASC', $count = 0, $id = 0, $name = null) |
|
208 | 208 | { |
209 | 209 | if (!$this->blendMigrations || $reload) { |
210 | 210 | $blendMigrations = []; |
211 | 211 | |
212 | 212 | /** @var \xPDOQuery $query */ |
213 | 213 | $query = $this->modx->newQuery($this->blend_class_object); |
214 | - if ($id > 0 ) { |
|
214 | + if ($id > 0) { |
|
215 | 215 | $query->where(['id' => $id]); |
216 | 216 | } elseif (!empty($name)) { |
217 | 217 | $query->where(['name' => $name]); |
218 | 218 | } |
219 | 219 | // @TODO need a ran sequence column to better order of down |
220 | 220 | $query->sortBy('name', $dir); |
221 | - if ($count > 0 ) { |
|
221 | + if ($count > 0) { |
|
222 | 222 | $query->limit($count); |
223 | 223 | } |
224 | 224 | $query->prepare(); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | return $this->tagger; |
243 | 243 | } |
244 | 244 | |
245 | - public function getCategoryMap($refresh=false) |
|
245 | + public function getCategoryMap($refresh = false) |
|
246 | 246 | { |
247 | 247 | if (count($this->category_map) == 0 || $refresh) { |
248 | 248 | $this->category_map = [ |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | public function getBlendableChunk($name) |
288 | 288 | { |
289 | 289 | /** @var \LCI\Blend\Blendable\Chunk $chunk */ |
290 | - $chunk = new Chunk($this->modx, $this, $name); |
|
290 | + $chunk = new Chunk($this->modx, $this, $name); |
|
291 | 291 | return $chunk->setSeedsDir($this->getSeedsDir()); |
292 | 292 | } |
293 | 293 | /** |
294 | 294 | * @param array $chunks |
295 | 295 | * @param string $seeds_dir |
296 | 296 | */ |
297 | - public function blendManyChunks($chunks=[], $seeds_dir='') |
|
297 | + public function blendManyChunks($chunks = [], $seeds_dir = '') |
|
298 | 298 | { |
299 | 299 | // will update if element does exist or create new |
300 | 300 | foreach ($chunks as $seed_key) { |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | if ($blendChunk->blendFromSeed($seed_key)) { |
307 | 307 | $this->out($seed_key.' has been blended into ID: '); |
308 | 308 | |
309 | - } elseif($blendChunk->isExists()) { |
|
309 | + } elseif ($blendChunk->isExists()) { |
|
310 | 310 | // @TODO prompt Do you want to blend Y/N/Compare |
311 | 311 | $this->out($seed_key.' chunk already exists', true); |
312 | 312 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @param array $chunks |
325 | 325 | * @param string $seeds_dir |
326 | 326 | */ |
327 | - public function revertBlendManyChunks($chunks=[], $seeds_dir='') |
|
327 | + public function revertBlendManyChunks($chunks = [], $seeds_dir = '') |
|
328 | 328 | { |
329 | 329 | // will update if system setting does exist or create new |
330 | 330 | foreach ($chunks as $seed_key) { |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $blendChunk->setSeedsDir($seeds_dir); |
335 | 335 | } |
336 | 336 | |
337 | - if ( $blendChunk->revertBlend() ) { |
|
337 | + if ($blendChunk->revertBlend()) { |
|
338 | 338 | $this->out($blendChunk->getFieldName().' chunk has been reverted to '.$seeds_dir); |
339 | 339 | |
340 | 340 | } else { |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | public function getBlendableContext($key) |
352 | 352 | { |
353 | 353 | /** @var \LCI\Blend\Blendable\Context $chunk */ |
354 | - $context = new Context($this->modx, $this, $key); |
|
354 | + $context = new Context($this->modx, $this, $key); |
|
355 | 355 | return $context->setSeedsDir($this->getSeedsDir()); |
356 | 356 | } |
357 | 357 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @param array $contexts |
360 | 360 | * @param string $seeds_dir |
361 | 361 | */ |
362 | - public function blendManyContexts($contexts=[], $seeds_dir='') |
|
362 | + public function blendManyContexts($contexts = [], $seeds_dir = '') |
|
363 | 363 | { |
364 | 364 | // will update if element does exist or create new |
365 | 365 | foreach ($contexts as $seed_key) { |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if ($blendContext->blendFromSeed($seed_key)) { |
372 | 372 | $this->out($seed_key.' has been blended '); |
373 | 373 | |
374 | - } elseif($blendContext->isExists()) { |
|
374 | + } elseif ($blendContext->isExists()) { |
|
375 | 375 | // @TODO prompt Do you want to blend Y/N/Compare |
376 | 376 | $this->out($seed_key.' chunk already exists', true); |
377 | 377 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @param array $contexts |
390 | 390 | * @param string $seeds_dir |
391 | 391 | */ |
392 | - public function revertBlendManyContexts($contexts=[], $seeds_dir='') |
|
392 | + public function revertBlendManyContexts($contexts = [], $seeds_dir = '') |
|
393 | 393 | { |
394 | 394 | // will update if system setting does exist or create new |
395 | 395 | foreach ($contexts as $seed_key) { |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $blendContext->setSeedsDir($seeds_dir); |
400 | 400 | } |
401 | 401 | |
402 | - if ( $blendContext->revertBlend() ) { |
|
402 | + if ($blendContext->revertBlend()) { |
|
403 | 403 | $this->out($blendContext->getFieldKey().' context has been reverted to '.$seeds_dir); |
404 | 404 | |
405 | 405 | } else { |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | public function getBlendableMediaSource($name) |
417 | 417 | { |
418 | 418 | /** @var \LCI\Blend\Blendable\MediaSource $mediaSource */ |
419 | - $mediaSource = new MediaSource($this->modx, $this, $name); |
|
419 | + $mediaSource = new MediaSource($this->modx, $this, $name); |
|
420 | 420 | return $mediaSource |
421 | 421 | ->setFieldName($name) |
422 | 422 | ->setSeedsDir($this->getSeedsDir()); |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * @param array $media_sources |
427 | 427 | * @param string $seeds_dir |
428 | 428 | */ |
429 | - public function blendManyMediaSources($media_sources=[], $seeds_dir='') |
|
429 | + public function blendManyMediaSources($media_sources = [], $seeds_dir = '') |
|
430 | 430 | { |
431 | 431 | // will update if element does exist or create new |
432 | 432 | foreach ($media_sources as $seed_key) { |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | if ($blendMediaSource->blendFromSeed($seed_key)) { |
439 | 439 | $this->out($seed_key.' has been blended into ID: '); |
440 | 440 | |
441 | - } elseif($blendMediaSource->isExists()) { |
|
441 | + } elseif ($blendMediaSource->isExists()) { |
|
442 | 442 | // @TODO add Compare as option |
443 | 443 | $this->out($seed_key.' media source already exists', true); |
444 | 444 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @param array $media_sources |
457 | 457 | * @param string $seeds_dir |
458 | 458 | */ |
459 | - public function revertBlendManyMediaSources($media_sources=[], $seeds_dir='') |
|
459 | + public function revertBlendManyMediaSources($media_sources = [], $seeds_dir = '') |
|
460 | 460 | { |
461 | 461 | // will update if system setting does exist or create new |
462 | 462 | foreach ($media_sources as $seed_key) { |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $blendMediaSource->setSeedsDir($seeds_dir); |
467 | 467 | } |
468 | 468 | |
469 | - if ( $blendMediaSource->revertBlend() ) { |
|
469 | + if ($blendMediaSource->revertBlend()) { |
|
470 | 470 | $this->out($blendMediaSource->getFieldName().' media source has been reverted to '.$seeds_dir); |
471 | 471 | |
472 | 472 | } else { |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | public function getBlendablePlugin($name) |
484 | 484 | { |
485 | 485 | /** @var \LCI\Blend\Blendable\Plugin $plugin */ |
486 | - $plugin = new Plugin($this->modx, $this, $name); |
|
486 | + $plugin = new Plugin($this->modx, $this, $name); |
|
487 | 487 | return $plugin->setSeedsDir($this->getSeedsDir()); |
488 | 488 | } |
489 | 489 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @param array $plugins |
492 | 492 | * @param string $seeds_dir |
493 | 493 | */ |
494 | - public function blendManyPlugins($plugins=[], $seeds_dir='') |
|
494 | + public function blendManyPlugins($plugins = [], $seeds_dir = '') |
|
495 | 495 | { |
496 | 496 | // will update if element does exist or create new |
497 | 497 | foreach ($plugins as $seed_key) { |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | if ($blendPlugin->blendFromSeed($seed_key)) { |
504 | 504 | $this->out($seed_key.' has been blended into ID: '); |
505 | 505 | |
506 | - } elseif($blendPlugin->isExists()) { |
|
506 | + } elseif ($blendPlugin->isExists()) { |
|
507 | 507 | // @TODO prompt Do you want to blend Y/N/Compare |
508 | 508 | $this->out($seed_key.' plugin already exists', true); |
509 | 509 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | * @param array $plugins |
522 | 522 | * @param string $seeds_dir |
523 | 523 | */ |
524 | - public function revertBlendManyPlugins($plugins=[], $seeds_dir='') |
|
524 | + public function revertBlendManyPlugins($plugins = [], $seeds_dir = '') |
|
525 | 525 | { |
526 | 526 | // will update if system setting does exist or create new |
527 | 527 | foreach ($plugins as $seed_key) { |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $blendPlugin->setSeedsDir($seeds_dir); |
532 | 532 | } |
533 | 533 | |
534 | - if ( $blendPlugin->revertBlend() ) { |
|
534 | + if ($blendPlugin->revertBlend()) { |
|
535 | 535 | $this->out($blendPlugin->getFieldName().' plugin has been reverted to '.$seeds_dir); |
536 | 536 | |
537 | 537 | } else { |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | public function getBlendableSnippet($name) |
549 | 549 | { |
550 | 550 | /** @var Snippet $snippet */ |
551 | - $snippet = new Snippet($this->modx, $this, $name); |
|
551 | + $snippet = new Snippet($this->modx, $this, $name); |
|
552 | 552 | return $snippet->setSeedsDir($this->getSeedsDir()); |
553 | 553 | } |
554 | 554 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * @param array $snippets |
557 | 557 | * @param string $seeds_dir |
558 | 558 | */ |
559 | - public function blendManySnippets($snippets=[], $seeds_dir='') |
|
559 | + public function blendManySnippets($snippets = [], $seeds_dir = '') |
|
560 | 560 | { |
561 | 561 | // will update if element does exist or create new |
562 | 562 | foreach ($snippets as $seed_key) { |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | if ($blendSnippet->blendFromSeed($seed_key)) { |
569 | 569 | $this->out($seed_key.' has been blended'); |
570 | 570 | |
571 | - } elseif($blendSnippet->isExists()) { |
|
571 | + } elseif ($blendSnippet->isExists()) { |
|
572 | 572 | // @TODO prompt Do you want to blend Y/N/Compare |
573 | 573 | $this->out($seed_key.' snippet already exists', true); |
574 | 574 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | * @param array $snippets |
586 | 586 | * @param string $seeds_dir |
587 | 587 | */ |
588 | - public function revertBlendManySnippets($snippets=[], $seeds_dir='') |
|
588 | + public function revertBlendManySnippets($snippets = [], $seeds_dir = '') |
|
589 | 589 | { |
590 | 590 | // will update if system setting does exist or create new |
591 | 591 | foreach ($snippets as $seed_key) { |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | $blendSnippet->setSeedsDir($seeds_dir); |
596 | 596 | } |
597 | 597 | |
598 | - if ( $blendSnippet->revertBlend() ) { |
|
598 | + if ($blendSnippet->revertBlend()) { |
|
599 | 599 | $this->out($blendSnippet->getFieldName().' snippet has been reverted to '.$seeds_dir); |
600 | 600 | |
601 | 601 | } else { |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | public function getBlendableTemplate($name) |
613 | 613 | { |
614 | 614 | /** @var \LCI\Blend\Blendable\Template $template */ |
615 | - $template = new Template($this->modx, $this, $name); |
|
615 | + $template = new Template($this->modx, $this, $name); |
|
616 | 616 | return $template->setSeedsDir($this->seeds_dir); |
617 | 617 | } |
618 | 618 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * @param string $seeds_dir |
622 | 622 | * @param bool $overwrite |
623 | 623 | */ |
624 | - public function blendManyTemplates($templates=[], $seeds_dir='', $overwrite=false) |
|
624 | + public function blendManyTemplates($templates = [], $seeds_dir = '', $overwrite = false) |
|
625 | 625 | { |
626 | 626 | // will update if template does exist or create new |
627 | 627 | foreach ($templates as $seed_key) { |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | if ($blendTemplate->blendFromSeed($seed_key, $overwrite)) { |
635 | 635 | $this->out($seed_key.' has been blended'); |
636 | 636 | |
637 | - } elseif($blendTemplate->isExists()) { |
|
637 | + } elseif ($blendTemplate->isExists()) { |
|
638 | 638 | $this->out($seed_key.' template already exists', true); |
639 | 639 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
640 | 640 | if ($blendTemplate->blendFromSeed($seed_key, true)) { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | * @param array $templates |
652 | 652 | * @param string $seeds_dir |
653 | 653 | */ |
654 | - public function revertBlendManyTemplates($templates=[], $seeds_dir='') |
|
654 | + public function revertBlendManyTemplates($templates = [], $seeds_dir = '') |
|
655 | 655 | { |
656 | 656 | // will update if system setting does exist or create new |
657 | 657 | foreach ($templates as $seed_key) { |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | $blendTemplate->setSeedsDir($seeds_dir); |
662 | 662 | } |
663 | 663 | |
664 | - if ( $blendTemplate->revertBlend() ) { |
|
664 | + if ($blendTemplate->revertBlend()) { |
|
665 | 665 | $this->out($blendTemplate->getFieldName().' template has been reverted to '.$seeds_dir); |
666 | 666 | |
667 | 667 | } else { |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | public function getBlendableTemplateVariable($name) |
679 | 679 | { |
680 | 680 | /** @var \LCI\Blend\Blendable\TemplateVariable $tv */ |
681 | - $tv = new TemplateVariable($this->modx, $this, $name); |
|
681 | + $tv = new TemplateVariable($this->modx, $this, $name); |
|
682 | 682 | return $tv->setSeedsDir($this->seeds_dir); |
683 | 683 | } |
684 | 684 | |
@@ -687,10 +687,10 @@ discard block |
||
687 | 687 | * @param string $context |
688 | 688 | * @return \LCI\Blend\Blendable\Resource |
689 | 689 | */ |
690 | - public function getBlendableResource($alias, $context='web') |
|
690 | + public function getBlendableResource($alias, $context = 'web') |
|
691 | 691 | { |
692 | 692 | /** @var \LCI\Blend\Blendable\Resource $resource */ |
693 | - $resource = new Resource($this->modx, $this, $alias, $context); |
|
693 | + $resource = new Resource($this->modx, $this, $alias, $context); |
|
694 | 694 | return $resource |
695 | 695 | ->setSeedsDir($this->getSeedsDir()); |
696 | 696 | } |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * |
702 | 702 | * @return bool |
703 | 703 | */ |
704 | - public function blendManyResources($resources=[], $seeds_dir='', $overwrite=false) |
|
704 | + public function blendManyResources($resources = [], $seeds_dir = '', $overwrite = false) |
|
705 | 705 | { |
706 | 706 | $saved = true; |
707 | 707 | // will update if resource does exist or create new |
@@ -715,19 +715,19 @@ discard block |
||
715 | 715 | } |
716 | 716 | |
717 | 717 | if ($blendResource->blendFromSeed($seed_key, $overwrite)) { |
718 | - $this->out($seed_key . ' has been blended into ID: '); |
|
718 | + $this->out($seed_key.' has been blended into ID: '); |
|
719 | 719 | |
720 | 720 | } elseif ($blendResource->isExists()) { |
721 | 721 | // @TODO prompt Do you want to blend Y/N/Compare |
722 | - $this->out($seed_key . ' already exists', true); |
|
722 | + $this->out($seed_key.' already exists', true); |
|
723 | 723 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
724 | 724 | if ($blendResource->blendFromSeed($seed_key, true)) { |
725 | - $this->out($seed_key . ' has been blended into ID: '); |
|
725 | + $this->out($seed_key.' has been blended into ID: '); |
|
726 | 726 | } |
727 | 727 | } |
728 | 728 | } else { |
729 | - $this->out('There was an error saving ' . $seed_key, true); |
|
730 | - echo 'There was an error saving ' . $seed_key; exit(); |
|
729 | + $this->out('There was an error saving '.$seed_key, true); |
|
730 | + echo 'There was an error saving '.$seed_key; exit(); |
|
731 | 731 | $saved = false; |
732 | 732 | } |
733 | 733 | } |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | * |
744 | 744 | * @return bool |
745 | 745 | */ |
746 | - public function revertBlendManyResources($resources=[], $seeds_dir='', $overwrite=false) |
|
746 | + public function revertBlendManyResources($resources = [], $seeds_dir = '', $overwrite = false) |
|
747 | 747 | { |
748 | 748 | $saved = true; |
749 | 749 | // will update if resource does exist or create new |
@@ -756,10 +756,10 @@ discard block |
||
756 | 756 | $blendResource->setSeedsDir($seeds_dir); |
757 | 757 | } |
758 | 758 | if ($blendResource->revertBlend()) { |
759 | - $this->out($seed_key . ' has been reverted '); |
|
759 | + $this->out($seed_key.' has been reverted '); |
|
760 | 760 | |
761 | 761 | } else { |
762 | - $this->out('There was an error reverting resource ' . $seed_key, true); |
|
762 | + $this->out('There was an error reverting resource '.$seed_key, true); |
|
763 | 763 | $saved = false; |
764 | 764 | } |
765 | 765 | } |
@@ -772,10 +772,10 @@ discard block |
||
772 | 772 | * @param string $key |
773 | 773 | * @return \LCI\Blend\Blendable\SystemSetting |
774 | 774 | */ |
775 | - public function getBlendableSystemSetting($key='') |
|
775 | + public function getBlendableSystemSetting($key = '') |
|
776 | 776 | { |
777 | 777 | /** @var \LCI\Blend\Blendable\SystemSetting $systemSetting */ |
778 | - $systemSetting = new SystemSetting($this->modx, $this, $key); |
|
778 | + $systemSetting = new SystemSetting($this->modx, $this, $key); |
|
779 | 779 | return $systemSetting->setSeedsDir($this->getSeedsDir()); |
780 | 780 | } |
781 | 781 | |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | * |
786 | 786 | * @return bool |
787 | 787 | */ |
788 | - public function blendManySystemSettings($settings=[], $seeds_dir='') |
|
788 | + public function blendManySystemSettings($settings = [], $seeds_dir = '') |
|
789 | 789 | { |
790 | 790 | $success = true; |
791 | 791 | // will update if system setting does exist or create new |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | * |
831 | 831 | * @return bool |
832 | 832 | */ |
833 | - public function revertBlendManySystemSettings($settings=[], $seeds_dir='') |
|
833 | + public function revertBlendManySystemSettings($settings = [], $seeds_dir = '') |
|
834 | 834 | { |
835 | 835 | $success = true; |
836 | 836 | // will update if system setting does exist or create new |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | $systemSetting->setSeedsDir($seeds_dir); |
861 | 861 | } |
862 | 862 | |
863 | - if ( $systemSetting->revertBlend() ) { |
|
863 | + if ($systemSetting->revertBlend()) { |
|
864 | 864 | $this->out($systemSetting->getFieldName().' setting has been reverted to '.$seeds_dir); |
865 | 865 | |
866 | 866 | } else { |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | * |
879 | 879 | * @return mixed |
880 | 880 | */ |
881 | - protected function prompt($question, $default='') |
|
881 | + protected function prompt($question, $default = '') |
|
882 | 882 | { |
883 | 883 | return $this->userInteractionHandler->promptInput($question, $default); |
884 | 884 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * @param bool $default |
889 | 889 | * @return bool |
890 | 890 | */ |
891 | - protected function promptConfirm($question, $default=true) |
|
891 | + protected function promptConfirm($question, $default = true) |
|
892 | 892 | { |
893 | 893 | return $this->userInteractionHandler->promptConfirm($question, $default); |
894 | 894 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...] |
900 | 900 | * @return mixed ~ selected value |
901 | 901 | */ |
902 | - protected function promptSelectOneOption($question, $default, $options=[]) |
|
902 | + protected function promptSelectOneOption($question, $default, $options = []) |
|
903 | 903 | { |
904 | 904 | return $this->userInteractionHandler->promptSelectOneOption($question, $default, $options); |
905 | 905 | } |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...] |
911 | 911 | * @return array ~ array of selected values |
912 | 912 | */ |
913 | - protected function promptSelectMultipleOptions($question, $default, $options=[]) |
|
913 | + protected function promptSelectMultipleOptions($question, $default, $options = []) |
|
914 | 914 | { |
915 | 915 | return $this->userInteractionHandler->promptSelectMultipleOptions($question, $default, $options); |
916 | 916 | } |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | * @param string $message |
920 | 920 | * @param bool $error |
921 | 921 | */ |
922 | - public function out($message, $error=false) |
|
922 | + public function out($message, $error = false) |
|
923 | 923 | { |
924 | 924 | if ($error) { |
925 | 925 | $this->userInteractionHandler->tellUser($message, userInteractionHandler::MASSAGE_ERROR); |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | * |
945 | 945 | * @return bool |
946 | 946 | */ |
947 | - public function createBlankMigrationClassFile($name, $server_type='master', $migration_path=null) |
|
947 | + public function createBlankMigrationClassFile($name, $server_type = 'master', $migration_path = null) |
|
948 | 948 | { |
949 | 949 | $migrationCreator = new MigrationsCreator($this->userInteractionHandler); |
950 | 950 | |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | * |
976 | 976 | * @return array |
977 | 977 | */ |
978 | - public function makeChunkSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
978 | + public function makeChunkSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
979 | 979 | { |
980 | 980 | $keys = []; |
981 | 981 | $collection = $this->modx->getCollection('modChunk', $criteria); |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | * |
1016 | 1016 | * @return array |
1017 | 1017 | */ |
1018 | - public function makeContextSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1018 | + public function makeContextSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1019 | 1019 | { |
1020 | 1020 | $keys = []; |
1021 | 1021 | $collection = $this->modx->getCollection('modContext', $criteria); |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | * |
1056 | 1056 | * @return array |
1057 | 1057 | */ |
1058 | - public function makeMediaSourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1058 | + public function makeMediaSourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1059 | 1059 | { |
1060 | 1060 | $keys = []; |
1061 | 1061 | $collection = $this->modx->getCollection('modMediaSource', $criteria); |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | * |
1096 | 1096 | * @return array |
1097 | 1097 | */ |
1098 | - public function makePluginSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1098 | + public function makePluginSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1099 | 1099 | { |
1100 | 1100 | $keys = []; |
1101 | 1101 | $collection = $this->modx->getCollection('modPlugin', $criteria); |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | * |
1136 | 1136 | * @return array |
1137 | 1137 | */ |
1138 | - public function makeResourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1138 | + public function makeResourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1139 | 1139 | { |
1140 | 1140 | $keys = [ |
1141 | 1141 | 'web' => [] |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | * |
1182 | 1182 | * @return array |
1183 | 1183 | */ |
1184 | - public function makeSnippetSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1184 | + public function makeSnippetSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1185 | 1185 | { |
1186 | 1186 | $keys = []; |
1187 | 1187 | $collection = $this->modx->getCollection('modSnippet', $criteria); |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | * |
1222 | 1222 | * @return array |
1223 | 1223 | */ |
1224 | - public function makeSystemSettingSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1224 | + public function makeSystemSettingSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1225 | 1225 | { |
1226 | 1226 | $collection = $this->modx->getCollection('modSystemSetting', $criteria); |
1227 | 1227 | |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | * |
1267 | 1267 | * @return array |
1268 | 1268 | */ |
1269 | - public function makeTemplateSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1269 | + public function makeTemplateSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1270 | 1270 | { |
1271 | 1271 | $keys = []; |
1272 | 1272 | $collection = $this->modx->getCollection('modTemplate', $criteria); |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | * @param string $server_type |
1304 | 1304 | * @param null|string $name |
1305 | 1305 | */ |
1306 | - public function makeSiteSeed($server_type='master', $name=null) |
|
1306 | + public function makeSiteSeed($server_type = 'master', $name = null) |
|
1307 | 1307 | { |
1308 | 1308 | $site_data = [ |
1309 | 1309 | 'mediaSources' => $this->makeMediaSourceSeeds(null, $server_type, $name, false), |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | * @param string $method |
1335 | 1335 | * @param bool $prompt |
1336 | 1336 | */ |
1337 | - public function install($method='up', $prompt=false) |
|
1337 | + public function install($method = 'up', $prompt = false) |
|
1338 | 1338 | { |
1339 | 1339 | $migration_name = 'install_blender'; |
1340 | 1340 | $custom_migration_dir = __DIR__.'/Migrations/Blend/'; |
@@ -1349,7 +1349,7 @@ discard block |
||
1349 | 1349 | * @param string $method |
1350 | 1350 | * @param bool $prompt |
1351 | 1351 | */ |
1352 | - protected function runInstallMigration($migration_name, $custom_migration_path=null, $seed_root_path=null, $method='up', $prompt=false) |
|
1352 | + protected function runInstallMigration($migration_name, $custom_migration_path = null, $seed_root_path = null, $method = 'up', $prompt = false) |
|
1353 | 1353 | { |
1354 | 1354 | // new blender for each instance |
1355 | 1355 | $config = $this->config; |
@@ -1384,10 +1384,10 @@ discard block |
||
1384 | 1384 | $migration->set('status', 'up_complete'); |
1385 | 1385 | $migration->set('created_at', date('Y-m-d H:i:s')); |
1386 | 1386 | $migration->set('processed_at', date('Y-m-d H:i:s')); |
1387 | - if ($migration->save() ) { |
|
1387 | + if ($migration->save()) { |
|
1388 | 1388 | $this->outSuccess($migration_name.' ran and logged'); |
1389 | 1389 | } else { |
1390 | - $this->out($migration_name . ' did not log correctly', true); |
|
1390 | + $this->out($migration_name.' did not log correctly', true); |
|
1391 | 1391 | } |
1392 | 1392 | |
1393 | 1393 | // does the migration directory exist? |
@@ -1402,12 +1402,12 @@ discard block |
||
1402 | 1402 | } |
1403 | 1403 | if ($create) { |
1404 | 1404 | mkdir($this->getMigrationPath(), 0700, true); |
1405 | - $this->outSuccess('Created migration directory: '. $this->getMigrationPath()); |
|
1405 | + $this->outSuccess('Created migration directory: '.$this->getMigrationPath()); |
|
1406 | 1406 | } |
1407 | 1407 | } |
1408 | 1408 | |
1409 | 1409 | } else { |
1410 | - $this->out($migration_name . ' did not log correctly', true); |
|
1410 | + $this->out($migration_name.' did not log correctly', true); |
|
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 | } elseif ($method == 'down') { |
@@ -1430,7 +1430,7 @@ discard block |
||
1430 | 1430 | /** |
1431 | 1431 | * @param string $branch |
1432 | 1432 | */ |
1433 | - public function runModxInstallGitBranchMigration($branch, $config=[]) |
|
1433 | + public function runModxInstallGitBranchMigration($branch, $config = []) |
|
1434 | 1434 | { |
1435 | 1435 | $version = ''; |
1436 | 1436 | switch ($branch) { |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | /** |
1448 | 1448 | * @param string $release |
1449 | 1449 | */ |
1450 | - public function runModxInstallGitReleaseMigration($release, $config=[]) |
|
1450 | + public function runModxInstallGitReleaseMigration($release, $config = []) |
|
1451 | 1451 | { |
1452 | 1452 | $release = str_replace(['.', '-'], '_', $release); |
1453 | 1453 | |
@@ -1460,7 +1460,7 @@ discard block |
||
1460 | 1460 | * @param string $method |
1461 | 1461 | * @param bool $prompt |
1462 | 1462 | */ |
1463 | - protected function runModxInstallMigration($migration_name= 'v3_0_0_dev_install', $method='up', $prompt=false) |
|
1463 | + protected function runModxInstallMigration($migration_name = 'v3_0_0_dev_install', $method = 'up', $prompt = false) |
|
1464 | 1464 | { |
1465 | 1465 | $custom_migration_dir = __DIR__.'/database/modx/migration/'; |
1466 | 1466 | $seeds_root_path = __DIR__.'/database/modx/seeds/'; |
@@ -1471,16 +1471,16 @@ discard block |
||
1471 | 1471 | /** |
1472 | 1472 | * @param string $version_key |
1473 | 1473 | */ |
1474 | - protected function cacheUserInstallConfig($version_key, $config=[]) |
|
1474 | + protected function cacheUserInstallConfig($version_key, $config = []) |
|
1475 | 1475 | { |
1476 | - $simpleCache = new SimpleCache(BLEND_CACHE_DIR . 'modx/'); |
|
1476 | + $simpleCache = new SimpleCache(BLEND_CACHE_DIR.'modx/'); |
|
1477 | 1477 | $simpleCache->set('install-config-'.$version_key, $config); |
1478 | 1478 | } |
1479 | 1479 | |
1480 | 1480 | /** |
1481 | 1481 | * @param string $method |
1482 | 1482 | */ |
1483 | - public function update($method='up') |
|
1483 | + public function update($method = 'up') |
|
1484 | 1484 | { |
1485 | 1485 | $current_vesion = $this->modx->getOption('blend.version'); |
1486 | 1486 | |
@@ -1491,7 +1491,7 @@ discard block |
||
1491 | 1491 | $blender = new Blender($this->modx, $this->getUserInteractionHandler(), $config); |
1492 | 1492 | |
1493 | 1493 | foreach ($this->update_migrations as $v => $migration_name) { |
1494 | - if (version_compare($v, $current_vesion) === 1 ) { |
|
1494 | + if (version_compare($v, $current_vesion) === 1) { |
|
1495 | 1495 | // 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 |
1496 | 1496 | //$blender->runMigration($method, 'master', 0, 0, $migration_name); |
1497 | 1497 | |
@@ -1516,7 +1516,7 @@ discard block |
||
1516 | 1516 | $migration->set('status', 'up_complete'); |
1517 | 1517 | $migration->set('created_at', date('Y-m-d H:i:s')); |
1518 | 1518 | $migration->set('processed_at', date('Y-m-d H:i:s')); |
1519 | - if ($migration->save() ) { |
|
1519 | + if ($migration->save()) { |
|
1520 | 1520 | $this->outSuccess('Blend updated to '.$v); |
1521 | 1521 | } else { |
1522 | 1522 | $this->out('Blend did not update to '.$v, true); |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | |
1557 | 1557 | $current_vesion = $this->modx->getOption('blend.version'); |
1558 | 1558 | // FILE version, DB Version |
1559 | - if ( $this->isBlendInstalledInModx() && ( !$current_vesion || version_compare($this->getVersion(), $current_vesion)) ) { |
|
1559 | + if ($this->isBlendInstalledInModx() && (!$current_vesion || version_compare($this->getVersion(), $current_vesion))) { |
|
1560 | 1560 | $upgrade = true; |
1561 | 1561 | } |
1562 | 1562 | |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | * @param int $id |
1602 | 1602 | * @param string $name |
1603 | 1603 | */ |
1604 | - public function runMigration($method='up', $type='master', $count=0, $id=0, $name=null) |
|
1604 | + public function runMigration($method = 'up', $type = 'master', $count = 0, $id = 0, $name = null) |
|
1605 | 1605 | { |
1606 | 1606 | $dir = 'ASC'; |
1607 | 1607 | if ($method == 'down') { |
@@ -1635,7 +1635,7 @@ discard block |
||
1635 | 1635 | /** @var string $server_type */ |
1636 | 1636 | $server_type = $migration->get('type'); |
1637 | 1637 | |
1638 | - if ( ($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete') ) { |
|
1638 | + if (($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete')) { |
|
1639 | 1639 | continue; |
1640 | 1640 | } |
1641 | 1641 | |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | if (file_exists($file)) { |
1734 | 1734 | require_once $file; |
1735 | 1735 | |
1736 | - if(class_exists($name)) { |
|
1736 | + if (class_exists($name)) { |
|
1737 | 1737 | /** @var Migrations $migrationProcessClass */ |
1738 | 1738 | $migrationProcessClass = new $name($this->modx, $blender); |
1739 | 1739 | } |
@@ -1747,7 +1747,7 @@ discard block |
||
1747 | 1747 | * @param null $name |
1748 | 1748 | * @return string |
1749 | 1749 | */ |
1750 | - public function getMigrationName($type, $name=null) |
|
1750 | + public function getMigrationName($type, $name = null) |
|
1751 | 1751 | { |
1752 | 1752 | $format = new Format($this->seeds_dir); |
1753 | 1753 | return $format->getMigrationName($type, $name); |
@@ -1765,21 +1765,21 @@ discard block |
||
1765 | 1765 | $class_name = $this->getMigrationName($type, $name); |
1766 | 1766 | |
1767 | 1767 | $removed = false; |
1768 | - $migration_file = $this->getMigrationPath() . $class_name . '.php'; |
|
1768 | + $migration_file = $this->getMigrationPath().$class_name.'.php'; |
|
1769 | 1769 | if (file_exists($migration_file)) { |
1770 | 1770 | if (unlink($migration_file)) { |
1771 | 1771 | $removed = true; |
1772 | 1772 | $migration = $this->modx->getObject($this->blend_class_object, ['name' => $class_name]); |
1773 | 1773 | if (is_object($migration) && $migration->remove()) { |
1774 | - $this->out($class_name . ' migration has been removed from the blend_migrations table'); |
|
1774 | + $this->out($class_name.' migration has been removed from the blend_migrations table'); |
|
1775 | 1775 | |
1776 | 1776 | } |
1777 | 1777 | } else { |
1778 | - $this->out($class_name . ' migration has not been removed from the blend_migrations table', true); |
|
1778 | + $this->out($class_name.' migration has not been removed from the blend_migrations table', true); |
|
1779 | 1779 | } |
1780 | 1780 | |
1781 | 1781 | } else { |
1782 | - $this->out($this->getMigrationPath() . $class_name . '.php migration could not be found to remove', true); |
|
1782 | + $this->out($this->getMigrationPath().$class_name.'.php migration could not be found to remove', true); |
|
1783 | 1783 | } |
1784 | 1784 | |
1785 | 1785 | return $removed; |
@@ -1817,7 +1817,7 @@ discard block |
||
1817 | 1817 | * |
1818 | 1818 | * @return bool|int |
1819 | 1819 | */ |
1820 | - public function getResourceIDFromSeedKey($seed_key, $context='web') |
|
1820 | + public function getResourceIDFromSeedKey($seed_key, $context = 'web') |
|
1821 | 1821 | { |
1822 | 1822 | if (!isset($this->resource_seek_key_map[$context])) { |
1823 | 1823 | $this->resource_seek_key_map[$context] = []; |
@@ -17,7 +17,7 @@ discard block |
||
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 |
||
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 |
||
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)); |