| Conditions | 11 |
| Paths | 18 |
| Total Lines | 41 |
| Code Lines | 26 |
| 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 |
||
| 30 | public static function handle() |
||
| 31 | { |
||
| 32 | Env::getEnvironment(); |
||
| 33 | |||
| 34 | Env::$me = static::shiftArgs(); |
||
| 35 | |||
| 36 | static::$climate = new CLImate(); |
||
| 37 | //static::$climate->style->addCommand('orange', '38;5;208' /*'38;5;208'*/); |
||
| 38 | //static::$climate->orange('test'); exit; |
||
| 39 | |||
| 40 | switch ($action = static::shiftArgs()) { |
||
|
|
|||
| 41 | case 'init': |
||
| 42 | Initialize::init(); |
||
| 43 | break; |
||
| 44 | |||
| 45 | case 'status': |
||
| 46 | Basics::status(); |
||
| 47 | break; |
||
| 48 | |||
| 49 | case 'config': |
||
| 50 | Config::handle(); |
||
| 51 | |||
| 52 | // no break |
||
| 53 | case 'build': |
||
| 54 | // Divergence\Controllers\Builder::handle(); |
||
| 55 | break; |
||
| 56 | |||
| 57 | case 'test': |
||
| 58 | Tester::handle(); |
||
| 59 | break; |
||
| 60 | |||
| 61 | case '-v': |
||
| 62 | case '--version': |
||
| 63 | Basics::version(); |
||
| 64 | break; |
||
| 65 | |||
| 66 | case '--help': |
||
| 67 | case '-h': |
||
| 68 | case 'help': |
||
| 69 | default: |
||
| 70 | Basics::usage(); |
||
| 71 | } |
||
| 74 |