xoops_module_update_adslight accesses the super-global variable $GLOBALS. Open
function xoops_module_update_adslight(\XoopsObject $xoopsModule): bool
{
global $xoopsDB;
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- 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
xoops_module_update_adslight accesses the super-global variable $GLOBALS. Open
function xoops_module_update_adslight(\XoopsObject $xoopsModule): bool
{
global $xoopsDB;
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- 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
Missing class import via use statement (line '44', column '25'). Open
$fileinfo = new \SplFileInfo($template_directory . $v);
- 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
Remove error control operator '@' on line 47. Open
function xoops_module_update_adslight(\XoopsObject $xoopsModule): bool
{
global $xoopsDB;
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- 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
Avoid using static access to class 'XoopsFile' in method 'xoops_module_update_adslight'. Open
$folderHandler = XoopsFile::getHandler('folder', $imagesDirectory);
- 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
Line exceeds 120 characters; contains 170 characters Open
$sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `photo` VARCHAR(100) NOT NULL DEFAULT '0';";
- Exclude checks
The variable $template_directory is not named in camelCase. Open
function xoops_module_update_adslight(\XoopsObject $xoopsModule): bool
{
global $xoopsDB;
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- 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 $template_directory is not named in camelCase. Open
function xoops_module_update_adslight(\XoopsObject $xoopsModule): bool
{
global $xoopsDB;
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- 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 $template_list is not named in camelCase. Open
function xoops_module_update_adslight(\XoopsObject $xoopsModule): bool
{
global $xoopsDB;
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- 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 $template_list is not named in camelCase. Open
function xoops_module_update_adslight(\XoopsObject $xoopsModule): bool
{
global $xoopsDB;
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- 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 $template_directory is not named in camelCase. Open
function xoops_module_update_adslight(\XoopsObject $xoopsModule): bool
{
global $xoopsDB;
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- 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 $template_directory is not named in camelCase. Open
function xoops_module_update_adslight(\XoopsObject $xoopsModule): bool
{
global $xoopsDB;
$sql = 'ALTER TABLE `' . $xoopsDB->prefix('adslight_listing') . "` MODIFY `price` DECIMAL(20,2) NOT NULL DEFAULT '0.00' AFTER `tel` ;";
- 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();
}
}