| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 30 |
| 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 |
||
| 44 | public function __construct($db) |
||
| 45 | { |
||
| 46 | $this->db = $db; |
||
| 47 | $this->numero = 1520; |
||
| 48 | |||
| 49 | $this->family = "technic"; |
||
| 50 | $this->module_position = '78'; |
||
| 51 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
||
| 52 | $this->name = preg_replace('/^mod/i', '', get_only_class($this)); |
||
| 53 | $this->description = "Direct mail document generation"; |
||
| 54 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
||
| 55 | $this->version = 'development'; |
||
| 56 | |||
| 57 | $this->const_name = 'MAIN_MODULE_' . static::getNameOf($this->name); // strtoupper($this->name); |
||
| 58 | $this->picto = 'email'; |
||
| 59 | |||
| 60 | // Data directories to create when module is enabled |
||
| 61 | $this->dirs = array("/documentgeneration/temp"); |
||
| 62 | |||
| 63 | // Config pages |
||
| 64 | //$this->config_page_url = array("document.php"); |
||
| 65 | |||
| 66 | // Dependencies |
||
| 67 | $this->depends = array(); |
||
| 68 | $this->requiredby = array(); |
||
| 69 | $this->conflictwith = array(); |
||
| 70 | $this->langfiles = array("orders", "bills", "companies", "mails"); |
||
| 71 | |||
| 72 | // Constants |
||
| 73 | |||
| 74 | $this->const = array(); |
||
| 75 | |||
| 76 | // Boxes |
||
| 77 | $this->boxes = array(); |
||
| 78 | |||
| 79 | // Permissions |
||
| 80 | $this->rights = array(); |
||
| 81 | $this->rights_class = 'document'; |
||
| 82 | |||
| 83 | $r = 0; |
||
| 84 | |||
| 85 | $this->rights[$r][0] = 1521; |
||
| 86 | $this->rights[$r][1] = 'Lire les documents'; |
||
| 87 | $this->rights[$r][2] = 'r'; |
||
| 88 | $this->rights[$r][3] = 0; |
||
| 89 | $this->rights[$r][4] = 'lire'; |
||
| 90 | |||
| 91 | $r++; |
||
| 92 | $this->rights[$r][0] = 1522; |
||
| 93 | $this->rights[$r][1] = 'Supprimer les documents clients'; |
||
| 94 | $this->rights[$r][2] = 'd'; |
||
| 95 | $this->rights[$r][3] = 0; |
||
| 96 | $this->rights[$r][4] = 'supprimer'; |
||
| 97 | } |
||
| 120 |