| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 21 |
| 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 |
||
| 38 | function __construct($db) |
||
| 39 | { |
||
| 40 | global $langs,$conf; |
||
| 41 | |||
| 42 | $this->db = $db; |
||
| 43 | $this->numero = 3200; |
||
| 44 | |||
| 45 | // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
||
| 46 | // It is used to group modules in module setup page |
||
| 47 | $this->family = "technic"; |
||
| 48 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
||
| 49 | $this->name = preg_replace('/^mod/i','',get_class($this)); |
||
| 50 | $this->description = "Enable a log of some business events into a non reversible block chain. This module may be mandatory for some countries."; |
||
| 51 | $this->version = 'development'; // 'development', 'experimental' or 'dolibarr' or version |
||
| 52 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
||
| 53 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
||
| 54 | // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) |
||
| 55 | $this->special = 1; |
||
| 56 | // Name of image file used for this module. |
||
| 57 | $this->picto='skype'; |
||
| 58 | |||
| 59 | // Data directories to create when module is enabled |
||
| 60 | $this->dirs = array(); |
||
| 61 | |||
| 62 | // Config pages |
||
| 63 | //------------- |
||
| 64 | $this->config_page_url = array(); |
||
| 65 | |||
| 66 | // Dependancies |
||
| 67 | //------------- |
||
| 68 | $this->hidden = false; // A condition to disable module |
||
| 69 | $this->depends = array('modFacture'); // List of modules id that must be enabled if this module is enabled |
||
| 70 | $this->requiredby = array(); // List of modules id to disable if this one is disabled |
||
| 71 | $this->conflictwith = array(); // List of modules id this module is in conflict with |
||
| 72 | $this->langfiles = array(); |
||
| 73 | |||
| 74 | // Constants |
||
| 75 | //----------- |
||
| 76 | |||
| 77 | |||
| 78 | // New pages on tabs |
||
| 79 | // ----------------- |
||
| 80 | $this->tabs = array(); |
||
| 81 | |||
| 82 | // Boxes |
||
| 83 | //------ |
||
| 84 | $this->boxes = array(); |
||
| 85 | |||
| 86 | // Main menu entries |
||
| 87 | //------------------ |
||
| 88 | $this->menu = array(); |
||
| 89 | } |
||
| 90 | } |
||
| 91 |