| Total Complexity | 6 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class LintAll extends Task |
||
| 14 | { |
||
| 15 | protected $taskStep = 's30'; |
||
| 16 | |||
| 17 | public function getTitle() |
||
| 18 | { |
||
| 19 | return 'Lint all php code.'; |
||
| 20 | } |
||
| 21 | |||
| 22 | public function getDescription() |
||
| 25 | Goes through all the folders and uses the sake-lint-all function (this will need to be installed).'; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * [runActualTask description] |
||
| 30 | * @param array $params not currently used for this task |
||
| 31 | */ |
||
| 32 | public function runActualTask($params = []): ?string |
||
| 33 | { |
||
| 34 | if(PHP2CommandLineSingleton::commandExists('sake-lint-all')) { |
||
| 35 | foreach ($this->mu()->getExistingModuleDirLocations() as $moduleDir) { |
||
|
|
|||
| 36 | $this->mu()->execMe( |
||
| 37 | $this->mu()->getWebRootDirLocation(), |
||
| 38 | 'sake-lint-all '.$moduleDir, |
||
| 39 | 'Linting all PHP files in ' . $moduleDir, |
||
| 40 | true |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | } else { |
||
| 44 | return 'You need to install sake-lint-all to use this task: https://github.com/sunnysideup/silverstripe-easy-coding-standards'; |
||
| 45 | } |
||
| 46 | return null; |
||
| 47 | } |
||
| 48 | |||
| 49 | protected function hasCommitAndPush() |
||
| 52 | } |
||
| 53 | } |
||
| 54 |