| Total Complexity | 5 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class FixOutdatedPHPStyles extends Task |
||
| 8 | { |
||
| 9 | protected $taskStep = 's10'; |
||
| 10 | |||
| 11 | protected $composerOptions = ''; |
||
| 12 | |||
| 13 | public function getTitle() |
||
| 14 | { |
||
| 15 | return 'Uses sunnysideup/huringa to check for outdated styles. An important part of this is to separate files into separate files / classes.'; |
||
| 16 | } |
||
| 17 | |||
| 18 | public function getDescription() |
||
| 19 | { |
||
| 20 | return ' |
||
| 21 | See huringa module for mor details'; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function runActualTask($params = []): ?string |
||
| 25 | { |
||
| 26 | $webRoot = $this->mu()->getWebRootDirLocation(); |
||
| 27 | |||
| 28 | $this->mu()->execMe( |
||
| 29 | $webRoot, |
||
| 30 | 'composer require --dev --with-all-dependencies sunnysideup/huringa:dev-master --no-interaction', |
||
| 31 | 'installing huringa', |
||
| 32 | false |
||
| 33 | ); |
||
| 34 | |||
| 35 | $codeDirs = $this->mu()->findNameSpaceAndCodeDirs(); |
||
| 36 | $this->mu()->setBreakOnAllErrors(true); |
||
| 37 | foreach ($codeDirs as $codeDir) { |
||
| 38 | $this->mu()->execMe( |
||
| 39 | $webRoot, |
||
| 40 | 'vendor/bin/huringa ' . $codeDir, |
||
| 41 | 'fixing outdated code styles in ' . $codeDir, |
||
| 42 | false |
||
| 43 | ); |
||
| 44 | |||
| 45 | $this->setCommitMessage('API: fixing outdated code styles using sunnysideup/huringa in ' . $codeDir); |
||
| 46 | } |
||
| 47 | |||
| 48 | $this->mu()->execMe( |
||
| 49 | $webRoot, |
||
| 50 | 'composer remove sunnysideup/huringa:dev-master', |
||
| 51 | 'uninstalling huringa', |
||
| 52 | false |
||
| 53 | ); |
||
| 54 | |||
| 55 | $this->mu()->setBreakOnAllErrors(false); |
||
| 56 | return null; |
||
| 57 | } |
||
| 58 | |||
| 59 | protected function hasCommitAndPush() |
||
| 62 | } |
||
| 63 | } |
||
| 64 |