chamilo/chamilo-lms

View on GitHub
public/main/inc/lib/zombie/zombie_manager.class.php

Summary

Maintainability
A
0 mins
Test Coverage

The method listZombies uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $sql .= " FROM $user_table as user, $login_table as access
                      WHERE
                        access.login_date = (SELECT MAX(a.login_date)
                                             FROM $login_table as a

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

The parameter $active_only is not named in camelCase.
Open

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

Variable "user_table" is not in valid camel caps format
Open

            $sql .= " FROM $user_table as user, $login_table as access, $access_url_rel_user_table as url

Variable "user_table" is not in valid camel caps format
Open

        $user_table = Database::get_main_table(TABLE_MAIN_USER);

Variable "current_url_id" is not in valid camel caps format
Open

            $current_url_id = api_get_current_access_url_id();

Variable "user_table" is not in valid camel caps format
Open

            $sql .= " FROM $user_table as user, $login_table as access

Variable "access_url_rel_user_table" is not in valid camel caps format
Open

            $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);

Variable "login_table" is not in valid camel caps format
Open

                                             FROM $login_table as a

Missing parameter name
Open

     * @param $ceiling

Method name "ZombieManager::deactivate_zombies" is not in camel caps format
Open

    public static function deactivate_zombies($ceiling)

Missing function doc comment
Open

    public static function last_year()

Variable "access_url_rel_user_table" is not in valid camel caps format
Open

            $sql .= " FROM $user_table as user, $login_table as access, $access_url_rel_user_table as url

Variable "login_table" is not in valid camel caps format
Open

            $sql .= " FROM $user_table as user, $login_table as access

Variable "login_table" is not in valid camel caps format
Open

        $login_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);

Variable "login_table" is not in valid camel caps format
Open

            $sql .= " FROM $user_table as user, $login_table as access, $access_url_rel_user_table as url

Variable "login_table" is not in valid camel caps format
Open

                                             FROM $login_table as a

Variable "active_only" is not in valid camel caps format
Open

        if ($active_only) {

Variable "current_url_id" is not in valid camel caps format
Open

                        url.user_id = user.user_id AND url.access_url_id=$current_url_id";

Method name "ZombieManager::last_year" is not in camel caps format
Open

    public static function last_year()

Variable "active_only" is not in valid camel caps format
Open

        $active_only = true,

The variable $user_table is not named in camelCase.
Open

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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

    public static function listZombies(
        $ceiling,
        $active_only = true,
        $from = 0,
        $count = 10,

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 method deactivate_zombies is not named in camelCase.
Open

    public static function deactivate_zombies($ceiling)
    {
        $zombies = self::listZombies($ceiling);
        $ids = [];
        foreach ($zombies as $zombie) {

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method last_year is not named in camelCase.
Open

    public static function last_year()
    {
        $today = time();
        $day = date('j', $today);
        $month = date('n', $today);

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status