Avoid using static access to class '\App\Config' in method 'isAllowModules'. Open
return \in_array($moduleName, \App\Config::module($this->getName(), 'mapModules', []));
- 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\Privilege' in method 'getAllowedModules'. Open
if (!\App\Privilege::isPermitted($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
Avoid using static access to class '\App\Config' in method 'getAllowedModules'. Open
$allAllowedModules = \App\Config::module($this->getName(), 'mapModules', []);
- 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
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class OpenStreetMap_Module_Model extends Vtiger_Module_Model
- Exclude checks
The class OpenStreetMap_Module_Model is not named in CamelCase. Open
class OpenStreetMap_Module_Model extends Vtiger_Module_Model
{
/** @var string Table name of coordinates for records */
const COORDINATES_TABLE_NAME = 'u_#__openstreetmap';
- 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
/** @var string Table name of coordinates for records */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const COORDINATES_TABLE_NAME = 'u_#__openstreetmap';
- 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
return \in_array($moduleName, \App\Config::module($this->getName(), 'mapModules', []));
- 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
* Check if module is allowed.
- 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
}
- 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
if (!\App\Privilege::isPermitted($moduleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($allAllowedModules[$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get allow modules with checking permissions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $allAllowedModules;
- 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
public function isAllowModules($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($allAllowedModules as $key => $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getAllowedModules(): array
- 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
$allAllowedModules = \App\Config::module($this->getName(), 'mapModules', []);
- 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
* @return string[]
- 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
Class name "OpenStreetMap_Module_Model" is not in camel caps format Open
class OpenStreetMap_Module_Model extends Vtiger_Module_Model
- Exclude checks