| Conditions | 13 |
| Paths | 160 |
| Total Lines | 57 |
| Code Lines | 44 |
| 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 |
||
| 34 | public static function printCheck($checkPassed, \_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\Printer $printer, \_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\RequirementCollection $requirements) |
||
| 35 | { |
||
| 36 | if (\false === $checkPassed && \_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE > $printer->getVerbosity()) { |
||
| 37 | // Override the default verbosity to output errors regardless of the verbosity asked by the user |
||
| 38 | $printer->setVerbosity(\_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE); |
||
| 39 | } |
||
| 40 | $verbosity = \_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE; |
||
| 41 | $iniPath = $requirements->getPhpIniPath(); |
||
| 42 | $printer->title('Box Requirements Checker', $verbosity); |
||
| 43 | $printer->printv('> Using PHP ', $verbosity); |
||
| 44 | $printer->printvln(\PHP_VERSION, $verbosity, 'green'); |
||
| 45 | $printer->printvln('> PHP is using the following php.ini file:', $verbosity); |
||
| 46 | if ($iniPath) { |
||
| 47 | $printer->printvln(' ' . $iniPath, $verbosity, 'green'); |
||
| 48 | } else { |
||
| 49 | $printer->printvln(' WARNING: No configuration file (php.ini) used by PHP!', $verbosity, 'yellow'); |
||
| 50 | } |
||
| 51 | $printer->printvln('', $verbosity); |
||
| 52 | if (\count($requirements) > 0) { |
||
| 53 | $printer->printvln('> Checking Box requirements:', $verbosity); |
||
| 54 | $printer->printv(' ', $verbosity); |
||
| 55 | } else { |
||
| 56 | $printer->printvln('> No requirements found.', $verbosity); |
||
| 57 | } |
||
| 58 | $errorMessages = array(); |
||
| 59 | foreach ($requirements->getRequirements() as $requirement) { |
||
| 60 | if ($errorMessage = $printer->getRequirementErrorMessage($requirement)) { |
||
| 61 | if (\_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG === $printer->getVerbosity()) { |
||
| 62 | $printer->printvln('✘ ' . $requirement->getTestMessage(), \_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG, 'red'); |
||
| 63 | $printer->printv(' ', \_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG); |
||
| 64 | $errorMessages[] = $errorMessage; |
||
| 65 | } else { |
||
| 66 | $printer->printv('E', $verbosity, 'red'); |
||
| 67 | $errorMessages[] = $errorMessage; |
||
| 68 | } |
||
| 69 | continue; |
||
| 70 | } |
||
| 71 | if (\_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG === $printer->getVerbosity()) { |
||
| 72 | $printer->printvln('✔ ' . $requirement->getHelpText(), \_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG, 'green'); |
||
| 73 | $printer->printv(' ', \_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG); |
||
| 74 | } else { |
||
| 75 | $printer->printv('.', $verbosity, 'green'); |
||
| 76 | } |
||
| 77 | } |
||
| 78 | if (\_HumbugBox5addf3ce683e7\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG !== $printer->getVerbosity() && \count($requirements) > 0) { |
||
| 79 | $printer->printvln('', $verbosity); |
||
| 80 | } |
||
| 81 | if ($requirements->evaluateRequirements()) { |
||
| 82 | $printer->block('OK', 'Your system is ready to run the application.', $verbosity, 'success'); |
||
| 83 | } else { |
||
| 84 | $printer->block('ERROR', 'Your system is not ready to run the application.', $verbosity, 'error'); |
||
| 85 | $printer->title('Fix the following mandatory requirements:', $verbosity, 'red'); |
||
| 86 | foreach ($errorMessages as $errorMessage) { |
||
| 87 | $printer->printv(' * ' . $errorMessage, $verbosity); |
||
| 88 | } |
||
| 89 | } |
||
| 90 | $printer->printvln('', $verbosity); |
||
| 91 | } |
||
| 108 |