Method index
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
The function index() has 266 lines of code. Current threshold is set to 100. Avoid really long methods. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- Exclude checks
Avoid unused local variables such as '$mytree'. Open
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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 '$desctext'. Open
global $xoopsDB, $myts, $desctext;
- 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
global $xoopsDB, $myts, $desctext;
- 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\Adslight\Helper' in method 'copyXml'. 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 index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
echo "<table class='outer' width='50%' border='0'><tr><td width=40>";
echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" ></td><td>";
echo "<span style='color: #00B4C4;'><b>" . _AM_ADSLIGHT_NOANNVAL . '</b></span>';
echo '</td></tr></table><br>';
- 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
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 35 and the first side effect is on line 29. Open
<?php declare(strict_types=1);
- Exclude checks
There must be one USE keyword per declaration Open
use XoopsModules\Adslight\{
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
<a href="https://www.i-luc.fr/adslight/modules/TDMDownloads/index.php">' . _AM_ADSLIGHT_DOWNLOADS_MAPS . '</a>
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
<a href="mailto:adslight.translate@gmail.com?subject=Correction AdsLight">' . _AM_ADSLIGHT_DEVLLP_MAPFLASH . '</a>
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
<a href="' . XOOPS_URL . '/modules/adslight/admin/support_forum.php">' . _AM_ADSLIGHT_DEVLLP_FORUM . '</a>
- Exclude checks
Line exceeds 120 characters; contains 181 characters Open
<strong>Plugin Waiting Rssfit :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Waiting%20Rssfit/">Download</a><br><br>
- Exclude checks
Line exceeds 120 characters; contains 171 characters Open
echo "<a href='https://www.i-luc.fr/adslight/modules/TDMDownloads/visit.php?cid=1&lid=3'>"._AM_ADSLIGHT_RELEASEDOWNLOAD." > AdsLight 1.08</a></td></tr></table><br>";
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
<a href="mailto:adslight.translate@gmail.com?subject=Plugin for AdsLight">' . _AM_ADSLIGHT_SEND_PLUGIN . '</a> |
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
<a href="mailto:adslight.translate@gmail.com?subject=Translation for AdsLight">' . _AM_ADSLIGHT_SEND_TRANSLATION . '</a>
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
<a href="' . XOOPS_URL . '/modules/adslight/admin/view_ads.php">' . _AM_ADSLIGHT_ADSMENU_VIEWADS . '</a>
- Exclude checks
Line exceeds 120 characters; contains 176 characters Open
<strong>Plugin Xpayment :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20xpayment%20Module/">Download</a><br><br>
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=mailusers">' . _AM_ADSLIGHT_USERMENU_SENDMAIL . '</a>
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEOK.\" ></td><td>";
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=banners">' . _AM_ADSLIGHT_USERMENU_BAMMIER . '</a>
- Exclude checks
Line exceeds 120 characters; contains 171 characters Open
echo "<span style='color:#00B4C4;'><b>" . _AM_ADSLIGHT_THEREIS . "</b></span> <b>{$numrows}</b> <span style='color:#00B4C4;'>" . _AM_ADSLIGHT_WAIT . '</b></span>';
- Exclude checks
Line exceeds 120 characters; contains 182 characters Open
<strong>Plugin Sitemap Module :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Sitemap%20Module/">Download</a><br><br>
- Exclude checks
Line exceeds 120 characters; contains 182 characters Open
<strong>Plugin Waiting Module :</strong> <a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/Plugin%20Waiting%20Module/">Download</a><br><br>
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=comments">' . _AM_ADSLIGHT_USERMENU_COMMENT . '</a>
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
<a href="' . XOOPS_URL . '/modules/adslight/admin/category.php?op=AdsNewCat&cid=0">' . _AM_ADSLIGHT_CATMENU_CATEGORY . '</a>
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
<a href="' . XOOPS_URL . '/modules/adslight/admin/modify_ads.php">' . _AM_ADSLIGHT_ADS_MODIFADS . '</a>
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
<a href="https://sourceforge.net/projects/adslight/files/Plugins%20AdsLight/">' . _AM_ADSLIGHT_DOWNLOADS_PLUGINS . '</a>
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
<a href="mailto:adslight.translate@gmail.com?subject=Traduction AdsLight">' . _AM_ADSLIGHT_DEVLLP_TRANSLATE . '</a>
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
<a href="' . XOOPS_URL . '/modules/adslight/admin/validate_ads.php">' . _AM_ADSLIGHT_ADSMENU_VALIDADS . '</a>
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
<a href="mailto:adslight.translate@gmail.com?subject=Correction AdsLight">' . _AM_ADSLIGHT_DEVLLP_CORRECTION . '</a>
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
echo "<img src='../assets/images/admin/error_button_32.png' border=0 alt=\"._AM_ADSLIGHT_RELEASEDOWNLOAD.\" ></td><td>";
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
<a href="mailto:adslight.translate@gmail.com?subject=Hack AdsLight">' . _AM_ADSLIGHT_DEVLLP_HACK . '</a>
- Exclude checks
The variable $Num2 is not named in camelCase. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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 $adslight_maps is not named in camelCase. Open
function copyXml(): void
{
$helper = Helper::getInstance();
$adslight_maps = $helper->getConfig('adslight_maps_set');
- 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 $Num3 is not named in camelCase. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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 $Num1 is not named in camelCase. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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 $Num3 is not named in camelCase. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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 $adslight_maps is not named in camelCase. Open
function copyXml(): void
{
$helper = Helper::getInstance();
$adslight_maps = $helper->getConfig('adslight_maps_set');
- 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 $Num1 is not named in camelCase. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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 $Num4 is not named in camelCase. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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 $Num4 is not named in camelCase. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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 $Num2 is not named in camelCase. Open
function index(): void
{
global $xoopsDB, $myts, $desctext;
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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();
}
}