@@ -49,7 +49,7 @@ |
||
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); |
@@ -81,11 +81,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param UserInteractionHandler $userInteractionHandler |
79 | 79 | * @param array $config |
80 | 80 | */ |
81 | - public function __construct(modX $modx, UserInteractionHandler $userInteractionHandler, $config=[]) |
|
81 | + public function __construct(modX $modx, UserInteractionHandler $userInteractionHandler, $config = []) |
|
82 | 82 | { |
83 | 83 | $this->modx = $modx; |
84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $this->userInteractionHandler = $userInteractionHandler; |
88 | 88 | |
89 | - if (version_compare($this->modx_version_info['full_version'], '3.0') >= 0 ) { |
|
89 | + if (version_compare($this->modx_version_info['full_version'], '3.0') >= 0) { |
|
90 | 90 | $this->xpdo_version = 3; |
91 | 91 | $this->blend_class_object = 'LCI\\Blend\\Model\\xPDO\\BlendMigrations'; |
92 | 92 | $this->blend_package = 'LCI\\Blend\\Model\\xPDO'; |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $this->config = [ |
104 | - 'migration_templates_path' => __DIR__. '/Migrations/templates/', |
|
104 | + 'migration_templates_path' => __DIR__.'/Migrations/templates/', |
|
105 | 105 | 'migrations_path' => $blend_modx_migration_dir.'database/migrations/', |
106 | 106 | 'seeds_path' => $blend_modx_migration_dir.'database/seeds/', |
107 | - 'model_dir' => __DIR__ . ($this->xpdo_version >= 3 ? '/' : '/xpdo2/'), |
|
107 | + 'model_dir' => __DIR__.($this->xpdo_version >= 3 ? '/' : '/xpdo2/'), |
|
108 | 108 | 'extras' => [ |
109 | 109 | 'tagger' => false |
110 | 110 | ] |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->seeds_dir = date('Y_m_d_His'); |
115 | 115 | |
116 | - $tagger_path = $this->modx->getOption('tagger.core_path', null, $this->modx->getOption('core_path') . 'components/tagger/') . 'model/tagger/'; |
|
116 | + $tagger_path = $this->modx->getOption('tagger.core_path', null, $this->modx->getOption('core_path').'components/tagger/').'model/tagger/'; |
|
117 | 117 | if (is_dir($tagger_path)) { |
118 | 118 | $this->config['extras']['tagger'] = true; |
119 | 119 | /** @var \Tagger $tagger */ |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | * @param null $directory_key |
176 | 176 | * @return string |
177 | 177 | */ |
178 | - public function getSeedsPath($directory_key=null) |
|
178 | + public function getSeedsPath($directory_key = null) |
|
179 | 179 | { |
180 | 180 | $seed_path = $this->config['seeds_path']; |
181 | 181 | if (!empty($directory_key)) { |
182 | - $seed_path .= trim($directory_key, '/') . DIRECTORY_SEPARATOR; |
|
182 | + $seed_path .= trim($directory_key, '/').DIRECTORY_SEPARATOR; |
|
183 | 183 | } |
184 | 184 | return $seed_path; |
185 | 185 | } |
@@ -201,21 +201,21 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return array ~ array of \BlendMigrations |
203 | 203 | */ |
204 | - public function getBlendMigrationCollection($reload=false, $dir='ASC', $count=0, $id=0, $name=null) |
|
204 | + public function getBlendMigrationCollection($reload = false, $dir = 'ASC', $count = 0, $id = 0, $name = null) |
|
205 | 205 | { |
206 | 206 | if (!$this->blendMigrations || $reload) { |
207 | 207 | $blendMigrations = []; |
208 | 208 | |
209 | 209 | /** @var \xPDOQuery $query */ |
210 | 210 | $query = $this->modx->newQuery($this->blend_class_object); |
211 | - if ($id > 0 ) { |
|
211 | + if ($id > 0) { |
|
212 | 212 | $query->where(['id' => $id]); |
213 | 213 | } elseif (!empty($name)) { |
214 | 214 | $query->where(['name' => $name]); |
215 | 215 | } |
216 | 216 | // @TODO need a ran sequence column to better order of down |
217 | 217 | $query->sortBy('name', $dir); |
218 | - if ($count > 0 ) { |
|
218 | + if ($count > 0) { |
|
219 | 219 | $query->limit($count); |
220 | 220 | } |
221 | 221 | $query->prepare(); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | return $this->tagger; |
240 | 240 | } |
241 | 241 | |
242 | - public function getCategoryMap($refresh=false) |
|
242 | + public function getCategoryMap($refresh = false) |
|
243 | 243 | { |
244 | 244 | if (count($this->category_map) == 0 || $refresh) { |
245 | 245 | $this->category_map = [ |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | public function getBlendableChunk($name) |
285 | 285 | { |
286 | 286 | /** @var \LCI\Blend\Blendable\Chunk $chunk */ |
287 | - $chunk = new Chunk($this->modx, $this, $name); |
|
287 | + $chunk = new Chunk($this->modx, $this, $name); |
|
288 | 288 | return $chunk->setSeedsDir($this->getSeedsDir()); |
289 | 289 | } |
290 | 290 | /** |
291 | 291 | * @param array $chunks |
292 | 292 | * @param string $seeds_dir |
293 | 293 | */ |
294 | - public function blendManyChunks($chunks=[], $seeds_dir='') |
|
294 | + public function blendManyChunks($chunks = [], $seeds_dir = '') |
|
295 | 295 | { |
296 | 296 | // will update if element does exist or create new |
297 | 297 | foreach ($chunks as $seed_key) { |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | if ($blendChunk->blendFromSeed($seed_key)) { |
304 | 304 | $this->out($seed_key.' has been blended into ID: '); |
305 | 305 | |
306 | - } elseif($blendChunk->isExists()) { |
|
306 | + } elseif ($blendChunk->isExists()) { |
|
307 | 307 | // @TODO prompt Do you want to blend Y/N/Compare |
308 | 308 | $this->out($seed_key.' chunk already exists', true); |
309 | 309 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @param array $chunks |
322 | 322 | * @param string $seeds_dir |
323 | 323 | */ |
324 | - public function revertBlendManyChunks($chunks=[], $seeds_dir='') |
|
324 | + public function revertBlendManyChunks($chunks = [], $seeds_dir = '') |
|
325 | 325 | { |
326 | 326 | // will update if system setting does exist or create new |
327 | 327 | foreach ($chunks as $seed_key) { |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $blendChunk->setSeedsDir($seeds_dir); |
332 | 332 | } |
333 | 333 | |
334 | - if ( $blendChunk->revertBlend() ) { |
|
334 | + if ($blendChunk->revertBlend()) { |
|
335 | 335 | $this->out($blendChunk->getFieldName().' chunk has been reverted to '.$seeds_dir); |
336 | 336 | |
337 | 337 | } else { |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | public function getBlendableContext($key) |
349 | 349 | { |
350 | 350 | /** @var \LCI\Blend\Blendable\Context $chunk */ |
351 | - $context = new Context($this->modx, $this, $key); |
|
351 | + $context = new Context($this->modx, $this, $key); |
|
352 | 352 | return $context->setSeedsDir($this->getSeedsDir()); |
353 | 353 | } |
354 | 354 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @param array $contexts |
357 | 357 | * @param string $seeds_dir |
358 | 358 | */ |
359 | - public function blendManyContexts($contexts=[], $seeds_dir='') |
|
359 | + public function blendManyContexts($contexts = [], $seeds_dir = '') |
|
360 | 360 | { |
361 | 361 | // will update if element does exist or create new |
362 | 362 | foreach ($contexts as $seed_key) { |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | if ($blendContext->blendFromSeed($seed_key)) { |
369 | 369 | $this->out($seed_key.' has been blended '); |
370 | 370 | |
371 | - } elseif($blendContext->isExists()) { |
|
371 | + } elseif ($blendContext->isExists()) { |
|
372 | 372 | // @TODO prompt Do you want to blend Y/N/Compare |
373 | 373 | $this->out($seed_key.' chunk already exists', true); |
374 | 374 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | * @param array $contexts |
387 | 387 | * @param string $seeds_dir |
388 | 388 | */ |
389 | - public function revertBlendManyContexts($contexts=[], $seeds_dir='') |
|
389 | + public function revertBlendManyContexts($contexts = [], $seeds_dir = '') |
|
390 | 390 | { |
391 | 391 | // will update if system setting does exist or create new |
392 | 392 | foreach ($contexts as $seed_key) { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | $blendContext->setSeedsDir($seeds_dir); |
397 | 397 | } |
398 | 398 | |
399 | - if ( $blendContext->revertBlend() ) { |
|
399 | + if ($blendContext->revertBlend()) { |
|
400 | 400 | $this->out($blendContext->getFieldKey().' context has been reverted to '.$seeds_dir); |
401 | 401 | |
402 | 402 | } else { |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | public function getBlendableMediaSource($name) |
414 | 414 | { |
415 | 415 | /** @var \LCI\Blend\Blendable\MediaSource $mediaSource */ |
416 | - $mediaSource = new MediaSource($this->modx, $this, $name); |
|
416 | + $mediaSource = new MediaSource($this->modx, $this, $name); |
|
417 | 417 | return $mediaSource |
418 | 418 | ->setFieldName($name) |
419 | 419 | ->setSeedsDir($this->getSeedsDir()); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * @param array $media_sources |
424 | 424 | * @param string $seeds_dir |
425 | 425 | */ |
426 | - public function blendManyMediaSources($media_sources=[], $seeds_dir='') |
|
426 | + public function blendManyMediaSources($media_sources = [], $seeds_dir = '') |
|
427 | 427 | { |
428 | 428 | // will update if element does exist or create new |
429 | 429 | foreach ($media_sources as $seed_key) { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | if ($blendMediaSource->blendFromSeed($seed_key)) { |
436 | 436 | $this->out($seed_key.' has been blended into ID: '); |
437 | 437 | |
438 | - } elseif($blendMediaSource->isExists()) { |
|
438 | + } elseif ($blendMediaSource->isExists()) { |
|
439 | 439 | // @TODO add Compare as option |
440 | 440 | $this->out($seed_key.' media source already exists', true); |
441 | 441 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @param array $media_sources |
454 | 454 | * @param string $seeds_dir |
455 | 455 | */ |
456 | - public function revertBlendManyMediaSources($media_sources=[], $seeds_dir='') |
|
456 | + public function revertBlendManyMediaSources($media_sources = [], $seeds_dir = '') |
|
457 | 457 | { |
458 | 458 | // will update if system setting does exist or create new |
459 | 459 | foreach ($media_sources as $seed_key) { |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | $blendMediaSource->setSeedsDir($seeds_dir); |
464 | 464 | } |
465 | 465 | |
466 | - if ( $blendMediaSource->revertBlend() ) { |
|
466 | + if ($blendMediaSource->revertBlend()) { |
|
467 | 467 | $this->out($blendMediaSource->getFieldName().' media source has been reverted to '.$seeds_dir); |
468 | 468 | |
469 | 469 | } else { |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | public function getBlendablePlugin($name) |
481 | 481 | { |
482 | 482 | /** @var \LCI\Blend\Blendable\Plugin $plugin */ |
483 | - $plugin = new Plugin($this->modx, $this, $name); |
|
483 | + $plugin = new Plugin($this->modx, $this, $name); |
|
484 | 484 | return $plugin->setSeedsDir($this->getSeedsDir()); |
485 | 485 | } |
486 | 486 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @param array $plugins |
489 | 489 | * @param string $seeds_dir |
490 | 490 | */ |
491 | - public function blendManyPlugins($plugins=[], $seeds_dir='') |
|
491 | + public function blendManyPlugins($plugins = [], $seeds_dir = '') |
|
492 | 492 | { |
493 | 493 | // will update if element does exist or create new |
494 | 494 | foreach ($plugins as $seed_key) { |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | if ($blendPlugin->blendFromSeed($seed_key)) { |
501 | 501 | $this->out($seed_key.' has been blended into ID: '); |
502 | 502 | |
503 | - } elseif($blendPlugin->isExists()) { |
|
503 | + } elseif ($blendPlugin->isExists()) { |
|
504 | 504 | // @TODO prompt Do you want to blend Y/N/Compare |
505 | 505 | $this->out($seed_key.' plugin already exists', true); |
506 | 506 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * @param array $plugins |
519 | 519 | * @param string $seeds_dir |
520 | 520 | */ |
521 | - public function revertBlendManyPlugins($plugins=[], $seeds_dir='') |
|
521 | + public function revertBlendManyPlugins($plugins = [], $seeds_dir = '') |
|
522 | 522 | { |
523 | 523 | // will update if system setting does exist or create new |
524 | 524 | foreach ($plugins as $seed_key) { |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | $blendPlugin->setSeedsDir($seeds_dir); |
529 | 529 | } |
530 | 530 | |
531 | - if ( $blendPlugin->revertBlend() ) { |
|
531 | + if ($blendPlugin->revertBlend()) { |
|
532 | 532 | $this->out($blendPlugin->getFieldName().' plugin has been reverted to '.$seeds_dir); |
533 | 533 | |
534 | 534 | } else { |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | public function getBlendableSnippet($name) |
546 | 546 | { |
547 | 547 | /** @var Snippet $snippet */ |
548 | - $snippet = new Snippet($this->modx, $this, $name); |
|
548 | + $snippet = new Snippet($this->modx, $this, $name); |
|
549 | 549 | return $snippet->setSeedsDir($this->getSeedsDir()); |
550 | 550 | } |
551 | 551 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * @param array $snippets |
554 | 554 | * @param string $seeds_dir |
555 | 555 | */ |
556 | - public function blendManySnippets($snippets=[], $seeds_dir='') |
|
556 | + public function blendManySnippets($snippets = [], $seeds_dir = '') |
|
557 | 557 | { |
558 | 558 | // will update if element does exist or create new |
559 | 559 | foreach ($snippets as $seed_key) { |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | if ($blendSnippet->blendFromSeed($seed_key)) { |
566 | 566 | $this->out($seed_key.' has been blended'); |
567 | 567 | |
568 | - } elseif($blendSnippet->isExists()) { |
|
568 | + } elseif ($blendSnippet->isExists()) { |
|
569 | 569 | // @TODO prompt Do you want to blend Y/N/Compare |
570 | 570 | $this->out($seed_key.' snippet already exists', true); |
571 | 571 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | * @param array $snippets |
583 | 583 | * @param string $seeds_dir |
584 | 584 | */ |
585 | - public function revertBlendManySnippets($snippets=[], $seeds_dir='') |
|
585 | + public function revertBlendManySnippets($snippets = [], $seeds_dir = '') |
|
586 | 586 | { |
587 | 587 | // will update if system setting does exist or create new |
588 | 588 | foreach ($snippets as $seed_key) { |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | $blendSnippet->setSeedsDir($seeds_dir); |
593 | 593 | } |
594 | 594 | |
595 | - if ( $blendSnippet->revertBlend() ) { |
|
595 | + if ($blendSnippet->revertBlend()) { |
|
596 | 596 | $this->out($blendSnippet->getFieldName().' snippet has been reverted to '.$seeds_dir); |
597 | 597 | |
598 | 598 | } else { |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | public function getBlendableTemplate($name) |
610 | 610 | { |
611 | 611 | /** @var \LCI\Blend\Blendable\Template $template */ |
612 | - $template = new Template($this->modx, $this, $name); |
|
612 | + $template = new Template($this->modx, $this, $name); |
|
613 | 613 | return $template->setSeedsDir($this->seeds_dir); |
614 | 614 | } |
615 | 615 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * @param string $seeds_dir |
619 | 619 | * @param bool $overwrite |
620 | 620 | */ |
621 | - public function blendManyTemplates($templates=[], $seeds_dir='', $overwrite=false) |
|
621 | + public function blendManyTemplates($templates = [], $seeds_dir = '', $overwrite = false) |
|
622 | 622 | { |
623 | 623 | // will update if template does exist or create new |
624 | 624 | foreach ($templates as $seed_key) { |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | if ($blendTemplate->blendFromSeed($seed_key, $overwrite)) { |
632 | 632 | $this->out($seed_key.' has been blended'); |
633 | 633 | |
634 | - } elseif($blendTemplate->isExists()) { |
|
634 | + } elseif ($blendTemplate->isExists()) { |
|
635 | 635 | $this->out($seed_key.' template already exists', true); |
636 | 636 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
637 | 637 | if ($blendTemplate->blendFromSeed($seed_key, true)) { |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | * @param array $templates |
649 | 649 | * @param string $seeds_dir |
650 | 650 | */ |
651 | - public function revertBlendManyTemplates($templates=[], $seeds_dir='') |
|
651 | + public function revertBlendManyTemplates($templates = [], $seeds_dir = '') |
|
652 | 652 | { |
653 | 653 | // will update if system setting does exist or create new |
654 | 654 | foreach ($templates as $seed_key) { |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $blendTemplate->setSeedsDir($seeds_dir); |
659 | 659 | } |
660 | 660 | |
661 | - if ( $blendTemplate->revertBlend() ) { |
|
661 | + if ($blendTemplate->revertBlend()) { |
|
662 | 662 | $this->out($blendTemplate->getFieldName().' template has been reverted to '.$seeds_dir); |
663 | 663 | |
664 | 664 | } else { |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | public function getBlendableTemplateVariable($name) |
676 | 676 | { |
677 | 677 | /** @var \LCI\Blend\Blendable\TemplateVariable $tv */ |
678 | - $tv = new TemplateVariable($this->modx, $this, $name); |
|
678 | + $tv = new TemplateVariable($this->modx, $this, $name); |
|
679 | 679 | return $tv->setSeedsDir($this->seeds_dir); |
680 | 680 | } |
681 | 681 | |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | * @param string $context |
685 | 685 | * @return \LCI\Blend\Blendable\Resource |
686 | 686 | */ |
687 | - public function getBlendableResource($alias, $context='web') |
|
687 | + public function getBlendableResource($alias, $context = 'web') |
|
688 | 688 | { |
689 | 689 | /** @var \LCI\Blend\Blendable\Resource $resource */ |
690 | - $resource = new Resource($this->modx, $this, $alias, $context); |
|
690 | + $resource = new Resource($this->modx, $this, $alias, $context); |
|
691 | 691 | return $resource |
692 | 692 | ->setSeedsDir($this->getSeedsDir()); |
693 | 693 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | * |
699 | 699 | * @return bool |
700 | 700 | */ |
701 | - public function blendManyResources($resources=[], $seeds_dir='', $overwrite=false) |
|
701 | + public function blendManyResources($resources = [], $seeds_dir = '', $overwrite = false) |
|
702 | 702 | { |
703 | 703 | $saved = true; |
704 | 704 | // will update if resource does exist or create new |
@@ -712,19 +712,19 @@ discard block |
||
712 | 712 | } |
713 | 713 | |
714 | 714 | if ($blendResource->blendFromSeed($seed_key, $overwrite)) { |
715 | - $this->out($seed_key . ' has been blended into ID: '); |
|
715 | + $this->out($seed_key.' has been blended into ID: '); |
|
716 | 716 | |
717 | 717 | } elseif ($blendResource->isExists()) { |
718 | 718 | // @TODO prompt Do you want to blend Y/N/Compare |
719 | - $this->out($seed_key . ' already exists', true); |
|
719 | + $this->out($seed_key.' already exists', true); |
|
720 | 720 | if ($this->prompt('Would you like to update?', 'Y') === 'Y') { |
721 | 721 | if ($blendResource->blendFromSeed($seed_key, true)) { |
722 | - $this->out($seed_key . ' has been blended into ID: '); |
|
722 | + $this->out($seed_key.' has been blended into ID: '); |
|
723 | 723 | } |
724 | 724 | } |
725 | 725 | } else { |
726 | - $this->out('There was an error saving ' . $seed_key, true); |
|
727 | - echo 'There was an error saving ' . $seed_key; exit(); |
|
726 | + $this->out('There was an error saving '.$seed_key, true); |
|
727 | + echo 'There was an error saving '.$seed_key; exit(); |
|
728 | 728 | $saved = false; |
729 | 729 | } |
730 | 730 | } |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | * |
741 | 741 | * @return bool |
742 | 742 | */ |
743 | - public function revertBlendManyResources($resources=[], $seeds_dir='', $overwrite=false) |
|
743 | + public function revertBlendManyResources($resources = [], $seeds_dir = '', $overwrite = false) |
|
744 | 744 | { |
745 | 745 | $saved = true; |
746 | 746 | // will update if resource does exist or create new |
@@ -753,10 +753,10 @@ discard block |
||
753 | 753 | $blendResource->setSeedsDir($seeds_dir); |
754 | 754 | } |
755 | 755 | if ($blendResource->revertBlend()) { |
756 | - $this->out($seed_key . ' has been reverted '); |
|
756 | + $this->out($seed_key.' has been reverted '); |
|
757 | 757 | |
758 | 758 | } else { |
759 | - $this->out('There was an error reverting resource ' . $seed_key, true); |
|
759 | + $this->out('There was an error reverting resource '.$seed_key, true); |
|
760 | 760 | $saved = false; |
761 | 761 | } |
762 | 762 | } |
@@ -769,10 +769,10 @@ discard block |
||
769 | 769 | * @param string $key |
770 | 770 | * @return \LCI\Blend\Blendable\SystemSetting |
771 | 771 | */ |
772 | - public function getBlendableSystemSetting($key='') |
|
772 | + public function getBlendableSystemSetting($key = '') |
|
773 | 773 | { |
774 | 774 | /** @var \LCI\Blend\Blendable\SystemSetting $systemSetting */ |
775 | - $systemSetting = new SystemSetting($this->modx, $this, $key); |
|
775 | + $systemSetting = new SystemSetting($this->modx, $this, $key); |
|
776 | 776 | return $systemSetting->setSeedsDir($this->getSeedsDir()); |
777 | 777 | } |
778 | 778 | |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | * |
783 | 783 | * @return bool |
784 | 784 | */ |
785 | - public function blendManySystemSettings($settings=[], $seeds_dir='') |
|
785 | + public function blendManySystemSettings($settings = [], $seeds_dir = '') |
|
786 | 786 | { |
787 | 787 | $success = true; |
788 | 788 | // will update if system setting does exist or create new |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | * |
828 | 828 | * @return bool |
829 | 829 | */ |
830 | - public function revertBlendManySystemSettings($settings=[], $seeds_dir='') |
|
830 | + public function revertBlendManySystemSettings($settings = [], $seeds_dir = '') |
|
831 | 831 | { |
832 | 832 | $success = true; |
833 | 833 | // will update if system setting does exist or create new |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | $systemSetting->setSeedsDir($seeds_dir); |
858 | 858 | } |
859 | 859 | |
860 | - if ( $systemSetting->revertBlend() ) { |
|
860 | + if ($systemSetting->revertBlend()) { |
|
861 | 861 | $this->out($systemSetting->getFieldName().' setting has been reverted to '.$seeds_dir); |
862 | 862 | |
863 | 863 | } else { |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | * |
876 | 876 | * @return mixed |
877 | 877 | */ |
878 | - protected function prompt($question, $default='') |
|
878 | + protected function prompt($question, $default = '') |
|
879 | 879 | { |
880 | 880 | return $this->userInteractionHandler->promptInput($question, $default); |
881 | 881 | } |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | * @param bool $default |
886 | 886 | * @return bool |
887 | 887 | */ |
888 | - protected function promptConfirm($question, $default=true) |
|
888 | + protected function promptConfirm($question, $default = true) |
|
889 | 889 | { |
890 | 890 | return $this->userInteractionHandler->promptConfirm($question, $default); |
891 | 891 | } |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...] |
897 | 897 | * @return mixed ~ selected value |
898 | 898 | */ |
899 | - protected function promptSelectOneOption($question, $default, $options=[]) |
|
899 | + protected function promptSelectOneOption($question, $default, $options = []) |
|
900 | 900 | { |
901 | 901 | return $this->userInteractionHandler->promptSelectOneOption($question, $default, $options); |
902 | 902 | } |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | * @param array $options ~ ex: ['Option1' => 'value', 'Option2' => 'value2', ...] |
908 | 908 | * @return array ~ array of selected values |
909 | 909 | */ |
910 | - protected function promptSelectMultipleOptions($question, $default, $options=[]) |
|
910 | + protected function promptSelectMultipleOptions($question, $default, $options = []) |
|
911 | 911 | { |
912 | 912 | return $this->userInteractionHandler->promptSelectMultipleOptions($question, $default, $options); |
913 | 913 | } |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | * @param string $message |
917 | 917 | * @param bool $error |
918 | 918 | */ |
919 | - public function out($message, $error=false) |
|
919 | + public function out($message, $error = false) |
|
920 | 920 | { |
921 | 921 | if ($error) { |
922 | 922 | $this->userInteractionHandler->tellUser($message, userInteractionHandler::MASSAGE_ERROR); |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return bool |
942 | 942 | */ |
943 | - public function createBlankMigrationClassFile($name, $server_type='master') |
|
943 | + public function createBlankMigrationClassFile($name, $server_type = 'master') |
|
944 | 944 | { |
945 | 945 | return $this->writeMigrationClassFile('blank', [], $server_type, $name); |
946 | 946 | } |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | * |
954 | 954 | * @return array |
955 | 955 | */ |
956 | - public function makeChunkSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
956 | + public function makeChunkSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
957 | 957 | { |
958 | 958 | $keys = []; |
959 | 959 | $collection = $this->modx->getCollection('modChunk', $criteria); |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | * |
983 | 983 | * @return array |
984 | 984 | */ |
985 | - public function makeContextSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
985 | + public function makeContextSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
986 | 986 | { |
987 | 987 | $keys = []; |
988 | 988 | $collection = $this->modx->getCollection('modContext', $criteria); |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | * |
1012 | 1012 | * @return array |
1013 | 1013 | */ |
1014 | - public function makeMediaSourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1014 | + public function makeMediaSourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1015 | 1015 | { |
1016 | 1016 | $keys = []; |
1017 | 1017 | $collection = $this->modx->getCollection('modMediaSource', $criteria); |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | * |
1041 | 1041 | * @return array |
1042 | 1042 | */ |
1043 | - public function makePluginSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1043 | + public function makePluginSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1044 | 1044 | { |
1045 | 1045 | $keys = []; |
1046 | 1046 | $collection = $this->modx->getCollection('modPlugin', $criteria); |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | * |
1070 | 1070 | * @return array |
1071 | 1071 | */ |
1072 | - public function makeResourceSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1072 | + public function makeResourceSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1073 | 1073 | { |
1074 | 1074 | $keys = [ |
1075 | 1075 | 'web' => [] |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | * |
1105 | 1105 | * @return array |
1106 | 1106 | */ |
1107 | - public function makeSnippetSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1107 | + public function makeSnippetSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1108 | 1108 | { |
1109 | 1109 | $keys = []; |
1110 | 1110 | $collection = $this->modx->getCollection('modSnippet', $criteria); |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | * |
1134 | 1134 | * @return array |
1135 | 1135 | */ |
1136 | - public function makeSystemSettingSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1136 | + public function makeSystemSettingSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1137 | 1137 | { |
1138 | 1138 | $collection = $this->modx->getCollection('modSystemSetting', $criteria); |
1139 | 1139 | |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | * |
1167 | 1167 | * @return array |
1168 | 1168 | */ |
1169 | - public function makeTemplateSeeds($criteria, $server_type='master', $name=null, $create_migration_file=true) |
|
1169 | + public function makeTemplateSeeds($criteria, $server_type = 'master', $name = null, $create_migration_file = true) |
|
1170 | 1170 | { |
1171 | 1171 | $keys = []; |
1172 | 1172 | $collection = $this->modx->getCollection('modTemplate', $criteria); |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | * @param string $server_type |
1192 | 1192 | * @param null|string $name |
1193 | 1193 | */ |
1194 | - public function makeSiteSeed($server_type='master', $name=null) |
|
1194 | + public function makeSiteSeed($server_type = 'master', $name = null) |
|
1195 | 1195 | { |
1196 | 1196 | $site_data = [ |
1197 | 1197 | 'mediaSources' => $this->makeMediaSourceSeeds(null, $server_type, $name, false), |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | * @param string $method |
1212 | 1212 | * @param bool $prompt |
1213 | 1213 | */ |
1214 | - public function install($method='up', $prompt=false) |
|
1214 | + public function install($method = 'up', $prompt = false) |
|
1215 | 1215 | { |
1216 | 1216 | $migration_name = 'install_blender'; |
1217 | 1217 | $custom_migration_dir = __DIR__.'/Migrations/Blend/'; |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | * @param string $method |
1227 | 1227 | * @param bool $prompt |
1228 | 1228 | */ |
1229 | - protected function runInstallMigration($migration_name, $custom_migration_path=null, $seed_root_path=null, $method='up', $prompt=false) |
|
1229 | + protected function runInstallMigration($migration_name, $custom_migration_path = null, $seed_root_path = null, $method = 'up', $prompt = false) |
|
1230 | 1230 | { |
1231 | 1231 | // new blender for each instance |
1232 | 1232 | $config = $this->config; |
@@ -1261,10 +1261,10 @@ discard block |
||
1261 | 1261 | $migration->set('status', 'up_complete'); |
1262 | 1262 | $migration->set('created_at', date('Y-m-d H:i:s')); |
1263 | 1263 | $migration->set('processed_at', date('Y-m-d H:i:s')); |
1264 | - if ($migration->save() ) { |
|
1264 | + if ($migration->save()) { |
|
1265 | 1265 | $this->outSuccess($migration_name.' ran and logged'); |
1266 | 1266 | } else { |
1267 | - $this->out($migration_name . ' did not log correctly', true); |
|
1267 | + $this->out($migration_name.' did not log correctly', true); |
|
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | // does the migration directory exist? |
@@ -1279,12 +1279,12 @@ discard block |
||
1279 | 1279 | } |
1280 | 1280 | if ($create) { |
1281 | 1281 | mkdir($this->getMigrationPath(), 0700, true); |
1282 | - $this->outSuccess('Created migration directory: '. $this->getMigrationPath()); |
|
1282 | + $this->outSuccess('Created migration directory: '.$this->getMigrationPath()); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | } else { |
1287 | - $this->out($migration_name . ' did not log correctly', true); |
|
1287 | + $this->out($migration_name.' did not log correctly', true); |
|
1288 | 1288 | } |
1289 | 1289 | |
1290 | 1290 | } elseif ($method == 'down') { |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | /** |
1308 | 1308 | * @param string $branch |
1309 | 1309 | */ |
1310 | - public function runModxInstallGitBranchMigration($branch, $config=[]) |
|
1310 | + public function runModxInstallGitBranchMigration($branch, $config = []) |
|
1311 | 1311 | { |
1312 | 1312 | $version = ''; |
1313 | 1313 | switch ($branch) { |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | /** |
1325 | 1325 | * @param string $release |
1326 | 1326 | */ |
1327 | - public function runModxInstallGitReleaseMigration($release, $config=[]) |
|
1327 | + public function runModxInstallGitReleaseMigration($release, $config = []) |
|
1328 | 1328 | { |
1329 | 1329 | $release = str_replace(['.', '-'], '_', $release); |
1330 | 1330 | |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | * @param string $method |
1338 | 1338 | * @param bool $prompt |
1339 | 1339 | */ |
1340 | - protected function runModxInstallMigration($migration_name= 'v3_0_0_dev_install', $method='up', $prompt=false) |
|
1340 | + protected function runModxInstallMigration($migration_name = 'v3_0_0_dev_install', $method = 'up', $prompt = false) |
|
1341 | 1341 | { |
1342 | 1342 | $custom_migration_dir = __DIR__.'/database/modx/migration/'; |
1343 | 1343 | $seeds_root_path = __DIR__.'/database/modx/seeds/'; |
@@ -1348,16 +1348,16 @@ discard block |
||
1348 | 1348 | /** |
1349 | 1349 | * @param string $version_key |
1350 | 1350 | */ |
1351 | - protected function cacheUserInstallConfig($version_key, $config=[]) |
|
1351 | + protected function cacheUserInstallConfig($version_key, $config = []) |
|
1352 | 1352 | { |
1353 | - $simpleCache = new SimpleCache(BLEND_CACHE_DIR . 'modx/'); |
|
1353 | + $simpleCache = new SimpleCache(BLEND_CACHE_DIR.'modx/'); |
|
1354 | 1354 | $simpleCache->set('install-config-'.$version_key, $config); |
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | /** |
1358 | 1358 | * @param string $method |
1359 | 1359 | */ |
1360 | - public function update($method='up') |
|
1360 | + public function update($method = 'up') |
|
1361 | 1361 | { |
1362 | 1362 | $current_vesion = $this->modx->getOption('blend.version'); |
1363 | 1363 | |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | $blender = new Blender($this->modx, $this->getUserInteractionHandler(), $config); |
1369 | 1369 | |
1370 | 1370 | foreach ($this->update_migrations as $v => $migration_name) { |
1371 | - if (version_compare($v, $current_vesion) === 1 ) { |
|
1371 | + if (version_compare($v, $current_vesion) === 1) { |
|
1372 | 1372 | // 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 |
1373 | 1373 | //$blender->runMigration($method, 'master', 0, 0, $migration_name); |
1374 | 1374 | |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | $migration->set('status', 'up_complete'); |
1394 | 1394 | $migration->set('created_at', date('Y-m-d H:i:s')); |
1395 | 1395 | $migration->set('processed_at', date('Y-m-d H:i:s')); |
1396 | - if ($migration->save() ) { |
|
1396 | + if ($migration->save()) { |
|
1397 | 1397 | $this->outSuccess('Blend updated to '.$v); |
1398 | 1398 | } else { |
1399 | 1399 | $this->out('Blend did not update to '.$v, true); |
@@ -1433,7 +1433,7 @@ discard block |
||
1433 | 1433 | |
1434 | 1434 | $current_vesion = $this->modx->getOption('blend.version'); |
1435 | 1435 | // FILE version, DB Version |
1436 | - if ( $this->isBlendInstalledInModx() && ( !$current_vesion || version_compare($this->getVersion(), $current_vesion)) ) { |
|
1436 | + if ($this->isBlendInstalledInModx() && (!$current_vesion || version_compare($this->getVersion(), $current_vesion))) { |
|
1437 | 1437 | $upgrade = true; |
1438 | 1438 | } |
1439 | 1439 | |
@@ -1478,7 +1478,7 @@ discard block |
||
1478 | 1478 | * @param int $id |
1479 | 1479 | * @param string $name |
1480 | 1480 | */ |
1481 | - public function runMigration($method='up', $type='master', $count=0, $id=0, $name=null) |
|
1481 | + public function runMigration($method = 'up', $type = 'master', $count = 0, $id = 0, $name = null) |
|
1482 | 1482 | { |
1483 | 1483 | $dir = 'ASC'; |
1484 | 1484 | if ($method == 'down') { |
@@ -1512,7 +1512,7 @@ discard block |
||
1512 | 1512 | /** @var string $server_type */ |
1513 | 1513 | $server_type = $migration->get('type'); |
1514 | 1514 | |
1515 | - if ( ($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete') ) { |
|
1515 | + if (($server_type != $type) || ($method == 'up' && $status == 'up_complete') || ($method == 'down' && $status != 'up_complete')) { |
|
1516 | 1516 | continue; |
1517 | 1517 | } |
1518 | 1518 | |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | if (file_exists($file)) { |
1611 | 1611 | require_once $file; |
1612 | 1612 | |
1613 | - if(class_exists($name)) { |
|
1613 | + if (class_exists($name)) { |
|
1614 | 1614 | /** @var Migrations $migrationProcessClass */ |
1615 | 1615 | $migrationProcessClass = new $name($this->modx, $blender); |
1616 | 1616 | } |
@@ -1624,7 +1624,7 @@ discard block |
||
1624 | 1624 | * @param null $name |
1625 | 1625 | * @return string |
1626 | 1626 | */ |
1627 | - public function getMigrationName($type, $name=null) |
|
1627 | + public function getMigrationName($type, $name = null) |
|
1628 | 1628 | { |
1629 | 1629 | $dir_name = 'm'.$this->seeds_dir.'_'; |
1630 | 1630 | if (empty($name)) { |
@@ -1648,7 +1648,7 @@ discard block |
||
1648 | 1648 | * |
1649 | 1649 | * @return bool |
1650 | 1650 | */ |
1651 | - protected function writeMigrationClassFile($type, $class_data=[], $server_type='master', $name=null, $log=true) |
|
1651 | + protected function writeMigrationClassFile($type, $class_data = [], $server_type = 'master', $name = null, $log = true) |
|
1652 | 1652 | { |
1653 | 1653 | $class_name = $this->getMigrationName($type, $name); |
1654 | 1654 | |
@@ -1743,19 +1743,19 @@ discard block |
||
1743 | 1743 | |
1744 | 1744 | $write = false; |
1745 | 1745 | if (file_exists($this->getMigrationPath().$class_name.'.php')) { |
1746 | - $this->out($this->getMigrationPath() . $class_name . '.php migration file already exists', true); |
|
1746 | + $this->out($this->getMigrationPath().$class_name.'.php migration file already exists', true); |
|
1747 | 1747 | |
1748 | 1748 | } elseif (is_object($this->modx->getObject($this->blend_class_object, ['name' => $class_name]))) { |
1749 | - $this->out($class_name . ' migration already has been created in the blend_migrations table', true); |
|
1749 | + $this->out($class_name.' migration already has been created in the blend_migrations table', true); |
|
1750 | 1750 | |
1751 | 1751 | } else { |
1752 | 1752 | try { |
1753 | - $write = file_put_contents($this->getMigrationPath() . $class_name . '.php', $file_contents); |
|
1753 | + $write = file_put_contents($this->getMigrationPath().$class_name.'.php', $file_contents); |
|
1754 | 1754 | $migration = $this->modx->newObject($this->blend_class_object); |
1755 | 1755 | if ($migration && $log) { |
1756 | 1756 | $migration->set('name', $class_name); |
1757 | 1757 | $migration->set('type', 'master'); |
1758 | - $migration->set('description', '');// @TODO |
|
1758 | + $migration->set('description', ''); // @TODO |
|
1759 | 1759 | $migration->set('version', ''); |
1760 | 1760 | $migration->set('status', 'seed export'); |
1761 | 1761 | $migration->set('created_at', date('Y-m-d H:i:s')); |
@@ -1765,7 +1765,7 @@ discard block |
||
1765 | 1765 | $this->out($exception->getMessage(), true); |
1766 | 1766 | } |
1767 | 1767 | if (!$write) { |
1768 | - $this->out($this->getMigrationPath() . $class_name . '.php Did not write to file', true); |
|
1768 | + $this->out($this->getMigrationPath().$class_name.'.php Did not write to file', true); |
|
1769 | 1769 | $this->out('Verify that the folders exists and are writable by PHP', true); |
1770 | 1770 | } |
1771 | 1771 | } |
@@ -1785,21 +1785,21 @@ discard block |
||
1785 | 1785 | $class_name = $this->getMigrationName($type, $name); |
1786 | 1786 | |
1787 | 1787 | $removed = false; |
1788 | - $migration_file = $this->getMigrationPath() . $class_name . '.php'; |
|
1788 | + $migration_file = $this->getMigrationPath().$class_name.'.php'; |
|
1789 | 1789 | if (file_exists($migration_file)) { |
1790 | 1790 | if (unlink($migration_file)) { |
1791 | 1791 | $removed = true; |
1792 | 1792 | $migration = $this->modx->getObject($this->blend_class_object, ['name' => $class_name]); |
1793 | 1793 | if (is_object($migration) && $migration->remove()) { |
1794 | - $this->out($class_name . ' migration has been removed from the blend_migrations table'); |
|
1794 | + $this->out($class_name.' migration has been removed from the blend_migrations table'); |
|
1795 | 1795 | |
1796 | 1796 | } |
1797 | 1797 | } else { |
1798 | - $this->out($class_name . ' migration has not been removed from the blend_migrations table', true); |
|
1798 | + $this->out($class_name.' migration has not been removed from the blend_migrations table', true); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | } else { |
1802 | - $this->out($this->getMigrationPath() . $class_name . '.php migration could not be found to remove', true); |
|
1802 | + $this->out($this->getMigrationPath().$class_name.'.php migration could not be found to remove', true); |
|
1803 | 1803 | } |
1804 | 1804 | |
1805 | 1805 | return $removed; |
@@ -1837,7 +1837,7 @@ discard block |
||
1837 | 1837 | * |
1838 | 1838 | * @return bool|int |
1839 | 1839 | */ |
1840 | - public function getResourceIDFromSeedKey($seed_key, $context='web') |
|
1840 | + public function getResourceIDFromSeedKey($seed_key, $context = 'web') |
|
1841 | 1841 | { |
1842 | 1842 | if (!isset($this->resource_seek_key_map[$context])) { |
1843 | 1843 | $this->resource_seek_key_map[$context] = []; |
@@ -1916,9 +1916,9 @@ discard block |
||
1916 | 1916 | * |
1917 | 1917 | * @return string |
1918 | 1918 | */ |
1919 | - protected function prettyVarExport($data, $tabs=1) |
|
1919 | + protected function prettyVarExport($data, $tabs = 1) |
|
1920 | 1920 | { |
1921 | - $spacing = str_repeat(' ', 4*$tabs); |
|
1921 | + $spacing = str_repeat(' ', 4 * $tabs); |
|
1922 | 1922 | |
1923 | 1923 | $string = ''; |
1924 | 1924 | $parts = preg_split('/\R/', var_export($data, true)); |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | public function loadModxInstall() |
63 | 63 | { |
64 | 64 | /* to validate installation, instantiate the modX class and run a few tests */ |
65 | - if (include_once (M_CORE_PATH . 'model/modx/modx.class.php')) { |
|
66 | - $modx = new modX(M_CORE_PATH . 'config/', [ |
|
65 | + if (include_once (M_CORE_PATH.'model/modx/modx.class.php')) { |
|
66 | + $modx = new modX(M_CORE_PATH.'config/', [ |
|
67 | 67 | \xPDO::OPT_SETUP => true, |
68 | 68 | ]); |
69 | 69 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $modx->setLogTarget(array( |
74 | 74 | 'target' => 'FILE', |
75 | 75 | 'options' => array( |
76 | - 'filename' => 'install.' . MODX_CONFIG_KEY . '.' . strftime('%Y%m%dT%H%M%S') . '.log' |
|
76 | + 'filename' => 'install.'.MODX_CONFIG_KEY.'.'.strftime('%Y%m%dT%H%M%S').'.log' |
|
77 | 77 | ) |
78 | 78 | )); |
79 | 79 |
@@ -101,7 +101,7 @@ |
||
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, 'addConsole')) { |
106 | 106 | $class->addConsole($this->console); |
107 | 107 | } |
@@ -39,9 +39,9 @@ |
||
39 | 39 | return new InputDefinition(array( |
40 | 40 | new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), |
41 | 41 | |
42 | - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), |
|
42 | + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), |
|
43 | 43 | //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.'), |
44 | - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display the Blend version.'), |
|
44 | + new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display the Blend version.'), |
|
45 | 45 | )); |
46 | 46 | } |
47 | 47 |