chamilo/chamilo-lms

View on GitHub
public/main/gradebook/lib/fe/usertable.class.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '23', column '30').
Open

        $this->datagen = new UserDataGenerator($userid, $evals, $links);

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

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

        } else {
            $sorting |= UserDataGenerator::UDG_SORT_ASC;
        }

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

Avoid unused parameters such as '$perPage'.
Open

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$direction'.
Open

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$sort'.
Open

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$column'.
Open

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

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

        $sortable_data = [];

Method name "UserTable::build_name_link" is not in camel caps format
Open

    private function build_name_link($item)

Method name "UserTable::get_table_data" is not in camel caps format
Open

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)

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

        return $sortable_data;

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

        $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);

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

                $sortable_data[] = $row;

Method name "UserTable::get_total_number_of_items" is not in camel caps format
Open

    public function get_total_number_of_items()

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

        foreach ($data_array as $data) {

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

        $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);

Method name "UserTable::build_type_column" is not in camel caps format
Open

    private function build_type_column($item)

The variable $sortable_data is not named in camelCase.
Open

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)
    {
        $scoredisplay = ScoreDisplay::instance();

        // determine sorting type

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

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)
    {
        $scoredisplay = ScoreDisplay::instance();

        // determine sorting type

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

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)
    {
        $scoredisplay = ScoreDisplay::instance();

        // determine sorting type

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

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)
    {
        $scoredisplay = ScoreDisplay::instance();

        // determine sorting type

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

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)
    {
        $scoredisplay = ScoreDisplay::instance();

        // determine sorting type

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

    public function get_table_data($from = 1, $perPage = null, $column = null, $direction = null, $sort = null)
    {
        $scoredisplay = ScoreDisplay::instance();

        // determine sorting type

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

    public function get_total_number_of_items()
    {
        return $this->datagen->get_total_items_count();
    }

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

    private function build_name_link($item)
    {
        switch ($item->get_item_type()) {
            // evaluation
            case 'E':

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

    private function build_type_column($item)
    {
        return GradebookUtils::build_type_icon_tag($item->get_icon_name());
    }

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