Define a constant instead of duplicating this literal "validation" 4 times. Open
'validation' => '\App\Validator::standard'
- 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 "default" 5 times. Open
'default' => '2 month',
- 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 "description" 5 times. Open
'description' => 'How long before the renewal date should the status be changed
- 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.
Spaces must be used to indent lines; tabs are not allowed Open
'SHOW_HIERARCHY_IN_MODAL' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = $moduleModel->getFields();
- 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
$moduleModel = Vtiger_Module_Model::getInstance('Assets');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'Call a callback: ["class" => "", "method" => "", "hierarchy" => ""]',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$args = func_get_arg(0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \in_array($field, $args);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'RENEWAL_CUSTOMER_FUNCTION' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'default' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'default' => '2 month',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'How long before the renewal date should the status be changed
- 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
'validation' => function () {
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'default' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'SHOW_RELATION_IN_MODAL' => [
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
'default' => ['relationField' => 'parent_id', 'module' => 'Accounts', 'relatedModule' => ['FInvoice', 'ModComments', 'Calendar', 'Documents']],
- 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
'RENEWAL_TIME' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'SHOW_FIELD_IN_MODAL' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'Show relations in the modal',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'false, [] - inherit fields, [ label => column name, .. ]',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'default' => ['relationField' => 'parent_id', 'module' => 'Accounts', 'relatedModule' => ['FInvoice', 'ModComments', 'Calendar', 'Documents']],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'validation' => function () {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- 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
'default' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'validation' => '\App\Validator::standard'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'Show fields in the modal'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $field => $key) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'validation' => ''
- Exclude checks