modules/Vtiger/widgets/DetailView.php
Avoid using static access to class 'Vtiger_Module_Model' in method 'getWidget'. Open
Open
$model = Vtiger_Module_Model::getInstance($moduleName);
- 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
Suspicious type false
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
return 'module=' . $this->Module . '&view=Detail&record=' . $this->Record . '&mode=showModuleDetailView&toWidget=true';
- Exclude checks
Argument 1 (mixed)
is false
but \Vtiger_Module_Model::getInstance()
takes int|string
defined at /code/modules/Vtiger/models/Module.php:197
Open
Open
$model = Vtiger_Module_Model::getInstance($moduleName);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Vtiger_DetailView_Widget extends Vtiger_Basic_Widget
- Exclude checks
The class Vtiger_DetailView_Widget is not named in CamelCase. Open
Open
class Vtiger_DetailView_Widget extends Vtiger_Basic_Widget
{
/**
* Return url.
*
- 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
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($model->isPermitted('DetailView')) {
- 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
$moduleName = $this->Module;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getUrl()
- 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 getWidget()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Function return widget.
- 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
$widget = [];
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$widget = $this->Config;
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->Config['url'] = $this->getUrl();
- 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
return 'DetailViewConfig';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Return url.
- 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 getConfigTplName()
- 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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return 'module=' . $this->Module . '&view=Detail&record=' . $this->Record . '&mode=showModuleDetailView&toWidget=true';
- 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
return $widget;
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
Open
return 'module=' . $this->Module . '&view=Detail&record=' . $this->Record . '&mode=showModuleDetailView&toWidget=true';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->Config['tpl'] = 'DetailView.tpl';
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$model = Vtiger_Module_Model::getInstance($moduleName);
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Function return config template name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Class name "Vtiger_DetailView_Widget" is not in camel caps format Open
Open
class Vtiger_DetailView_Widget extends Vtiger_Basic_Widget
- Exclude checks