| Conditions | 16 |
| Paths | 21 |
| Total Lines | 23 |
| 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 |
||
| 102 | protected function getMagentoVersionByYear($year, $edition) |
||
| 103 | { |
||
| 104 | switch ($year) { |
||
| 105 | case '2006-2015': |
||
| 106 | case '2006-2014': |
||
| 107 | case '2014': |
||
| 108 | return $edition == Version::EDITION_ENTERPRISE ? |
||
| 109 | '1.14' : '1.9'; |
||
| 110 | case 2013: |
||
| 111 | return $edition == Version::EDITION_ENTERPRISE ? |
||
| 112 | '1.13' : '1.8'; |
||
| 113 | case 2012: |
||
| 114 | return ($edition == Version::EDITION_ENTERPRISE || $edition == Version::EDITION_PROFESSIONAL) ? |
||
| 115 | '1.12' : '1.7'; |
||
| 116 | case 2011: |
||
| 117 | return ($edition == Version::EDITION_ENTERPRISE || $edition == Version::EDITION_PROFESSIONAL) ? |
||
| 118 | '1.11' : '1.6'; |
||
| 119 | case 2010: |
||
| 120 | return ($edition == Version::EDITION_ENTERPRISE || $edition == Version::EDITION_PROFESSIONAL) ? |
||
| 121 | '1.9 - 1.10' : '1.4 - 1.5'; |
||
| 122 | } |
||
| 123 | return 'Unknown'; |
||
| 124 | } |
||
| 125 | } |
||
| 126 |