| Conditions | 10 |
| Paths | 1 |
| Total Lines | 124 |
| Code Lines | 67 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 1 | 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 |
||
| 9 | public function printVarsForModule($mu, $moduleDetails) |
||
|
|
|||
| 10 | { |
||
| 11 | $this->mu = $mu; |
||
| 12 | |||
| 13 | //output the confirmation. |
||
| 14 | $mu->colourPrint('---------------------', 'light_cyan'); |
||
| 15 | $mu->colourPrint('UPGRADE DETAILS', 'light_cyan'); |
||
| 16 | $mu->colourPrint('---------------------', 'light_cyan'); |
||
| 17 | |||
| 18 | $mu->colourPrint('- Type: ' . $mu->getIsModuleUpgradeNice(), 'light_cyan'); |
||
| 19 | |||
| 20 | $mu->colourPrint('- Visibility: ' . $mu->getisOnPackagistNice(), 'light_cyan'); |
||
| 21 | |||
| 22 | $mu->colourPrint('- Recipe: ' . ($mu->getRecipe() ?: 'no recipe selected'), 'light_cyan'); |
||
| 23 | |||
| 24 | $mu->colourPrint('- Available Recipes: ' . implode(', ', array_keys($mu->getAvailableRecipes())), 'light_cyan'); |
||
| 25 | |||
| 26 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 27 | |||
| 28 | $mu->colourPrint('- Vendor Name: ' . $mu->getVendorName(), 'light_cyan'); |
||
| 29 | |||
| 30 | $mu->colourPrint('- Package Name: ' . $mu->getPackageName(), 'light_cyan'); |
||
| 31 | |||
| 32 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 33 | |||
| 34 | $mu->colourPrint('- Upgrade as Fork: ' . ($mu->getUpgradeAsFork() ? 'yes' : 'no'), 'light_cyan'); |
||
| 35 | |||
| 36 | $mu->colourPrint('- Run Interactively: ' . ($mu->getRunInteractively() ? 'yes' : 'no'), 'light_cyan'); |
||
| 37 | |||
| 38 | $mu->colourPrint('- Run Irreversibly: ' . ($mu->getRunIrreversibly() ? 'yes' : 'no'), 'light_cyan'); |
||
| 39 | |||
| 40 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 41 | |||
| 42 | $mu->colourPrint('- Vendor Namespace: ' . $mu->getVendorNamespace(), 'light_cyan'); |
||
| 43 | |||
| 44 | $mu->colourPrint('- Package Namespace: ' . $mu->getPackageNamespace(), 'light_cyan'); |
||
| 45 | |||
| 46 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 47 | |||
| 48 | $mu->colourPrint( |
||
| 49 | '- Code Base Branch (what we started from): ' . $mu->getNameOfBranchForBaseCode(), |
||
| 50 | 'light_cyan' |
||
| 51 | ); |
||
| 52 | |||
| 53 | $mu->colourPrint( |
||
| 54 | '- Base Upgrade Branch (edit this branch manually if needed): ' . $mu->getNameOfUpgradeStarterBranch(), |
||
| 55 | 'light_cyan' |
||
| 56 | ); |
||
| 57 | |||
| 58 | $mu->colourPrint( |
||
| 59 | '- Automated Upgrade Branch (temp only, do not edit manually!): ' . $mu->getNameOfTempBranch(), |
||
| 60 | 'light_cyan' |
||
| 61 | ); |
||
| 62 | |||
| 63 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 64 | |||
| 65 | $mu->colourPrint('- Upgrade Dir (root of install): ' . $mu->getWebRootDirLocation(), 'light_cyan'); |
||
| 66 | |||
| 67 | $mu->colourPrint('- Package Folder Name For Install: ' . $mu->getPackageFolderNameForInstall(), 'light_cyan'); |
||
| 68 | |||
| 69 | $mu->colourPrint('- Module / Project Dir(s): ' . implode(', ', $mu->getModuleDirLocations()), 'light_cyan'); |
||
| 70 | |||
| 71 | $mu->colourPrint('- Theme Dir: ' . ($mu->getThemeDirLocation() ?: 'not set'), 'light_cyan'); |
||
| 72 | |||
| 73 | $mu->colourPrint('- Git and Composer Root Dir: ' . $mu->getGitRootDir(), 'light_cyan'); |
||
| 74 | |||
| 75 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 76 | |||
| 77 | $mu->colourPrint('- Git Repository Link (SSH): ' . $mu->getGitLink(), 'light_cyan'); |
||
| 78 | |||
| 79 | $mu->colourPrint('- Git Repository Link (HTTPS): ' . $mu->getGitLinkAsHTTPS(), 'light_cyan'); |
||
| 80 | |||
| 81 | $mu->colourPrint('- Git Repository Link (RAW): ' . $mu->getGitLinkAsRawHTTPS(), 'light_cyan'); |
||
| 82 | |||
| 83 | $mu->colourPrint('- Origin composer file location: ' . |
||
| 84 | ($mu->getOriginComposerFileLocation() ?: 'not set'), 'light_cyan'); |
||
| 85 | |||
| 86 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 87 | |||
| 88 | $mu->colourPrint('- Session file: ' . $mu->getSessionManager()->getSessionFileLocation(), 'light_cyan'); |
||
| 89 | |||
| 90 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 91 | |||
| 92 | $mu->colourPrint('- Last Step: ' . ($mu->getLastMethodRun() ?: 'not set'), 'light_cyan'); |
||
| 93 | |||
| 94 | $mu->colourPrint('- Current Step: ' . ($mu->getOnlyRun() ?: 'not set'), 'light_cyan'); |
||
| 95 | |||
| 96 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 97 | |||
| 98 | $mu->colourPrint('- Log File Location: ' . ($mu->getLogFileLocation() ?: 'not logged'), 'light_cyan'); |
||
| 99 | |||
| 100 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 101 | |||
| 102 | $mu->colourPrint('- List of Steps: ' . $mu->newLine() . $this->listOfTasks(), 'light_cyan'); |
||
| 103 | |||
| 104 | $mu->colourPrint('---------------------', 'light_cyan'); |
||
| 105 | |||
| 106 | $mu->colourPrint('while running one tasks at the time (interactively), you can use:', 'light_cyan'); |
||
| 107 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 108 | |||
| 109 | $mu->colourPrint('- parameter "task=MySpecificTask" ... to run any task out of order', 'white'); |
||
| 110 | |||
| 111 | $mu->colourPrint('- parameter "startFrom=MySpecificTask" ... to start from a specific step', 'white'); |
||
| 112 | |||
| 113 | $mu->colourPrint('- parameter "restart" ... starts process from beginning', 'white'); |
||
| 114 | |||
| 115 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 116 | $mu->colourPrint('while running all tasks at once, you can use:', 'light_cyan'); |
||
| 117 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 118 | |||
| 119 | $mu->colourPrint('- parameter "startFrom=MySpecificTask" ... runs all steps from MySpecificTask', 'white'); |
||
| 120 | |||
| 121 | $mu->colourPrint('- parameter "task=MySpecificTask" ... to run any task out of order', 'white'); |
||
| 122 | |||
| 123 | $mu->colourPrint('- parameter "endWith=MySpecificTask" ... runs all steps up to MySpecificTask', 'white'); |
||
| 124 | |||
| 125 | $mu->colourPrint('- parameter "again" ... run the last step again', 'white'); |
||
| 126 | |||
| 127 | $mu->colourPrint('- parameter "restart" ... starts process from beginning', 'white'); |
||
| 128 | |||
| 129 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 130 | $mu->colourPrint('if running step by step, you can also edit the session file (see file location above) ', 'light_cyan'); |
||
| 131 | $mu->colourPrint('to start at a specific step (e.g. bypass current one). ', 'light_cyan'); |
||
| 132 | $mu->colourPrint('- ---', 'light_cyan'); |
||
| 133 | } |
||
| 164 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.