Method adslight_show
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
Function adslight_show
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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\Adslight\Helper' in method 'adslight_show'. 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\Adslight\Utility' in method 'adslight_show'. Open
$a_item['type'] = Utility::getNameType($type);
- 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 '\MyTextSanitizer' in method 'adslight_show'. Open
$myts = \MyTextSanitizer::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 '$helper'. Open
$helper = Helper::getInstance();
- 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 unused local variables such as '$myts'. Open
$myts = \MyTextSanitizer::getInstance();
- 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 unused local variables such as '$xoopsDB'. Open
global $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
Line exceeds 120 characters; contains 187 characters Open
$form .= ' <br><br>' . constant("{$block_lang}_CHARS") . " <input type='text' name='options[]' value='{$options[2]}'> " . constant("{$block_lang}_LENGTH") . '<br><br>';
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
$block['link'] = '<a href="' . XOOPS_URL . "/modules/{$moduleDirName}/\"><b>" . constant("{$block_lang}_ALL_LISTINGS") . '</b></a><br>';
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
$form .= ' ' . constant($block_lang . '_DISP') . " <input type='text' name='options[]' value='{$options[1]}'> " . constant("{$block_lang}_LISTINGS");
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$a_item['link'] = '<a href="' . XOOPS_URL . "/modules/{$moduleDirName}/viewads.php?lid=" . addslashes($myrow['lid']) . "\"><b>{$title}</b></a>";
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$block['add'] = '<a href="' . XOOPS_URL . "/modules/{$moduleDirName}/\"><b>" . constant("{$block_lang}_ADDNOW") . '</b></a><br>';
- Exclude checks
Line exceeds 120 characters; contains 169 characters Open
$sql = 'SELECT lid, cid, title, type, date_created, hits FROM ' . $xoopsDB->prefix("{$moduleDirName}_listing") . " WHERE valid='Yes' ORDER BY {$options[0]} DESC";
- Exclude checks
The variable $block_lang is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $block_lang is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $a_item is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $block_lang is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $a_item is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $a_item is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $block_lang is not named in camelCase. Open
function adslight_edit($options): string
{
global $xoopsDB;
$moduleDirName = \basename(\dirname(__DIR__));
$block_lang = '_MB_' . mb_strtoupper($moduleDirName);
- 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 $a_item is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $a_item is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $a_item is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $a_item is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $block_lang is not named in camelCase. Open
function adslight_edit($options): string
{
global $xoopsDB;
$moduleDirName = \basename(\dirname(__DIR__));
$block_lang = '_MB_' . mb_strtoupper($moduleDirName);
- 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 $a_item is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $block_lang is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $block_lang is not named in camelCase. Open
function adslight_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
- 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 $block_lang is not named in camelCase. Open
function adslight_edit($options): string
{
global $xoopsDB;
$moduleDirName = \basename(\dirname(__DIR__));
$block_lang = '_MB_' . mb_strtoupper($moduleDirName);
- 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 $block_lang is not named in camelCase. Open
function adslight_edit($options): string
{
global $xoopsDB;
$moduleDirName = \basename(\dirname(__DIR__));
$block_lang = '_MB_' . mb_strtoupper($moduleDirName);
- 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 $block_lang is not named in camelCase. Open
function adslight_edit($options): string
{
global $xoopsDB;
$moduleDirName = \basename(\dirname(__DIR__));
$block_lang = '_MB_' . mb_strtoupper($moduleDirName);
- 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 $block_lang is not named in camelCase. Open
function adslight_edit($options): string
{
global $xoopsDB;
$moduleDirName = \basename(\dirname(__DIR__));
$block_lang = '_MB_' . mb_strtoupper($moduleDirName);
- 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 $block_lang is not named in camelCase. Open
function adslight_edit($options): string
{
global $xoopsDB;
$moduleDirName = \basename(\dirname(__DIR__));
$block_lang = '_MB_' . mb_strtoupper($moduleDirName);
- 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 $block_lang is not named in camelCase. Open
function adslight_edit($options): string
{
global $xoopsDB;
$moduleDirName = \basename(\dirname(__DIR__));
$block_lang = '_MB_' . mb_strtoupper($moduleDirName);
- 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();
}
}