| Total Complexity | 8 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Recompose extends Task |
||
| 12 | { |
||
| 13 | protected $taskStep = 's20'; |
||
| 14 | |||
| 15 | protected $param1 = ''; |
||
| 16 | |||
| 17 | protected $param2 = ''; |
||
| 18 | |||
| 19 | protected $rootDirForCommand = ''; |
||
| 20 | |||
| 21 | protected $settings = ''; |
||
| 22 | |||
| 23 | public function getTitle() |
||
| 24 | { |
||
| 25 | return 'Update composer.json from 3 to 4'; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function getDescription() |
||
| 31 | Runs the silverstripe/upgrade task "recompose". See: |
||
| 32 | https://github.com/silverstripe/silverstripe-upgrader#recompose'; |
||
| 33 | } |
||
| 34 | |||
| 35 | public function runActualTask($params = []): ?string |
||
| 36 | { |
||
| 37 | if ($this->mu()->getIsModuleUpgrade()) { |
||
| 38 | } else { |
||
| 39 | if (! $this->param1) { |
||
| 40 | $this->param1 = '--recipe-core-constraint="' . $this->mu()->getFrameworkComposerRestraint() . '"'; |
||
| 41 | } |
||
| 42 | if (empty($this->rootDirForCommand)) { |
||
| 43 | $this->rootDirForCommand = $this->mu()->getGitRootDir(); |
||
| 44 | } |
||
| 45 | $this->runSilverstripeUpgradeTask( |
||
| 46 | 'recompose', |
||
| 47 | $this->param1, |
||
| 48 | $this->param2, |
||
| 49 | $this->rootDirForCommand, |
||
| 50 | $this->settings |
||
| 51 | ); |
||
| 52 | $this->setCommitMessage('API: upgrading composer requirements to SS4 - STEP 2'); |
||
| 53 | } |
||
| 54 | return null; |
||
| 55 | } |
||
| 56 | |||
| 57 | protected function hasCommitAndPush() |
||
| 63 | } |
||
| 64 | } |
||
| 65 |