| Conditions | 11 |
| Paths | 80 |
| Total Lines | 66 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 52 | public static function printCheck(Printer $printer, RequirementCollection $requirements) |
||
| 53 | { |
||
| 54 | $verbosity = IO::VERBOSITY_VERY_VERBOSE; |
||
| 55 | |||
| 56 | $iniPath = $requirements->getPhpIniPath(); |
||
| 57 | |||
| 58 | $printer->title('Box Requirements Checker', $verbosity); |
||
| 59 | |||
| 60 | $printer->printvln('> PHP is using the following php.ini file:', $verbosity); |
||
| 61 | |||
| 62 | if ($iniPath) { |
||
| 63 | $printer->printvln(' '.$iniPath, $verbosity, 'green'); |
||
| 64 | } else { |
||
| 65 | $printer->printvln(' WARNING: No configuration file (php.ini) used by PHP!', $verbosity, 'yellow'); |
||
| 66 | } |
||
| 67 | |||
| 68 | $printer->printvln('', $verbosity); |
||
| 69 | |||
| 70 | if (count($requirements) > 0) { |
||
| 71 | $printer->printvln('> Checking Box requirements:', $verbosity); |
||
| 72 | $printer->printv(' ', $verbosity); |
||
| 73 | } else { |
||
| 74 | $printer->printvln('> No requirements found.', $verbosity); |
||
| 75 | } |
||
| 76 | |||
| 77 | $errorMessages = array(); |
||
| 78 | |||
| 79 | foreach ($requirements->getRequirements() as $requirement) { |
||
| 80 | if ($errorMessage = $printer->getRequirementErrorMessage($requirement)) { |
||
| 81 | if ($printer->getVerbosity() === IO::VERBOSITY_DEBUG) { |
||
| 82 | $printer->printvln('✘ '.$requirement->getTestMessage(), IO::VERBOSITY_DEBUG, 'red'); |
||
| 83 | $printer->printv(' ', IO::VERBOSITY_DEBUG); |
||
| 84 | $errorMessages[] = $errorMessage; |
||
| 85 | } else { |
||
| 86 | $printer->printv('E', $verbosity, 'red'); |
||
| 87 | $errorMessages[] = $errorMessage; |
||
| 88 | } |
||
| 89 | |||
| 90 | continue; |
||
| 91 | } |
||
| 92 | |||
| 93 | if ($printer->getVerbosity() === IO::VERBOSITY_DEBUG) { |
||
| 94 | $printer->printvln('✔ '.$requirement->getHelpText(), IO::VERBOSITY_DEBUG, 'green'); |
||
| 95 | $printer->printv(' ', IO::VERBOSITY_DEBUG); |
||
| 96 | } else { |
||
| 97 | $printer->printv('.', $verbosity, 'green'); |
||
| 98 | } |
||
| 99 | } |
||
| 100 | |||
| 101 | if ($printer->getVerbosity() !== IO::VERBOSITY_DEBUG && count($requirements) > 0) { |
||
| 102 | $printer->printvln('', $verbosity); |
||
| 103 | } |
||
| 104 | |||
| 105 | if ($requirements->evaluateRequirements()) { |
||
| 106 | $printer->block('OK', 'Your system is ready to run the application.', $verbosity, 'success'); |
||
| 107 | } else { |
||
| 108 | $printer->block('ERROR', 'Your system is not ready to run the application.', $verbosity, 'error'); |
||
| 109 | |||
| 110 | $printer->title('Fix the following mandatory requirements:', $verbosity, 'red'); |
||
| 111 | |||
| 112 | foreach ($errorMessages as $errorMessage) { |
||
| 113 | $printer->printv(' * '.$errorMessage, $verbosity); |
||
| 114 | } |
||
| 115 | } |
||
| 116 | |||
| 117 | $printer->printvln('', $verbosity); |
||
| 118 | } |
||
| 136 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.