xoops_module_pre_install_cardealer accesses the super-global variable $GLOBALS. Open
function xoops_module_pre_install_cardealer(\XoopsModule $module)
{
/** @var Cardealer\Utility $utility */
$utility = new Cardealer\Utility();
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
xoops_module_pre_install_cardealer accesses the super-global variable $GLOBALS. Open
function xoops_module_pre_install_cardealer(\XoopsModule $module)
{
/** @var Cardealer\Utility $utility */
$utility = new Cardealer\Utility();
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
xoops_module_install_cardealer accesses the super-global variable $GLOBALS. Open
function xoops_module_install_cardealer(\XoopsModule $module)
{
$moduleDirName = basename(dirname(__DIR__));
/** @var Cardealer\Helper $helper */
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
xoops_module_install_cardealer accesses the super-global variable $GLOBALS. Open
function xoops_module_install_cardealer(\XoopsModule $module)
{
$moduleDirName = basename(dirname(__DIR__));
/** @var Cardealer\Helper $helper */
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Method xoops_module_install_cardealer
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoops_module_install_cardealer(\XoopsModule $module)
{
$moduleDirName = basename(dirname(__DIR__));
/** @var Cardealer\Helper $helper */
Function xoops_module_install_cardealer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function xoops_module_install_cardealer(\XoopsModule $module)
{
$moduleDirName = basename(dirname(__DIR__));
/** @var Cardealer\Helper $helper */
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid using static access to class '\XoopsModules\Cardealer\Helper' in method 'xoops_module_install_cardealer'. Open
$helper = Cardealer\Helper::getInstance();
- 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 unused local variables such as '$moduleId2'. Open
$moduleId2 = $helper->getModule()->mid();
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 36 and the first side effect is on line 28. Open
<?php
- Exclude checks
Line exceeds 120 characters; contains 165 characters Open
$sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
- Exclude checks