chamilo/chamilo-lms

View on GitHub
public/main/inc/lib/SortableTableFromArrayConfig.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused parameters such as '$perPage'.
Open

        $perPage = 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

        $direction = 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

        $sort = true

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

        $column = 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 '$from'.
Open

        $from = 1,

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

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

        } else {
            if (!empty($this->table_data)) {
                return count($this->table_data);
            }

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

class SortableTableFromArrayConfig extends SortableTable
{
    /**
     * The array containing the columns that will be show
     * i.e $column_show=array('1','0','0'); we will show only the 1st column.

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

The property $column_order is not named in camelCase.
Open

class SortableTableFromArrayConfig extends SortableTable
{
    /**
     * The array containing the columns that will be show
     * i.e $column_show=array('1','0','0'); we will show only the 1st column.

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

The property $doc_filter is not named in camelCase.
Open

class SortableTableFromArrayConfig extends SortableTable
{
    /**
     * The array containing the columns that will be show
     * i.e $column_show=array('1','0','0'); we will show only the 1st column.

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

The parameter $column_order is not named in camelCase.
Open

    public function __construct(
        $data,
        $column = 1,
        $itemsPerPage = 20,
        $tableName = 'tablename',

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

The parameter $column_show is not named in camelCase.
Open

    public function __construct(
        $data,
        $column = 1,
        $itemsPerPage = 20,
        $tableName = 'tablename',

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

The parameter $doc_filter is not named in camelCase.
Open

    public function __construct(
        $data,
        $column = 1,
        $itemsPerPage = 20,
        $tableName = 'tablename',

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 "column_show" is not in valid camel caps format
Open

        $this->column_show = $column_show;

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

        $this->column_show = $column_show;

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

        $column_show = [],

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

            $this->column_show,

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

    public function get_total_number_of_items()

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

                return count($this->table_data);

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

        $this->column_order = $column_order;

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

        $this->doc_filter = $doc_filter;

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

        $doc_filter = false

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

            return $this->total_number_of_items;

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

    public function get_table_data(

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

        $this->doc_filter = $doc_filter;

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

        $this->table_data = $data;

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

        if (!empty($this->total_number_of_items) && -1 !== $this->total_number_of_items) {

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

        $this->column_order = $column_order;

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

            $this->table_data,

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

        if (!empty($this->total_number_of_items) && -1 !== $this->total_number_of_items) {

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

            $this->doc_filter

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

            $this->column_order,

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

            if (!empty($this->table_data)) {

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

        $column_order = [],

The variable $column_order is not named in camelCase.
Open

    public function __construct(
        $data,
        $column = 1,
        $itemsPerPage = 20,
        $tableName = 'tablename',

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

    public function __construct(
        $data,
        $column = 1,
        $itemsPerPage = 20,
        $tableName = 'tablename',

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

    public function __construct(
        $data,
        $column = 1,
        $itemsPerPage = 20,
        $tableName = 'tablename',

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

    public function get_total_number_of_items()
    {
        if (!empty($this->total_number_of_items) && -1 !== $this->total_number_of_items) {
            return $this->total_number_of_items;
        } else {

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

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

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