| Conditions | 10 |
| Paths | 50 |
| Total Lines | 31 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 50 | public function getToolTip($langs, $soc, $type) |
||
| 51 | { |
||
| 52 | global $db; |
||
| 53 | |||
| 54 | $langs->load("admin"); |
||
| 55 | |||
| 56 | $s = ''; |
||
| 57 | if ($type == -1) { |
||
| 58 | $s .= $langs->trans("Name") . ': <b>' . $this->name . '</b><br>'; |
||
| 59 | $s .= $langs->trans("Version") . ': <b>' . $this->getVersion() . '</b><br>'; |
||
| 60 | } |
||
| 61 | //$s.='<br>'; |
||
| 62 | //$s.='<u>'.$langs->trans("ThisIsModuleRules").':</u><br>'; |
||
| 63 | $s .= '<br>'; |
||
| 64 | if ($type == 0 || $type == -1) { |
||
| 65 | $result = $this->get_code($db, $soc, 'customer'); |
||
| 66 | $nextval = $this->code; |
||
| 67 | if (empty($nextval)) { |
||
| 68 | $nextval = $langs->trans("Undefined"); |
||
| 69 | } |
||
| 70 | $s .= $langs->trans("NextValue") . ($type == -1 ? ' (' . $langs->trans("Customer") . ')' : '') . ': <b>' . $nextval . '</b><br>'; |
||
| 71 | } |
||
| 72 | if ($type == 1 || $type == -1) { |
||
| 73 | $result = $this->get_code($db, $soc, 'supplier'); |
||
| 74 | $nextval = $this->code; |
||
| 75 | if (empty($nextval)) { |
||
| 76 | $nextval = $langs->trans("Undefined"); |
||
| 77 | } |
||
| 78 | $s .= $langs->trans("NextValue") . ($type == -1 ? ' (' . $langs->trans("Supplier") . ')' : '') . ': <b>' . $nextval . '</b>'; |
||
| 79 | } |
||
| 80 | return $s; |
||
| 81 | } |
||
| 102 |