Method process
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
\App\Log::trace(__METHOD__ . ' | Start');
$sourceModule = $request->getByType('sourceModule', 2);
$widgetsManagementModel = new Settings_WidgetsManagement_Module_Model();
Missing class import via use statement (line '22', column '33'). Open
$widgetsManagementModel = new Settings_WidgetsManagement_Module_Model();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class 'Settings_WidgetsManagement_Module_Model' in method 'process'. Open
$currentDashboard = $request->isEmpty('dashboardId', true) ? Settings_WidgetsManagement_Module_Model::getDefaultDashboard() : $request->getInteger('dashboardId');
- 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\Log' in method 'process'. Open
\App\Log::trace(__METHOD__ . ' | Start');
- 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_WidgetsManagement_Module_Model' in method 'process'. Open
$specialWidgets = Settings_WidgetsManagement_Module_Model::getSpecialWidgets($sourceModule);
- 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_WidgetsManagement_Module_Model' in method 'process'. Open
$viewer->assign('DATE_SELECT_DEFAULT', Settings_WidgetsManagement_Module_Model::getDateSelectDefault());
- 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\Log' in method 'process'. Open
\App\Log::trace(__METHOD__ . ' | End');
- 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_WidgetsManagement_Module_Model' in method 'process'. Open
$viewer->assign('DASHBOARD_TYPES', Settings_WidgetsManagement_Module_Model::getDashboardTypes());
- 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_WebserviceApps_Module_Model' in method 'process'. Open
$viewer->assign('ALL_SERVERS', Settings_WebserviceApps_Module_Model::getServers());
- 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_Roles_Record_Model' in method 'process'. Open
$authorization = Settings_Roles_Record_Model::getAll();
- 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
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('DEFAULTVALUES', $defaultValues);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('FILTER_SELECT', $filterSelect);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SIZE', $size);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('QUALIFIED_MODULE', $request->getModule(false));
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | Start');
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ALL_SERVERS', Settings_WebserviceApps_Module_Model::getServers());
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SPECIAL_WIDGETS', $specialWidgets);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('WIDGETS', $widgets);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('DASHBOARD_TYPES', Settings_WidgetsManagement_Module_Model::getDashboardTypes());
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('FILTER_SELECT_DEFAULT', $filterSelectDefault);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('DATE_SELECT_DEFAULT', Settings_WidgetsManagement_Module_Model::getDateSelectDefault());
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('CURRENT_DASHBOARD', $currentDashboard);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SELECTED_MODULE_NAME', $sourceModule);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ALL_AUTHORIZATION', $authorization);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('WIDGETS_AUTHORIZATION_INFO', $dashboardStored);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SUPPORTED_MODULES', array_keys($dashboardModules));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('DASHBOARD_AUTHORIZATION_BLOCKS', $blocks[$sourceModule] ?? []);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TITLE_OF_LIMIT', $widgetsWithLimit);
- Exclude checks
Avoid excessively long class names like Settings_WidgetsManagement_Configuration_View. Keep class name length under 40. Open
class Settings_WidgetsManagement_Configuration_View extends Settings_Vtiger_Index_View
{
/**
* Process.
*
- Read upRead up
- Exclude checks
LongClassName
Since: 2.9
Detects when classes or interfaces are declared with excessively long names.
Example
class ATooLongClassNameThatHintsAtADesignProblem {
}
interface ATooLongInterfaceNameThatHintsAtADesignProblem {
}
Source https://phpmd.org/rules/naming.html#longclassname
Avoid excessively long variable names like $widgetsManagementModel. Keep variable name length under 20. Open
$widgetsManagementModel = new Settings_WidgetsManagement_Module_Model();
- 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 Settings_WidgetsManagement_Configuration_View extends Settings_Vtiger_Index_View
- Exclude checks
The class Settings_WidgetsManagement_Configuration_View is not named in CamelCase. Open
class Settings_WidgetsManagement_Configuration_View extends Settings_Vtiger_Index_View
{
/**
* Process.
*
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$widgets = $dashboardModules[$sourceModule];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filterSelect = $widgetsManagementModel->getFilterSelect();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('FILTER_SELECT', $filterSelect);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SUPPORTED_MODULES', array_keys($dashboardModules));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceModule = $request->getByType('sourceModule', 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$widgetsManagementModel = new Settings_WidgetsManagement_Module_Model();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('FILTER_SELECT_DEFAULT', $filterSelectDefault);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SPECIAL_WIDGETS', $specialWidgets);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDashboard = $request->isEmpty('dashboardId', true) ? Settings_WidgetsManagement_Module_Model::getDefaultDashboard() : $request->getInteger('dashboardId');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo $viewer->view('Configuration.tpl', $request->getModule(false), true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$specialWidgets = Settings_WidgetsManagement_Module_Model::getSpecialWidgets($sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('WIDGETS_AUTHORIZATION_INFO', $dashboardStored);
- 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
$dashboardModules = $widgetsManagementModel->getSelectableDashboard();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($sourceModule)) {
- Exclude checks
Line exceeds 120 characters; contains 170 characters Open
$currentDashboard = $request->isEmpty('dashboardId', true) ? Settings_WidgetsManagement_Module_Model::getDefaultDashboard() : $request->getInteger('dashboardId');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('DASHBOARD_TYPES', Settings_WidgetsManagement_Module_Model::getDashboardTypes());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceModule = 'Home';
- 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
$filterSelectDefault = $widgetsManagementModel->getFilterSelectDefault();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer = $this->getViewer($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$size = $widgetsManagementModel->getSize();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ALL_SERVERS', Settings_WebserviceApps_Module_Model::getServers());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('DASHBOARD_AUTHORIZATION_BLOCKS', $blocks[$sourceModule] ?? []);
- 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
$defaultValues = $widgetsManagementModel->getDefaultValues();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('CURRENT_DASHBOARD', $currentDashboard);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | Start');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// get widgets list
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SIZE', $size);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('WIDGETS', $widgets);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Process.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$widgetsWithLimit = $widgetsManagementModel->getWidgetsWithLimit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('DATE_SELECT_DEFAULT', Settings_WidgetsManagement_Module_Model::getDateSelectDefault());
- 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
$authorization = Settings_Roles_Record_Model::getAll();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ALL_AUTHORIZATION', $authorization);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SELECTED_MODULE_NAME', $sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('DEFAULTVALUES', $defaultValues);
- 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
$dashboardStored = $widgetsManagementModel->getDashboardForModule($sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blocks = $widgetsManagementModel->getBlocksId($currentDashboard);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('QUALIFIED_MODULE', $request->getModule(false));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TITLE_OF_LIMIT', $widgetsWithLimit);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Class name "Settings_WidgetsManagement_Configuration_View" is not in camel caps format Open
class Settings_WidgetsManagement_Configuration_View extends Settings_Vtiger_Index_View
- Exclude checks