@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | // How to mark as deprecated? |
| 144 | 144 | if (method_exists($this->blendableLoader, $name)) { |
| 145 | 145 | |
| 146 | - $message = get_class($this) . '->'.$name.'() has been deprecated, please use ' . get_class($this) . '->getBlendableLoader()->' . $name; |
|
| 146 | + $message = get_class($this).'->'.$name.'() has been deprecated, please use '.get_class($this).'->getBlendableLoader()->'.$name; |
|
| 147 | 147 | trigger_error($message, E_USER_WARNING); |
| 148 | 148 | $this->modx->log(\modX::LOG_LEVEL_ERROR, $message); |
| 149 | 149 | |
| 150 | 150 | return call_user_func_array(array($this->blendableLoader, $name), $arguments); |
| 151 | 151 | |
| 152 | 152 | } else { |
| 153 | - throw new MigratorException('Call to undefined Method ' . get_class($this) . '->' . $name); |
|
| 153 | + throw new MigratorException('Call to undefined Method '.get_class($this).'->'.$name); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @see https://symfony.com/doc/current/console/verbosity.html |
| 192 | 192 | * @return $this |
| 193 | 193 | */ |
| 194 | - public function setVerbose(int $verbose=self::VERBOSITY_NORMAL) |
|
| 194 | + public function setVerbose(int $verbose = self::VERBOSITY_NORMAL) |
|
| 195 | 195 | { |
| 196 | 196 | $this->config['verbose'] = $verbose; |
| 197 | 197 | return $this; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * @param int $verbose |
| 308 | 308 | * @param bool $error |
| 309 | 309 | */ |
| 310 | - public function out($message, $verbose=Blender::VERBOSITY_NORMAL, $error = false) |
|
| 310 | + public function out($message, $verbose = Blender::VERBOSITY_NORMAL, $error = false) |
|
| 311 | 311 | { |
| 312 | 312 | if ($this->getVerbose() >= $verbose) { |
| 313 | 313 | if ($error) { |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * @param string $message |
| 324 | 324 | * @param int $verbose |
| 325 | 325 | */ |
| 326 | - public function outError($message, $verbose=Blender::VERBOSITY_NORMAL) |
|
| 326 | + public function outError($message, $verbose = Blender::VERBOSITY_NORMAL) |
|
| 327 | 327 | { |
| 328 | 328 | if ($this->getVerbose() >= $verbose) { |
| 329 | 329 | $this->userInteractionHandler->tellUser($message, userInteractionHandler::MASSAGE_ERROR); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @param string $message |
| 335 | 335 | * @param int $verbose |
| 336 | 336 | */ |
| 337 | - public function outSuccess($message, $verbose=Blender::VERBOSITY_NORMAL) |
|
| 337 | + public function outSuccess($message, $verbose = Blender::VERBOSITY_NORMAL) |
|
| 338 | 338 | { |
| 339 | 339 | if ($this->getVerbose() >= $verbose) { |
| 340 | 340 | $this->userInteractionHandler->tellUser($message, userInteractionHandler::MASSAGE_SUCCESS); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $current_version = $this->modx->getOption('blend.version'); |
| 456 | 456 | // FILE version, DB Version |
| 457 | 457 | if ($this->isBlendInstalledInModx() && (!$current_version || version_compare($this->getVersion(), $current_version) === 1)) { |
| 458 | - $this->outError('MODX System Setting Version: '. $current_version.' Code version: '.$this->getVersion(), Blender::VERBOSITY_DEBUG); |
|
| 458 | + $this->outError('MODX System Setting Version: '.$current_version.' Code version: '.$this->getVersion(), Blender::VERBOSITY_DEBUG); |
|
| 459 | 459 | $upgrade = true; |
| 460 | 460 | } |
| 461 | 461 | |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * @param bool $check_install_log |
| 467 | 467 | * @return bool |
| 468 | 468 | */ |
| 469 | - public function isBlendInstalledInModx($check_install_log=true) |
|
| 469 | + public function isBlendInstalledInModx($check_install_log = true) |
|
| 470 | 470 | { |
| 471 | 471 | $installed = false; |
| 472 | 472 | try { |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | $installed = true; |
| 479 | 479 | |
| 480 | 480 | } catch (\Exception $exception) { |
| 481 | - $this->out(__METHOD__ . ' Exception: '. $exception->getMessage(), Blender::VERBOSITY_DEBUG); |
|
| 481 | + $this->out(__METHOD__.' Exception: '.$exception->getMessage(), Blender::VERBOSITY_DEBUG); |
|
| 482 | 482 | // We got an exception == table not found |
| 483 | 483 | return false; |
| 484 | 484 | } |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | $this->out(print_r($installMigration->toArray(), true), Blender::VERBOSITY_DEBUG); |
| 500 | 500 | $installed = true; |
| 501 | 501 | } |
| 502 | - $this->out(__METHOD__ . ' Blend install log not found', Blender::VERBOSITY_DEBUG); |
|
| 502 | + $this->out(__METHOD__.' Blend install log not found', Blender::VERBOSITY_DEBUG); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | return $installed; |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | * @param string $context |
| 594 | 594 | * @return bool|int |
| 595 | 595 | */ |
| 596 | - public function getResourceIDFromLocalAlias($alias, $context='web') |
|
| 596 | + public function getResourceIDFromLocalAlias($alias, $context = 'web') |
|
| 597 | 597 | { |
| 598 | 598 | $seed_key = $this->getSeedKeyFromAlias($alias); |
| 599 | 599 | return $this->getResourceIDFromSeedKey($seed_key, $context); |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | * @param array $data |
| 112 | 112 | * @param bool $force_save_attempt |
| 113 | 113 | */ |
| 114 | - public function logMigration($data, $force_save_attempt=false) |
|
| 114 | + public function logMigration($data, $force_save_attempt = false) |
|
| 115 | 115 | { |
| 116 | 116 | if ($this->delay_logging && !$force_save_attempt) {// attempt |
| 117 | - $key = $data['project'] . $data['name']; |
|
| 117 | + $key = $data['project'].$data['name']; |
|
| 118 | 118 | $this->delayed_logs[$key] = $data; |
| 119 | 119 | |
| 120 | 120 | } else { |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | // 1. Get all migrations currently in DB: |
| 188 | 188 | $blendMigrations = $this->getBlendMigrationCollection(); |
| 189 | 189 | |
| 190 | - $this->out('Searching directory for Migration classes ' . $this->blender->getMigrationPath()); |
|
| 190 | + $this->out('Searching directory for Migration classes '.$this->blender->getMigrationPath()); |
|
| 191 | 191 | |
| 192 | 192 | $loaded_migrations = []; |
| 193 | 193 | $reload = false; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | protected function runExistingDBMigrations() |
| 243 | 243 | { |
| 244 | - $this->out(__METHOD__ . ' Start', Blender::VERBOSITY_DEBUG); |
|
| 244 | + $this->out(__METHOD__.' Start', Blender::VERBOSITY_DEBUG); |
|
| 245 | 245 | /** @var \BlendMigrations $migrationLog */ |
| 246 | 246 | foreach ($this->blendMigrations as $name => $migrationLog) { |
| 247 | 247 | if (!$this->canRunMigrationVerifyLog($migrationLog)) { |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $migration->{$this->migration_method}(); |
| 263 | 263 | |
| 264 | 264 | $migrationLog->set('ran_sequence', $this->getRanSequence((int)$migrationLog->get('ran_sequence'))); |
| 265 | - $migrationLog->set('status', $this->migration_method . '_complete'); |
|
| 265 | + $migrationLog->set('status', $this->migration_method.'_complete'); |
|
| 266 | 266 | $migrationLog->set('processed_at', date('Y-m-d H:i:s')); |
| 267 | 267 | |
| 268 | 268 | if ($this->delay_logging) { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | } else { |
| 277 | 277 | // error |
| 278 | - throw new MigratorException('Class: ' . $name .' is not an instance of LCI\BLend\Migrations'); |
|
| 278 | + throw new MigratorException('Class: '.$name.' is not an instance of LCI\BLend\Migrations'); |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | protected function runLoadedFileMigrations($loaded_migrations) |
| 287 | 287 | { |
| 288 | - $this->out(__METHOD__ . ' Start', Blender::VERBOSITY_DEBUG); |
|
| 288 | + $this->out(__METHOD__.' Start', Blender::VERBOSITY_DEBUG); |
|
| 289 | 289 | $logged_migrations = $this->getBlendMigrationCollection(); |
| 290 | 290 | |
| 291 | 291 | $count = 0; |
@@ -306,11 +306,11 @@ discard block |
||
| 306 | 306 | /** @var \BlendMigrations $migrationLog */ |
| 307 | 307 | $migrationLog = $logged_migrations[$name]; |
| 308 | 308 | $migrationLog->set('ran_sequence', $this->getRanSequence($migrationLog->get('ran_sequence'))); |
| 309 | - $migrationLog->set('status', $this->migration_method . '_complete'); |
|
| 309 | + $migrationLog->set('status', $this->migration_method.'_complete'); |
|
| 310 | 310 | $migrationLog->set('processed_at', date('Y-m-d H:i:s')); |
| 311 | 311 | |
| 312 | 312 | if ($this->delay_logging) { |
| 313 | - $this->delayed_logs[$this->project . $name] = $migrationLog; |
|
| 313 | + $this->delayed_logs[$this->project.$name] = $migrationLog; |
|
| 314 | 314 | |
| 315 | 315 | } else { |
| 316 | 316 | $migrationLog->save(); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | 'description' => $migration->getDescription(), |
| 325 | 325 | 'type' => $migration->getType(), |
| 326 | 326 | 'version' => $migration->getVersion(), |
| 327 | - 'status' => $this->migration_method . '_complete', |
|
| 327 | + 'status' => $this->migration_method.'_complete', |
|
| 328 | 328 | 'ran_sequence' => $this->getRanSequence($count++), |
| 329 | 329 | 'processed_at' => date('Y-m-d H:i:s') |
| 330 | 330 | ]); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | ($this->migration_method == 'up' && $status == 'up_complete') || |
| 384 | 384 | ($this->migration_method == 'down' && $status != 'up_complete') |
| 385 | 385 | ) { |
| 386 | - $this->out('canRunMigrationVerifyLog() Failed' . __LINE__, OutputInterface::VERBOSITY_DEBUG); |
|
| 386 | + $this->out('canRunMigrationVerifyLog() Failed'.__LINE__, OutputInterface::VERBOSITY_DEBUG); |
|
| 387 | 387 | $can = false; |
| 388 | 388 | } |
| 389 | 389 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | $query->prepare(); |
| 431 | 431 | |
| 432 | - $this->out(__METHOD__ .':: sql: ' . $query->toSQL(), OutputInterface::VERBOSITY_DEBUG); |
|
| 432 | + $this->out(__METHOD__.':: sql: '.$query->toSQL(), OutputInterface::VERBOSITY_DEBUG); |
|
| 433 | 433 | |
| 434 | 434 | $migrationCollection = $this->modx->getCollection($this->blender->getBlendClassObject(), $query); |
| 435 | 435 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * @param int $ran_sequence |
| 448 | 448 | * @return int|mixed |
| 449 | 449 | */ |
| 450 | - protected function getRanSequence(int $ran_sequence=0) |
|
| 450 | + protected function getRanSequence(int $ran_sequence = 0) |
|
| 451 | 451 | { |
| 452 | 452 | if ($this->migration_method == 'up') { |
| 453 | 453 | /** @var \xPDOQuery $query */ |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | * @param string $message |
| 502 | 502 | * @param int $verbose |
| 503 | 503 | */ |
| 504 | - protected function outError($message, $verbose=OutputInterface::VERBOSITY_NORMAL) |
|
| 504 | + protected function outError($message, $verbose = OutputInterface::VERBOSITY_NORMAL) |
|
| 505 | 505 | { |
| 506 | 506 | $this->blender->outError($message, $verbose); |
| 507 | 507 | } |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | * @param string $message |
| 511 | 511 | * @param int $verbose |
| 512 | 512 | */ |
| 513 | - protected function out($message, $verbose=OutputInterface::VERBOSITY_NORMAL) |
|
| 513 | + protected function out($message, $verbose = OutputInterface::VERBOSITY_NORMAL) |
|
| 514 | 514 | { |
| 515 | 515 | $this->blender->out($message, $verbose); |
| 516 | 516 | } |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | * @param string $context |
| 638 | 638 | * @return $this |
| 639 | 639 | */ |
| 640 | - public function setFieldParentFromAlias($alias, $context='web') |
|
| 640 | + public function setFieldParentFromAlias($alias, $context = 'web') |
|
| 641 | 641 | { |
| 642 | 642 | $this->blendable_xpdo_simple_object_data['parent'] = [ |
| 643 | 643 | 'seed_key' => $this->blender->getSeedKeyFromAlias($alias), |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | * @param string $context |
| 779 | 779 | * @return $this |
| 780 | 780 | */ |
| 781 | - public function setTVValueResourceIDFromAlias($tv_name, $alias, $context='web') |
|
| 781 | + public function setTVValueResourceIDFromAlias($tv_name, $alias, $context = 'web') |
|
| 782 | 782 | { |
| 783 | 783 | $value = $this->blender->getResourceIDFromLocalAlias($alias, $context); |
| 784 | 784 | |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | if (!in_array('project', $columns)) { |
| 26 | 26 | // the class table object name |
| 27 | 27 | if ($manager->addField('BlendMigrations', 'project', ['after' => 'id'])) { |
| 28 | - $this->blender->outSuccess('The project column was add to the BlendMigrations class (' . |
|
| 29 | - $this->modx->getTableName('BlendMigrations') . ') successfully'); |
|
| 28 | + $this->blender->outSuccess('The project column was add to the BlendMigrations class ('. |
|
| 29 | + $this->modx->getTableName('BlendMigrations').') successfully'); |
|
| 30 | 30 | |
| 31 | 31 | } else { |
| 32 | - $this->blender->out('The project column was not added to the BlendMigrations class (' . |
|
| 33 | - $this->modx->getTableName('BlendMigrations') . ') successfully', true); |
|
| 32 | + $this->blender->out('The project column was not added to the BlendMigrations class ('. |
|
| 33 | + $this->modx->getTableName('BlendMigrations').') successfully', true); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | if (!in_array('ran_sequence', $columns)) { |
| 39 | 39 | // the class table object name |
| 40 | 40 | if ($manager->addField('BlendMigrations', 'ran_sequence', ['after' => 'processed_at'])) { |
| 41 | - $this->blender->outSuccess('The ran_sequence column was add to the BlendMigrations class (' . |
|
| 42 | - $this->modx->getTableName('BlendMigrations') . ') successfully'); |
|
| 41 | + $this->blender->outSuccess('The ran_sequence column was add to the BlendMigrations class ('. |
|
| 42 | + $this->modx->getTableName('BlendMigrations').') successfully'); |
|
| 43 | 43 | |
| 44 | 44 | } else { |
| 45 | - $this->blender->out('The author ran_sequence was not added to the BlendMigrations class (' . |
|
| 46 | - $this->modx->getTableName('BlendMigrations') . ') successfully', true); |
|
| 45 | + $this->blender->out('The author ran_sequence was not added to the BlendMigrations class ('. |
|
| 46 | + $this->modx->getTableName('BlendMigrations').') successfully', true); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->modx->cacheManager->refresh(); |
| 83 | 83 | |
| 84 | 84 | $previous_version = $this->modx->getOption('blend.version'); |
| 85 | - if (!$previous_version || version_compare($this->getVersion(), $previous_version, '>') ) { |
|
| 85 | + if (!$previous_version || version_compare($this->getVersion(), $previous_version, '>')) { |
|
| 86 | 86 | |
| 87 | 87 | /** @var \xPDOManager $manager */ |
| 88 | 88 | $manager = $this->modx->getManager(); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $columns = []; |
| 105 | 105 | |
| 106 | - $rs = $this->modx->query('SELECT * FROM ' . $this->modx->getTableName('BlendMigrations') . ' LIMIT 0'); |
|
| 106 | + $rs = $this->modx->query('SELECT * FROM '.$this->modx->getTableName('BlendMigrations').' LIMIT 0'); |
|
| 107 | 107 | for ($i = 0; $i < $rs->columnCount(); $i++) { |
| 108 | 108 | $col = $rs->getColumnMeta($i); |
| 109 | 109 | $columns[] = $col['name']; |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | if (!in_array('author', $columns)) { |
| 26 | 26 | if ($manager->addField('BlendMigrations', 'author', ['after' => 'status'])) { |
| 27 | - $this->blender->outSuccess('The author column was add to the BlendMigrations class (' . |
|
| 28 | - $this->modx->getTableName('BlendMigrations') . ') successfully'); |
|
| 27 | + $this->blender->outSuccess('The author column was add to the BlendMigrations class ('. |
|
| 28 | + $this->modx->getTableName('BlendMigrations').') successfully'); |
|
| 29 | 29 | |
| 30 | 30 | } else { |
| 31 | - $this->blender->out('The author column was not added to the BlendMigrations class (' . |
|
| 32 | - $this->modx->getTableName('BlendMigrations') . ') successfully', true); |
|
| 31 | + $this->blender->out('The author column was not added to the BlendMigrations class ('. |
|
| 32 | + $this->modx->getTableName('BlendMigrations').') successfully', true); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $this->modx->cacheManager->refresh(); |
| 62 | 62 | |
| 63 | 63 | $previous_version = $this->modx->getOption('blend.version'); |
| 64 | - if (!$previous_version || version_compare($this->getVersion(), $previous_version, '>') ) { |
|
| 64 | + if (!$previous_version || version_compare($this->getVersion(), $previous_version, '>')) { |
|
| 65 | 65 | |
| 66 | 66 | /** @var \xPDOManager $manager */ |
| 67 | 67 | $manager = $this->modx->getManager(); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | $columns = []; |
| 84 | 84 | |
| 85 | - $rs = $this->modx->query('SELECT * FROM ' . $this->modx->getTableName('BlendMigrations') . ' LIMIT 0'); |
|
| 85 | + $rs = $this->modx->query('SELECT * FROM '.$this->modx->getTableName('BlendMigrations').' LIMIT 0'); |
|
| 86 | 86 | for ($i = 0; $i < $rs->columnCount(); $i++) { |
| 87 | 87 | $col = $rs->getColumnMeta($i); |
| 88 | 88 | $columns[] = $col['name']; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $event = $this->modx->newObject('modEvent'); |
| 138 | 138 | $event->set('name', $event_name); |
| 139 | 139 | $event->set('service', 1); |
| 140 | - $event->set('groupname', 'Resources');// ?? |
|
| 140 | + $event->set('groupname', 'Resources'); // ?? |
|
| 141 | 141 | |
| 142 | 142 | if ($event->save()) { |
| 143 | 143 | $this->blender->out($event_name.' event has been installed'); |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | $event = $this->modx->getObject('modEvent', ['name' => $event_name]); |
| 157 | 157 | if (is_object($event)) { |
| 158 | 158 | if ($event->remove()) { |
| 159 | - $this->blender->out($event_name . ' event was removed', true); |
|
| 159 | + $this->blender->out($event_name.' event was removed', true); |
|
| 160 | 160 | } else { |
| 161 | - $this->blender->out($event_name . ' event was not removed', true); |
|
| 161 | + $this->blender->out($event_name.' event was not removed', true); |
|
| 162 | 162 | } |
| 163 | 163 | } else { |
| 164 | - $this->blender->out($event_name . ' event has already been removed', true); |
|
| 164 | + $this->blender->out($event_name.' event has already been removed', true); |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |