The class ProjectMilestone has 18 fields. Consider redesigning ProjectMilestone to keep the number of fields under 15. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
- Exclude checks
Define a constant instead of duplicating this literal "vtiger_projectmilestone" 3 times. Open
public $table_name = 'vtiger_projectmilestone';
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "projectmilestone" 6 times. Open
'Project Milestone Name' => ['projectmilestone', 'projectmilestonename'],
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_projectmilestonecf" 3 times. Open
public $customFieldTable = ['vtiger_projectmilestonecf', 'projectmilestoneid'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "projectmilestonename" 6 times. Open
'Project Milestone Name' => 'projectmilestonename',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "projectmilestoneid" 4 times. Open
public $table_index = 'projectmilestoneid';
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "projectid" 3 times. Open
'Related to' => 'projectid',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Avoid excessively long variable names like $def_detailview_recname. Keep variable name length under 20. Open
public $def_detailview_recname = 'projectmilestonename';
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class ProjectMilestone extends CRMEntity
- Exclude checks
The property $column_fields is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $def_basicsearch_col is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $table_index is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $search_fields_name is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $default_sort_order is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $mandatory_fields is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $table_name is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $default_order_by is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $def_detailview_recname is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $tab_name_index is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $tab_name is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $list_fields_name is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $popup_fields is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $special_functions is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $search_fields is not named in camelCase. Open
class ProjectMilestone extends CRMEntity
{
public $table_name = 'vtiger_projectmilestone';
public $table_index = 'projectmilestoneid';
public $column_fields = [];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $table_index = 'projectmilestoneid';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'FL_STATUS' => 'projectmilestone_status',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_crmentity' => 'crmid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_projectmilestonecf' => 'projectmilestoneid', ];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Format: Field Label => fieldname
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $IsCustomModule = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $tab_name_index = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// tablename should not have prefix 'vtiger_'
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
\App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Milestone Date' => 'projectmilestonedate',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Related to' => 'projectid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $customFieldTable = ['vtiger_projectmilestonecf', 'projectmilestoneid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Project Milestone Name' => ['projectmilestone', 'projectmilestonename'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Project Milestone Name' => 'projectmilestonename',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $relationFields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $search_fields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//'Assigned To' => 'assigned_user_id'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// For Popup listview and UI type support
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Milestone Date' => ['projectmilestone', 'projectmilestonedate'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// For Popup window record selection
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $def_detailview_recname = 'projectmilestonename';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Mark the module as Standard module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Mandatory table for supporting custom fields.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $tab_name = ['vtiger_crmentity', 'vtiger_projectmilestone', 'vtiger_projectmilestonecf'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Mandatory for Saving, Include tablename and tablekey columnname here.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $list_fields_name = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Mandatory for Saving, Include tables related to this module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $def_basicsearch_col = 'projectmilestonename';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Column value to use on detail view record text display
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Invoked when special actions are performed on the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName Module name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'FL_PARENT_PROJECT_MILESTONE' => ['projectmilestone', 'parentid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('module.postinstall' === $eventType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $table_name = 'vtiger_projectmilestone';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Type' => 'projectmilestonetype',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// For Alphabetical search
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Related to' => ['projectmilestone', 'projectid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $search_fields_name = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string[] List of fields in the RelationListView
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $popup_fields = ['projectmilestonename'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $special_functions = ['set_import_assigned_user'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $default_order_by = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Callback function list during Importing
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $default_sort_order = 'ASC';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Used when enabling/disabling the mandatory fields for the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $mandatory_fields = ['createdtime', 'modifiedtime', 'projectmilestonename', 'projectid', 'assigned_user_id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'FL_STATUS' => ['projectmilestone', 'projectmilestone_status'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'FL_PARENT_PROJECT_MILESTONE' => 'parentid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Type' => ['projectmilestone', 'projectmilestonetype'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function moduleHandler($moduleName, $eventType)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $column_fields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** Indicator if this is a custom module or standard module */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_projectmilestone' => 'projectmilestoneid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Format: Field Label => Array(tablename, columnname)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Refers to vtiger_field.fieldname values.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $eventType Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
- Exclude checks