ImpressCMS/impresscms

View on GitHub
htdocs/modules/system/autotask.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid assigning values to variables in if clauses and the like (line '24', column '7').
Open

function remove_usersxdays() {
    $db =& icms_db_Factory::instance();
    global $icmsConfigUser;
    $days = $icmsConfigUser['delusers'];
    $delete_regdate= time() - ($days * 24 * 60 * 60);  // X days/month * 24 hrs/day
Severity: Minor
Found in htdocs/modules/system/autotask.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid using static access to class 'icms_db_Factory' in method 'remove_usersxdays'.
Open

    $db =& icms_db_Factory::instance();
Severity: Minor
Found in htdocs/modules/system/autotask.php by phpmd

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 '$result'.
Open

    if (!$result = $db->queryF($sql)) {
Severity: Minor
Found in htdocs/modules/system/autotask.php by phpmd

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

Call to method instance from undeclared class \icms_db_Factory
Open

    $db =& icms_db_Factory::instance();
Severity: Critical
Found in htdocs/modules/system/autotask.php by phan

Avoid variables with short names like $db. Configured minimum length is 3.
Open

    $db =& icms_db_Factory::instance();
Severity: Minor
Found in htdocs/modules/system/autotask.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

        return FALSE;

Whitespace found at end of line
Open

 * @version        SVN: $Id: autotask.php 10998 2011-02-02 19:15:09Z skenow $ 

The variable $delete_regdate is not named in camelCase.
Open

function remove_usersxdays() {
    $db =& icms_db_Factory::instance();
    global $icmsConfigUser;
    $days = $icmsConfigUser['delusers'];
    $delete_regdate= time() - ($days * 24 * 60 * 60);  // X days/month * 24 hrs/day
Severity: Minor
Found in htdocs/modules/system/autotask.php by phpmd

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 $delete_regdate is not named in camelCase.
Open

function remove_usersxdays() {
    $db =& icms_db_Factory::instance();
    global $icmsConfigUser;
    $days = $icmsConfigUser['delusers'];
    $delete_regdate= time() - ($days * 24 * 60 * 60);  // X days/month * 24 hrs/day
Severity: Minor
Found in htdocs/modules/system/autotask.php by phpmd

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

Unexpected trailing spaces found.
Open

 * @version        SVN: $Id: autotask.php 10998 2011-02-02 19:15:09Z skenow $ 

There are no issues that match your filters.

Category
Status