modules/Campaigns/views/Detail.php
Avoid using static access to class 'Vtiger_CountRecords_Widget' in method 'showCountRecords'. Open
Open
$countRecords = Vtiger_CountRecords_Widget::getCountRecords($relatedModulesNames, $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
Avoid using static access to class '\App\Module' in method 'showCountRecords'. Open
Open
$relatedModulesNames[$tabId] = \App\Module::getModuleName($tabId);
- 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
Reference to undeclared class \Vtiger_Detail_View
Open
Open
parent::__construct();
- Exclude checks
Call to undeclared method \Campaigns_Detail_View::exposeMethod
Open
Open
$this->exposeMethod('showCountRecords');
- Exclude checks
Call to undeclared method \Campaigns_Detail_View::getViewer
Open
Open
$viewer = $this->getViewer($request);
- Exclude checks
Reference to undeclared class \Vtiger_Detail_View
Open
Open
return array_merge(parent::getFooterScripts($request), $this->checkAndConvertJsScripts([
- Exclude checks
Class extends undeclared class \Vtiger_Detail_View
Open
Open
class Campaigns_Detail_View extends Vtiger_Detail_View
- Exclude checks
Call to undeclared method \Campaigns_Detail_View::checkAndConvertJsScripts
Open
Open
return array_merge(parent::getFooterScripts($request), $this->checkAndConvertJsScripts([
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Campaigns_Detail_View extends Vtiger_Detail_View
- Exclude checks
The class Campaigns_Detail_View is not named in CamelCase. Open
Open
class Campaigns_Detail_View extends Vtiger_Detail_View
{
/** {@inheritdoc} */
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
$viewer->assign('MODULE_NAME', $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
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'modules.Vtiger.resources.List',
- 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 $viewer->view('CountRecordsContent.tpl', $moduleName, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
"modules.$moduleName.resources.List",
- 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 = $request->getModule();
- 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
}
- 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
$recordId = $request->getInteger('record');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$relatedModules = $request->getByType('relatedModules');
- 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
$relatedModulesNames = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- 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->exposeMethod('showCountRecords');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function showCountRecords(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
foreach ($relatedModules as $tabId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$countRecords = Vtiger_CountRecords_Widget::getCountRecords($relatedModulesNames, $recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Shows quantity of records.
- 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
$moduleName = $request->getModule();
- 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
$viewer->assign('COUNT_RECORDS', $countRecords);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getFooterScripts(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
"modules.$moduleName.resources.CustomView",
- 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
* @param \App\Request $request
- 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
return array_merge(parent::getFooterScripts($request), $this->checkAndConvertJsScripts([
- 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
$relatedModulesNames[$tabId] = \App\Module::getModuleName($tabId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$viewer->assign('RELATED_MODULES', $relatedModulesNames);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'modules.CustomView.resources.CustomView',
- Exclude checks
Class name "Campaigns_Detail_View" is not in camel caps format Open
Open
class Campaigns_Detail_View extends Vtiger_Detail_View
- Exclude checks