modules/Announcements/views/Detail.php
Avoid using static access to class 'Vtiger_Module_Model' in method 'showUsers'. Open
Open
$moduleModel = 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
Reference to undeclared class \Vtiger_Detail_View
Open
Open
parent::__construct();
- Exclude checks
Call to undeclared method \Vtiger_Module_Model::getUsers
Open
Open
foreach ($moduleModel->getUsers() as $userId => $name) {
- Exclude checks
Call to undeclared method \Vtiger_Module_Model::getMarkInfo
Open
Open
$row = $moduleModel->getMarkInfo($recordId, $userId);
- Exclude checks
Call to undeclared method \Announcements_Detail_View::getViewer
Open
Open
$viewer = $this->getViewer($request);
- Exclude checks
Class extends undeclared class \Vtiger_Detail_View
Open
Open
class Announcements_Detail_View extends Vtiger_Detail_View
- Exclude checks
Call to undeclared method \Announcements_Detail_View::exposeMethod
Open
Open
$this->exposeMethod('showUsers');
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Announcements_Detail_View extends Vtiger_Detail_View
- Exclude checks
The class Announcements_Detail_View is not named in CamelCase. Open
Open
class Announcements_Detail_View extends Vtiger_Detail_View
{
public function __construct()
{
parent::__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
$recordId = $request->getInteger('record');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$viewer->view('UsersList.tpl', $moduleName);
- 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
$this->exposeMethod('showUsers');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$row = $moduleModel->getMarkInfo($recordId, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function showUsers(App\Request $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
$users = [];
- 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 = $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
$viewer->assign('USERS', $users);
- 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
foreach ($moduleModel->getUsers() as $userId => $name) {
- 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
$row['name'] = $name;
- 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
$users[$userId] = $row;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Class name "Announcements_Detail_View" is not in camel caps format Open
Open
class Announcements_Detail_View extends Vtiger_Detail_View
- Exclude checks