Showing 1,027 of 1,027 total issues
Avoid using static access to class '\XoopsModules\Xfguestbook\Helper' in method 'xfgb_getmsg'. Open
$helper = 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 using static access to class '\XoopsModules\Xfguestbook\Utility' in method 'xfgb_getmsg'. Open
$arr_country = Xfguestbook\Utility::getAllCountry();
- 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
The function xfgb_getmsg() has an NPath complexity of 1153. The configured NPath complexity threshold is 200. Open
function xfgb_getmsg($msg)
{
global $nbmsg, $xoopsModule, $xoopsUser, $xoopsTpl, $xoopsConfig, $options, $opt, $xoopsDB;
/** @var Helper $helper */
$helper = Helper::getInstance();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
Avoid unused local variables such as '$xoopsDB'. Open
global $nbmsg, $xoopsModule, $xoopsUser, $xoopsTpl, $xoopsConfig, $options, $opt, $xoopsDB;
- 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
The method xfgb_getmsg uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$a_msg['country'] = $country_name;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method xfgb_getmsg uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$a_msg = [];
$a_msg['poster'] = $onemsg->getVar('uname');
$a_msg['rank'] = '';
$a_msg['rank_img'] = '';
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid unused local variables such as '$xoopsModule'. Open
global $options, $xoopsTpl, $xoopsModule, $msgHandler;
- 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
The method xfgb_genderlist uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$gender[$i] = MD_XFGUESTBOOK_UNKNOW2 . '<br>';
$gender[$i] .= '<img src="assets/images/U.gif"><br><br>';
$gender[$i] .= $v . MD_XFGUESTBOOK_MESSAGES;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid unused local variables such as '$xoopsConfig'. Open
global $nbmsg, $xoopsModule, $xoopsUser, $xoopsTpl, $xoopsConfig, $options, $opt, $xoopsDB;
- 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
Avoid using static access to class '\XoopsModules\Xfguestbook\Helper' in method 'xfgb_genderlist'. Open
$helper = 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
The method xfgb_getmsg uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$a_msg['country'] = $onemsg->getVar('other');
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
flagUpload accesses the super-global variable $_FILES. Open
function flagUpload($country_code)
{
global $xoopsModule, $maxsize, $maxwidth, $maxheight, $format;
/** @var Helper $helper */
$helper = Helper::getInstance();
- 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
badIpDel accesses the super-global variable $_POST. Open
function badIpDel($ip_id)
{
global $xoopsDB;
$ip_count = (!empty($_POST['ip_id']) && is_array($_POST['ip_id'])) ? count($_POST['ip_id']) : 0;
if ($ip_count > 0) {
- 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
badIpDel accesses the super-global variable $_POST. Open
function badIpDel($ip_id)
{
global $xoopsDB;
$ip_count = (!empty($_POST['ip_id']) && is_array($_POST['ip_id'])) ? count($_POST['ip_id']) : 0;
if ($ip_count > 0) {
- 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
flagUpload accesses the super-global variable $_FILES. Open
function flagUpload($country_code)
{
global $xoopsModule, $maxsize, $maxwidth, $maxheight, $format;
/** @var Helper $helper */
$helper = Helper::getInstance();
- 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
badIpDel accesses the super-global variable $_POST. Open
function badIpDel($ip_id)
{
global $xoopsDB;
$ip_count = (!empty($_POST['ip_id']) && is_array($_POST['ip_id'])) ? count($_POST['ip_id']) : 0;
if ($ip_count > 0) {
- 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
flagUpload accesses the super-global variable $_FILES. Open
function flagUpload($country_code)
{
global $xoopsModule, $maxsize, $maxwidth, $maxheight, $format;
/** @var Helper $helper */
$helper = Helper::getInstance();
- 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
badIpDel accesses the super-global variable $_POST. Open
function badIpDel($ip_id)
{
global $xoopsDB;
$ip_count = (!empty($_POST['ip_id']) && is_array($_POST['ip_id'])) ? count($_POST['ip_id']) : 0;
if ($ip_count > 0) {
- 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
badIpShow accesses the super-global variable $_SERVER. Open
function badIpShow()
{
global $action, $start, $xoopsModule, $xoopsModuleConfig;
$myts = \MyTextSanitizer::getInstance();
$limit = 15;
- 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
delete accesses the super-global variable $_POST. Open
function delete()
{
global $msgHandler, $xoopsModule;
$msg_count = (!empty($_POST['msg_id']) && is_array($_POST['msg_id'])) ? count($_POST['msg_id']) : 0;
if ($msg_count > 0) {
- 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'];
}
}