| Conditions | 4 |
| Paths | 6 |
| Total Lines | 67 |
| Code Lines | 28 |
| 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 |
||
| 37 | function __construct($db) |
||
| 38 | { |
||
| 39 | global $langs,$conf,$mysoc; |
||
| 40 | |||
| 41 | $this->db = $db; |
||
| 42 | $this->numero = 3200; |
||
| 43 | |||
| 44 | // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
||
| 45 | // It is used to group modules in module setup page |
||
| 46 | $this->family = "base"; |
||
| 47 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
||
| 48 | $this->name = preg_replace('/^mod/i','',get_class($this)); |
||
| 49 | $this->description = "Enable a log on some business events into a non reversible log. This module may be mandatory for some countries."; |
||
| 50 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
||
| 51 | $this->version = 'experimental'; |
||
| 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 = 2; |
||
| 56 | // Name of image file used for this module. |
||
| 57 | $this->picto='technic'; |
||
| 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('blockedlog.php@blockedlog'); |
||
| 65 | |||
| 66 | // Dependancies |
||
| 67 | //------------- |
||
| 68 | $this->hidden = false; // A condition to disable module |
||
| 69 | $this->depends = array('always'=>'modFacture'); // List of modules id that must be enabled if this module is enabled |
||
|
1 ignored issue
–
show
|
|||
| 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('blockedlog'); |
||
| 73 | |||
| 74 | $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
||
| 75 | $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) |
||
| 76 | $this->warnings_unactivation = array('FR'=>'BlockedLogAreRequiredByYourCountryLegislation'); |
||
| 77 | |||
| 78 | // Currently, activation is not automatic because only companies (in France) making invoices to non business customers must |
||
| 79 | // enable this module. |
||
| 80 | // It is automatic only if $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY is on. |
||
| 81 | if (! empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY)) |
||
| 82 | { |
||
| 83 | $this->automatic_activation = array('FR'=>'BlockedLogActivatedBecauseRequiredByYourCountryLegislation'); |
||
| 84 | } |
||
| 85 | |||
| 86 | $this->always_enabled = !empty($conf->blockedlog->enabled) && !empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY) && in_array($mysoc->country_code, explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY)); |
||
| 87 | |||
| 88 | // Constants |
||
| 89 | //----------- |
||
| 90 | $this->const = array(); |
||
| 91 | |||
| 92 | // New pages on tabs |
||
| 93 | // ----------------- |
||
| 94 | $this->tabs = array(); |
||
| 95 | |||
| 96 | // Boxes |
||
| 97 | //------ |
||
| 98 | $this->boxes = array(); |
||
| 99 | |||
| 100 | // Main menu entries |
||
| 101 | //------------------ |
||
| 102 | $this->menu = array(); |
||
| 103 | } |
||
| 104 | |||
| 152 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..