tag_load_config accesses the super-global variable $GLOBALS. Open
public static function tag_load_config()
{
static $moduleConfig;
if (null === $moduleConfig) {
- 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
tag_load_config accesses the super-global variable $GLOBALS. Open
public static function tag_load_config()
{
static $moduleConfig;
if (null === $moduleConfig) {
- 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
tag_get_delimiter accesses the super-global variable $GLOBALS. Open
public static function tag_get_delimiter()
{
\XoopsModules\Tag\Helper::getInstance()->loadLanguage('config');
//xoops_loadLanguage('config', 'tag');
$retVal = [',', ' ', '|', ';'];
- 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
tag_get_delimiter accesses the super-global variable $GLOBALS. Open
public static function tag_get_delimiter()
{
\XoopsModules\Tag\Helper::getInstance()->loadLanguage('config');
//xoops_loadLanguage('config', 'tag');
$retVal = [',', ' ', '|', ';'];
- 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
tag_parse_args accesses the super-global variable $_SERVER. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- 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
tag_load_config accesses the super-global variable $GLOBALS. Open
public static function tag_load_config()
{
static $moduleConfig;
if (null === $moduleConfig) {
- 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
tag_get_delimiter accesses the super-global variable $GLOBALS. Open
public static function tag_get_delimiter()
{
\XoopsModules\Tag\Helper::getInstance()->loadLanguage('config');
//xoops_loadLanguage('config', 'tag');
$retVal = [',', ' ', '|', ';'];
- 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
tag_load_config accesses the super-global variable $GLOBALS. Open
public static function tag_load_config()
{
static $moduleConfig;
if (null === $moduleConfig) {
- 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
tag_get_delimiter accesses the super-global variable $GLOBALS. Open
public static function tag_get_delimiter()
{
\XoopsModules\Tag\Helper::getInstance()->loadLanguage('config');
//xoops_loadLanguage('config', 'tag');
$retVal = [',', ' ', '|', ';'];
- 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 tag_load_config
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function tag_load_config()
{
static $moduleConfig;
if (null === $moduleConfig) {
- 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
Function tag_parse_args
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- 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
Function tag_define_url_delimiter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function tag_define_url_delimiter(): void
{
if (\defined('URL_DELIMITER')) {
if (!\in_array(URL_DELIMITER, ['?', '/'], true)) {
exit('Security Violation');
- 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
Missing class import via use statement (line '32', column '33'). Open
$criteria = new \Criteria('conf_modid', $mid);
- 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 tag_get_delimiter uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$moduleConfig = self::tag_load_config();
if (!empty($GLOBALS['moduleConfig']['tag_delimiter'])) {
$retVal = $GLOBALS['moduleConfig']['tag_delimiter'];
}
- 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 tag_parse_args uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$args_string[] = \urldecode($var);
}
- 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 using static access to class '\XoopsModules\Tag\Helper' in method 'tag_load_config'. Open
$helper = \XoopsModules\Tag\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 tag_load_config uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$mid = $helper->getModule()->getVar('mid');
/** @var \XoopsConfigHandler $configHandler */
$configHandler = \xoops_getHandler('config');
- 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 tag_define_url_delimiter uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
\define('URL_DELIMITER', '/');
}
- 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 tag_define_url_delimiter uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$moduleConfig = self::tag_load_config();
if (empty($moduleConfig['do_urw'])) {
\define('URL_DELIMITER', '?');
} else {
- 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 tag_define_url_delimiter() contains an exit expression. Open
exit('Security Violation');
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused local variables such as '$moduleConfig'. Open
$moduleConfig = self::tag_load_config();
- 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 parameter $args_string is not named in camelCase. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $text_tag is not named in camelCase. Open
public static function tag_parse_tag(string $text_tag): array
{
$tags = [];
if (!empty($text_tag)) {
$delimiters = self::tag_get_delimiter();
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Method name "Utility::tag_load_config" is not in camel caps format Open
public static function tag_load_config()
- Exclude checks
Method name "Utility::tag_parse_tag" is not in camel caps format Open
public static function tag_parse_tag(string $text_tag): array
- Exclude checks
Method name "Utility::tag_define_url_delimiter" is not in camel caps format Open
public static function tag_define_url_delimiter(): void
- Exclude checks
Method name "Utility::tag_parse_args" is not in camel caps format Open
public static function tag_parse_args(&$args, &$args_string): bool
- Exclude checks
Method name "Utility::tag_get_delimiter" is not in camel caps format Open
public static function tag_get_delimiter()
- Exclude checks
The variable $args_abb is not named in camelCase. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- 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 $tags_raw is not named in camelCase. Open
public static function tag_parse_tag(string $text_tag): array
{
$tags = [];
if (!empty($text_tag)) {
$delimiters = self::tag_get_delimiter();
- 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 $args_string is not named in camelCase. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- 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 $args_abb is not named in camelCase. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- 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 $tags_raw is not named in camelCase. Open
public static function tag_parse_tag(string $text_tag): array
{
$tags = [];
if (!empty($text_tag)) {
$delimiters = self::tag_get_delimiter();
- 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 $args_string is not named in camelCase. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- 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 $text_tag is not named in camelCase. Open
public static function tag_parse_tag(string $text_tag): array
{
$tags = [];
if (!empty($text_tag)) {
$delimiters = self::tag_get_delimiter();
- 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 $args_string is not named in camelCase. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- 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 $text_tag is not named in camelCase. Open
public static function tag_parse_tag(string $text_tag): array
{
$tags = [];
if (!empty($text_tag)) {
$delimiters = self::tag_get_delimiter();
- 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 $args_string is not named in camelCase. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- 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 method tag_define_url_delimiter is not named in camelCase. Open
public static function tag_define_url_delimiter(): void
{
if (\defined('URL_DELIMITER')) {
if (!\in_array(URL_DELIMITER, ['?', '/'], true)) {
exit('Security Violation');
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method tag_get_delimiter is not named in camelCase. Open
public static function tag_get_delimiter()
{
\XoopsModules\Tag\Helper::getInstance()->loadLanguage('config');
//xoops_loadLanguage('config', 'tag');
$retVal = [',', ' ', '|', ';'];
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method tag_parse_tag is not named in camelCase. Open
public static function tag_parse_tag(string $text_tag): array
{
$tags = [];
if (!empty($text_tag)) {
$delimiters = self::tag_get_delimiter();
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method tag_parse_args is not named in camelCase. Open
public static function tag_parse_args(&$args, &$args_string): bool
{
$args_abb = [
'c' => 'catid',
'm' => 'modid',
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method tag_load_config is not named in camelCase. Open
public static function tag_load_config()
{
static $moduleConfig;
if (null === $moduleConfig) {
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}