| Conditions | 21 |
| Paths | 64 |
| Total Lines | 76 |
| Code Lines | 50 |
| Lines | 0 |
| Ratio | 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 |
||
| 20 | public static function EFT($array) |
||
| 21 | { |
||
| 22 | $eft = ""; |
||
| 23 | $item = ""; |
||
| 24 | if (isset($array["low"])) foreach ($array["low"] as $flags) |
||
| 25 | { |
||
| 26 | foreach ($flags as $items) |
||
| 27 | { |
||
| 28 | $item = $items["typeName"] . "\n"; |
||
| 29 | } |
||
| 30 | $eft .= $item; |
||
| 31 | } |
||
| 32 | $eft .= "\n"; |
||
| 33 | $item = ""; |
||
| 34 | if (isset($array["mid"])) foreach ($array["mid"] as $flags) |
||
| 35 | { |
||
| 36 | $cnt = 0; |
||
| 37 | foreach ($flags as $items) |
||
| 38 | { |
||
| 39 | if ($cnt == 0) |
||
| 40 | $item = $items["typeName"]; |
||
| 41 | else |
||
| 42 | $item .= "," . $items["typeName"]; |
||
| 43 | $cnt++; |
||
| 44 | } |
||
| 45 | $item .= "\n"; |
||
| 46 | $eft .= $item; |
||
| 47 | } |
||
| 48 | $eft .= "\n"; |
||
| 49 | $item = ""; |
||
| 50 | if (isset($array["high"])) foreach ($array["high"] as $flags) |
||
| 51 | { |
||
| 52 | $cnt = 0; |
||
| 53 | foreach ($flags as $items) |
||
| 54 | { |
||
| 55 | if ($cnt == 0) |
||
| 56 | $item = $items["typeName"]; |
||
| 57 | else |
||
| 58 | $item .= "," . $items["typeName"]; |
||
| 59 | $cnt++; |
||
| 60 | } |
||
| 61 | $item .= "\n"; |
||
| 62 | $eft .= $item; |
||
| 63 | } |
||
| 64 | $eft .= "\n"; |
||
| 65 | $item = ""; |
||
| 66 | if (isset($array["rig"])) foreach ($array["rig"] as $flags) |
||
| 67 | { |
||
| 68 | foreach ($flags as $items) |
||
| 69 | { |
||
| 70 | $item = $items["typeName"] . "\n"; |
||
| 71 | } |
||
| 72 | $eft .= $item; |
||
| 73 | } |
||
| 74 | $eft .= "\n"; |
||
| 75 | $item = ""; |
||
| 76 | if (isset($array["sub"])) foreach ($array["sub"] as $flags) |
||
| 77 | { |
||
| 78 | foreach ($flags as $items) |
||
| 79 | { |
||
| 80 | $item = $items["typeName"] . "\n"; |
||
| 81 | } |
||
| 82 | $eft .= $item; |
||
| 83 | } |
||
| 84 | $eft .= "\n"; |
||
| 85 | $item = ""; |
||
| 86 | if (isset($array["drone"])) foreach ($array["drone"] as $flags) |
||
| 87 | { |
||
| 88 | foreach ($flags as $items) |
||
| 89 | { |
||
| 90 | $item .= $items["typeName"] . " x" . $items["qty"] . "\n"; |
||
| 91 | } |
||
| 92 | $eft .= $item; |
||
| 93 | } |
||
| 94 | return trim($eft); |
||
| 95 | } |
||
| 96 | |||
| 122 |