check accesses the super-global variable $_SESSION. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
check accesses the super-global variable $_SESSION. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
admin_refcheck accesses the super-global variable $_SERVER. Open
function admin_refcheck($chkref = '')
{
if (empty($_SERVER['HTTP_REFERER'])) {
return true;
} else {
- 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
issue accesses the super-global variable $_SERVER. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
issue accesses the super-global variable $_SESSION. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
check accesses the super-global variable $_POST. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
check accesses the super-global variable $_GET. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
issue accesses the super-global variable $_SESSION. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
issue accesses the super-global variable $_SESSION. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
issue accesses the super-global variable $_SESSION. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
issue accesses the super-global variable $_SERVER. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
issue accesses the super-global variable $_SERVER. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
issue accesses the super-global variable $_SERVER. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
issue accesses the super-global variable $_SESSION. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
admin_refcheck accesses the super-global variable $_SERVER. Open
function admin_refcheck($chkref = '')
{
if (empty($_SERVER['HTTP_REFERER'])) {
return true;
} else {
- 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
check accesses the super-global variable $_POST. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
check accesses the super-global variable $_SESSION. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
check accesses the super-global variable $_SESSION. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
check accesses the super-global variable $_SERVER. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
using accesses the super-global variable $_SESSION. Open
public function using()
{
if (!empty($_SESSION['XOOPS_G_STUBS'])) {
return true;
} else {
- 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
check accesses the super-global variable $_SESSION. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
clear accesses the super-global variable $_SESSION. Open
public function clear()
{
$_SESSION['XOOPS_G_STUBS'] = array();
}
- 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
issue accesses the super-global variable $_SESSION. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
check accesses the super-global variable $_GET. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
Function check
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
Method check
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
Function issue
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- 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
Method issue
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
Function admin_refcheck
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function admin_refcheck($chkref = '')
{
if (empty($_SERVER['HTTP_REFERER'])) {
return true;
} else {
- 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 too many return
statements within this method. Open
return true;
Function getErrors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getErrors($ashtml = true)
{
if ($ashtml) {
$ret = '';
foreach ($this->_errors as $msg) {
- 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
The method check() has an NPath complexity of 19440. The configured NPath complexity threshold is 200. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- 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
The method check() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method issue() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method getErrors has a boolean flag argument $ashtml, which is a certain sign of a Single Responsibility Principle violation. Open
public function getErrors($ashtml = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Remove error control operator '@' on line 226. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 135. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Missing class import via use statement (line '69', column '35'). Open
$form->addElement(new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area)));
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '56', column '24'). Open
return new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area));
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method check has a boolean flag argument $post, which is a certain sign of a Single Responsibility Principle violation. Open
public function check($post = true, $area = '')
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getTicketParamString has a boolean flag argument $noamp, which is a certain sign of a Single Responsibility Principle violation. Open
public function getTicketParamString($salt = '', $noamp = false, $timeout = 1800, $area = '')
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Remove error control operator '@' on line 221. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 229. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
The method check uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ticket = empty($_GET['XOOPS_G_TICKET']) ? '' : $_GET['XOOPS_G_TICKET'];
}
- 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 admin_refcheck uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ref = $_SERVER['HTTP_REFERER'];
}
- 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 check uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->_errors[] = 'Time out';
}
- 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 check uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// store the other valid stubs into session
$_SESSION['XOOPS_G_STUBS'][] = $stub;
}
- 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 getErrors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ret = $this->_errors;
}
- 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 check uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (md5($stub['token'] . XOOPS_DB_PREFIX) === $ticket) {
// not CSRF but Time-Out
$timeout_flag = true;
}
- 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 using uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return false;
}
- 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
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class XoopsGTicket
- Exclude checks
Avoid variables with short names like $cr. Configured minimum length is 3. Open
$cr = XOOPS_URL;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The property $_errors is not named in camelCase. Open
class XoopsGTicket
{
public $_errors = array();
public $_latest_token = '';
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $_latest_token is not named in camelCase. Open
class XoopsGTicket
{
public $_errors = array();
public $_latest_token = '';
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
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 28 and the first side effect is on line 289. Open
<?php
- Exclude checks
Property name "$_latest_token" should not be prefixed with an underscore to indicate visibility Open
public $_latest_token = '';
- Exclude checks
Property name "$_errors" should not be prefixed with an underscore to indicate visibility Open
public $_errors = array();
- Exclude checks
Blank line found at start of control structure Open
if (!function_exists('admin_refcheck')) {
- Exclude checks
The variable $found_stub is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $found_stub is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $area_check is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $stubs_tmp is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $appendix_salt is not named in camelCase. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $referer_check is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $referer_check is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $found_stub is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $area_check is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $found_stub is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $stubs_tmp is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $timeout_flag is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $appendix_salt is not named in camelCase. Open
public function issue($salt = '', $timeout = 1800, $area = '')
{
global $xoopsModule;
if ('' === $salt) {
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $timeout_flag is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $found_stub is not named in camelCase. Open
public function check($post = true, $area = '')
{
global $xoopsModule;
$this->_errors = array();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}