| Conditions | 11 | 
| Paths | 96 | 
| Total Lines | 89 | 
| Code Lines | 66 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 3 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 76 | public function runActualTask($params = []): ?string  | 
            ||
| 77 |     { | 
            ||
| 78 | $this->mu()->setBreakOnAllErrors(true);  | 
            ||
| 79 | $fixer = FileSystemFixes::inst($this->mu())  | 
            ||
| 80 | ->removeDirOrFile($this->mu()->getWebRootDirLocation(), $this->mu()->getAboveWebRootDirLocation())  | 
            ||
| 81 | ->mkDir($this->mu()->getWebRootDirLocation(), $this->mu()->getAboveWebRootDirLocation());  | 
            ||
| 82 |         if (! $this->versionToLoad) { | 
            ||
| 83 | $this->versionToLoad = $this->mu()->getFrameworkComposerRestraint();  | 
            ||
| 84 | }  | 
            ||
| 85 | |||
| 86 | //install project / silverstripe clean.  | 
            ||
| 87 | $altBranch = $this->mu()->getParentProjectForModuleBranchOrTag();  | 
            ||
| 88 |         if (! $altBranch) { | 
            ||
| 89 | $altBranch = 'master';  | 
            ||
| 90 | }  | 
            ||
| 91 |         if ($this->mu()->getIsModuleUpgrade()) { | 
            ||
| 92 | $alternativeGitLink = $this->mu()->getParentProjectForModule();  | 
            ||
| 93 |             if ($alternativeGitLink) { | 
            ||
| 94 | Git::inst($this->mu())  | 
            ||
| 95 | ->Clone(  | 
            ||
| 96 | $this->mu()->getWebRootDirLocation(),  | 
            ||
| 97 | $alternativeGitLink,  | 
            ||
| 98 | $this->mu()->getGitRootDir(),  | 
            ||
| 99 | $altBranch  | 
            ||
| 100 | );  | 
            ||
| 101 |             } else { | 
            ||
| 102 | $this->mu()->execMe(  | 
            ||
| 103 | $this->mu()->getAboveWebRootDirLocation(),  | 
            ||
| 104 | $this->mu()->getComposerEnvironmentVars() . ' composer create-project -n ' . $this->defaultSilverstripeProject . ' ' . $this->mu()->getWebRootDirLocation() . ' ' . $this->versionToLoad,  | 
            ||
| 105 | 'set up vanilla install of ' . $this->defaultSilverstripeProject . ' - version: ' . $this->versionToLoad,  | 
            ||
| 106 | false  | 
            ||
| 107 | );  | 
            ||
| 108 |                 foreach($this->allowedPlugins as $plugin) { | 
            ||
| 109 | $this->mu()->execMe(  | 
            ||
| 110 | $this->mu()->getWebRootDirLocation(),  | 
            ||
| 111 | $this->mu()->getComposerEnvironmentVars() . 'composer config --no-interaction allow-plugins.' . $plugin . ' true',  | 
            ||
| 112 | 'composer config --no-interaction allow-plugins.' . $plugin . ' true',  | 
            ||
| 113 | false  | 
            ||
| 114 | );  | 
            ||
| 115 | }  | 
            ||
| 116 | }  | 
            ||
| 117 | }  | 
            ||
| 118 |         if ($this->installModuleAsVendorModule) { | 
            ||
| 119 | Composer::inst($this->mu())  | 
            ||
| 120 | ->ClearCache()  | 
            ||
| 121 | ->Require(  | 
            ||
| 122 | $this->mu()->getVendorName() . '/' . $this->mu()->getPackageName(),  | 
            ||
| 123 | 'dev-' . $this->mu()->getNameOfTempBranch(),  | 
            ||
| 124 | $this->composerOptions  | 
            ||
| 125 | );  | 
            ||
| 126 | $branch = $this->mu()->getParentProjectForModuleBranchOrTag() ?: 'master';  | 
            ||
| 127 |             if($this->mu()->getNameOfTempBranch() !== $branch) { | 
            ||
| 128 | $gitLink = $this->mu()->getGitLink();  | 
            ||
| 129 | $command = '  | 
            ||
| 130 | git init;  | 
            ||
| 131 | git remote add origin ' . $gitLink . ';  | 
            ||
| 132 | git pull origin ' . $altBranch . ';  | 
            ||
| 133 | git status;';  | 
            ||
| 134 | $this->mu()->execMe(  | 
            ||
| 135 | $this->mu()->getGitRootDir(),  | 
            ||
| 136 | $command,  | 
            ||
| 137 | 'Make sure it is a git repo',  | 
            ||
| 138 | false  | 
            ||
| 139 | );  | 
            ||
| 140 | }  | 
            ||
| 141 |         } else { | 
            ||
| 142 | Git::inst($this->mu())  | 
            ||
| 143 | ->Clone(  | 
            ||
| 144 | $this->mu()->getWebRootDirLocation(),  | 
            ||
| 145 | $this->mu()->getGitLink(),  | 
            ||
| 146 | $this->mu()->getGitRootDir(),  | 
            ||
| 147 | $this->mu()->getNameOfTempBranch()  | 
            ||
| 148 | );  | 
            ||
| 149 |             if ($this->mu()->getIsModuleUpgrade()) { | 
            ||
| 150 | $this->workoutExtraRequirementsFromModule();  | 
            ||
| 151 | }  | 
            ||
| 152 | }  | 
            ||
| 153 |         foreach ($this->alsoRequire as $package => $version) { | 
            ||
| 154 | Composer::inst($this->mu())  | 
            ||
| 155 | ->ClearCache()  | 
            ||
| 156 | ->Require(  | 
            ||
| 157 | $package,  | 
            ||
| 158 | $version,  | 
            ||
| 159 | $this->composerOptions  | 
            ||
| 160 | );  | 
            ||
| 161 | }  | 
            ||
| 162 | |||
| 163 | $this->mu()->setBreakOnAllErrors(false);  | 
            ||
| 164 | return null;  | 
            ||
| 165 | }  | 
            ||
| 194 |