Define a constant instead of duplicating this literal "required" 7 times. Open
'name' => ['required' => 1, 'default' => '', 'purifyType' => \APP\Purifier::TEXT, 'label' => 'FL_NAME', 'maximumlength' => 255],
- 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 "label" 7 times. Open
'name' => ['required' => 1, 'default' => '', 'purifyType' => \APP\Purifier::TEXT, 'label' => 'FL_NAME', 'maximumlength' => 255],
- 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 "maximumlength" 7 times. Open
'name' => ['required' => 1, 'default' => '', 'purifyType' => \APP\Purifier::TEXT, 'label' => 'FL_NAME', 'maximumlength' => 255],
- 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 "purifyType" 7 times. Open
'name' => ['required' => 1, 'default' => '', 'purifyType' => \APP\Purifier::TEXT, 'label' => 'FL_NAME', 'maximumlength' => 255],
- 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.
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_Wapro_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks
The class Settings_Wapro_Module_Model is not named in CamelCase. Open
class Settings_Wapro_Module_Model extends Settings_Vtiger_Module_Model
{
/** {@inheritdoc} */
public $name = 'Wapro';
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
public $baseTable = \App\Integrations\Wapro::TABLE_NAME;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'username' => 'FL_USERNAME',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $baseIndex = 'id';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCreateRecordUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $name = 'Wapro';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return "index.php?parent=Settings&module={$this->getName()}&view=List";
- 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 static $formFields = [
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
'name' => ['required' => 1, 'default' => '', 'purifyType' => \APP\Purifier::TEXT, 'label' => 'FL_NAME', 'maximumlength' => 255],
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
'status' => ['required' => 0, 'purifyType' => \App\Purifier::BOOL, 'label' => 'FL_STATUS', 'maximumlength' => 2],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'server' => 'FL_SERVER',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $listFields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => 'FL_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
return "index.php?parent=Settings&module={$this->getName()}&view=Edit";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => ['required' => 1, 'default' => '', 'purifyType' => \APP\Purifier::TEXT, 'label' => 'FL_NAME', 'maximumlength' => 255],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'port' => ['required' => 0, 'purifyType' => 'port', 'label' => 'FL_PORT', 'maximumlength' => 255, 'default' => 1433],
- 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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDefaultUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'password' => ['required' => 1, 'purifyType' => \App\Purifier::TEXT, 'label' => 'FL_PASSWORD', 'maximumlength' => 150],
- 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
'server' => ['required' => 1, 'purifyType' => 'ipOrDomain', 'label' => 'FL_SERVER', 'maximumlength' => 255],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'database' => 'FL_DATABASE',
- 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
'database' => ['required' => 1, 'purifyType' => 'dbName', 'label' => 'FL_DATABASE', 'maximumlength' => 255],
- 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 array Field form array. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'username' => ['required' => 1, 'purifyType' => 'dbUserName', 'label' => 'FL_USERNAME', 'maximumlength' => 255],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => 'FL_NAME',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- 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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => ['required' => 0, 'purifyType' => \App\Purifier::BOOL, 'label' => 'FL_STATUS', 'maximumlength' => 2],
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
'port' => ['required' => 0, 'purifyType' => 'port', 'label' => 'FL_PORT', 'maximumlength' => 255, 'default' => 1433],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return list fields in form.
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
'password' => ['required' => 1, 'purifyType' => \App\Purifier::TEXT, 'label' => 'FL_PASSWORD', 'maximumlength' => 150],
- 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
return static::$formFields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFormFields(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Class name "Settings_Wapro_Module_Model" is not in camel caps format Open
class Settings_Wapro_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks