| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 31 |
| 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 |
||
| 43 | public function __construct($db) |
||
| 44 | { |
||
| 45 | $this->db = $db; |
||
| 46 | $this->numero = 60; |
||
| 47 | |||
| 48 | $this->family = "technic"; |
||
| 49 | $this->module_position = '75'; |
||
| 50 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
||
| 51 | $this->name = preg_replace('/^mod/i', '', get_only_class($this)); |
||
| 52 | $this->description = "Management of stickers"; |
||
| 53 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
||
| 54 | $this->version = 'development'; |
||
| 55 | $this->const_name = 'MAIN_MODULE_' . static::getNameOf($this->name); // strtoupper($this->name); |
||
| 56 | $this->picto = 'generic'; |
||
| 57 | |||
| 58 | // Data directories to create when module is enabled |
||
| 59 | $this->dirs = array("/label/temp"); |
||
| 60 | |||
| 61 | // Dependencies |
||
| 62 | $this->hidden = false; // A condition to hide module |
||
| 63 | $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
||
| 64 | $this->requiredby = array(); // List of module ids to disable if this one is disabled |
||
| 65 | $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
||
| 66 | $this->phpmin = array(7, 0); // Minimum version of PHP required by module |
||
| 67 | |||
| 68 | // Config pages |
||
| 69 | // $this->config_page_url = array("label.php"); |
||
| 70 | |||
| 71 | // Constants |
||
| 72 | $this->const = array(); |
||
| 73 | |||
| 74 | // Boxes |
||
| 75 | $this->boxes = array(); |
||
| 76 | |||
| 77 | // Permissions |
||
| 78 | $this->rights = array(); |
||
| 79 | $this->rights_class = 'label'; |
||
| 80 | |||
| 81 | $this->rights[1][0] = 601; // id de la permission |
||
| 82 | $this->rights[1][1] = 'Read stickers'; |
||
| 83 | $this->rights[1][3] = 0; // La permission est-elle une permission par default |
||
| 84 | $this->rights[1][4] = 'lire'; |
||
| 85 | |||
| 86 | $this->rights[2][0] = 602; // id de la permission |
||
| 87 | $this->rights[2][1] = 'Create/modify stickers'; |
||
| 88 | $this->rights[2][3] = 0; // La permission est-elle une permission par default |
||
| 89 | $this->rights[2][4] = 'creer'; |
||
| 90 | |||
| 91 | $this->rights[4][0] = 609; // id de la permission |
||
| 92 | $this->rights[4][1] = 'Delete stickers'; |
||
| 93 | $this->rights[4][3] = 0; // La permission est-elle une permission par default |
||
| 94 | $this->rights[4][4] = 'supprimer'; |
||
| 95 | } |
||
| 115 |