b_marquee_xoopspoll accesses the super-global variable $GLOBALS. Open
function b_marquee_xoopspoll($limit, $dateformat, $itemssize)
{
require_once $GLOBALS['xoops']->path('modules/marquee/include/functions.php');
$block = [];
$myts = \MyTextSanitizer::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
b_marquee_xoopspoll accesses the super-global variable $GLOBALS. Open
function b_marquee_xoopspoll($limit, $dateformat, $itemssize)
{
require_once $GLOBALS['xoops']->path('modules/marquee/include/functions.php');
$block = [];
$myts = \MyTextSanitizer::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
Method b_marquee_xoopspoll
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_marquee_xoopspoll($limit, $dateformat, $itemssize)
{
require_once $GLOBALS['xoops']->path('modules/marquee/include/functions.php');
$block = [];
$myts = \MyTextSanitizer::getInstance();
Missing class import via use statement (line '49', column '24'). Open
$criteria->add(new \Criteria('end_time', time(), '>'));
- 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 '48', column '24'). Open
$criteria->add(new \Criteria('start_time', time(), '<='));
- 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 '47', column '24'). Open
$criteria = new \CriteriaCompo();
- 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
Avoid using static access to class '\MyTextSanitizer' in method 'b_marquee_xoopspoll'. 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 '$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
There must be one USE keyword per declaration Open
use XoopsModules\Xoopspoll\{
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
'link' => "<a href='" . $GLOBALS['xoops']->url('modules/xoopspoll/index.php') . "?poll_id={$pollValues['poll_id']}'>{$title}</a>",
- Exclude checks