Avoid using static access to class 'Settings_FieldsDependency_Record_Model' in method 'process'. Open
$recordModel = Settings_FieldsDependency_Record_Model::getCleanInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Vtiger_Module_Model' in method 'process'. Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Condition' in method 'process'. Open
$recordModel->set('conditions', \App\Condition::getConditionsFromRequest($request->getArray('conditions', 'Text')));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_FieldsDependency_Record_Model' in method 'process'. Open
$recordModel = Settings_FieldsDependency_Record_Model::getInstanceById($recordId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$recordModel = Settings_FieldsDependency_Record_Model::getCleanInstance();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Call to undeclared method \Settings_Vtiger_Module_Model::getDefaultUrl
Open
header('location: ' . $moduleModel->getDefaultUrl());
- Exclude checks
Call to method getCleanInstance
from undeclared class \Settings_FieldsDependency_Record_Model
Open
$recordModel = Settings_FieldsDependency_Record_Model::getCleanInstance();
- Exclude checks
Call to method getInstanceById
from undeclared class \Settings_FieldsDependency_Record_Model
Open
$recordModel = Settings_FieldsDependency_Record_Model::getInstanceById($recordId);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_FieldsDependency_Save_Action extends Settings_Vtiger_Basic_Action
- Exclude checks
The class Settings_FieldsDependency_Save_Action is not named in CamelCase. Open
class Settings_FieldsDependency_Save_Action extends Settings_Vtiger_Basic_Action
{
/** {@inheritdoc} */
public function process(App\Request $request)
{
- 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
$recordId = $request->getInteger('record');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('mandatory', $request->getBoolean('mandatory'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($recordId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('fields', $request->getArray('fields', 'AlnumExtended'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$recordModel->set('conditions', \App\Condition::getConditionsFromRequest($request->getArray('conditions', 'Text')));
- 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
$recordModel->set('name', $request->getByType('name', 'Text'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('status', $request->getBoolean('status'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
header('location: ' . $moduleModel->getDefaultUrl());
- 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 function process(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Settings_FieldsDependency_Record_Model::getInstanceById($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Settings_FieldsDependency_Record_Model::getCleanInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('tabid', $request->getInteger('tabid'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('views', $request->getArray('views', 'Standard'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('gui', $request->getBoolean('gui'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('conditions', \App\Condition::getConditionsFromRequest($request->getArray('conditions', 'Text')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$qualifiedModuleName = $request->getModule(false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = null;
- 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
if (!$request->isEmpty('record')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Class name "Settings_FieldsDependency_Save_Action" is not in camel caps format Open
class Settings_FieldsDependency_Save_Action extends Settings_Vtiger_Basic_Action
- Exclude checks