modules/Products/views/Widget.php
Avoid using static access to class 'Products_SummaryWidget_Model' in method 'showProductsServices'. Open
Open
$moduleModel = Products_SummaryWidget_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
Call to undeclared method \Vtiger_Viewer::assign
Open
Open
$viewer->assign('RECORDID', $request->getInteger('record'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
Open
$viewer->assign('MODULE_NAME', $moduleName);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
Open
$viewer->assign('SOURCE_MODULE', $fromModule);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
Open
$viewer->assign('RELATED_MODULE', $mod);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Products_Widget_View extends Vtiger_Index_View
- Exclude checks
The class Products_Widget_View is not named in CamelCase. Open
Open
class Products_Widget_View extends Vtiger_Index_View
{
use \App\Controller\ExposeMethod;
public function __construct()
- 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
Open
$moduleModel = Products_SummaryWidget_Model::getCleanInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$fromModule = $request->getByType('fromModule');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$viewer->assign('SOURCE_MODULE', $fromModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$viewer = $this->getViewer($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function showProductsServices(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$moduleModel->getProductsServices($request, $viewer);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$viewer->assign('RECORDID', $request->getInteger('record'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$viewer->assign('RELATED_MODULE', $mod);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
use \App\Controller\ExposeMethod;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$moduleName = $request->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$viewer->assign('MODULE_NAME', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->exposeMethod('showProductsServices');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function __construct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$mod = current($request->getArray('mod', 'Alnum'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$viewer->view('Detail/Widget/ProductsServices.tpl', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Class name "Products_Widget_View" is not in camel caps format Open
Open
class Products_Widget_View extends Vtiger_Index_View
- Exclude checks