chamilo/chamilo-lms

View on GitHub
public/main/my_space/work_stats.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '79', column '27').
Open

        $fieldValue = new ExtraFieldValue('work');
Severity: Minor
Found in public/main/my_space/work_stats.php by phpmd

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_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $status = Display::label('Ok', 'success');
            }
Severity: Minor
Found in public/main/my_space/work_stats.php by phpmd

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 method get_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $first = Display::url($studentData['lastname'], $urlDetails);
            $last = Display::url($studentData['firstname'], $urlDetails);
        }
Severity: Minor
Found in public/main/my_space/work_stats.php by phpmd

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

function get_users($from, $number_of_items, $column, $direction)
Severity: Minor
Found in public/main/my_space/work_stats.php by phpmd

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

function get_users($from, $number_of_items, $column, $direction)
Severity: Minor
Found in public/main/my_space/work_stats.php by phpmd

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 local variables such as '$lastConnectionDate'.
Open

    $lastConnectionDate = null;
Severity: Minor
Found in public/main/my_space/work_stats.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

The parameter $number_of_items is not named in camelCase.
Open

function get_users($from, $number_of_items, $column, $direction)
{
    $consideredWorkingTime = api_get_setting('work.considered_working_time');

    $courseId = api_get_course_int_id();
Severity: Minor
Found in public/main/my_space/work_stats.php by phpmd

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

if ($is_western_name_order) {

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

function get_users($from, $number_of_items, $column, $direction)

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

    $limit = 'LIMIT '.$from.','.$number_of_items;

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

    $all_datas = [];

Consider putting global function "get_users" in a static class
Open

function get_users($from, $number_of_items, $column, $direction)

Missing function doc comment
Open

function get_users($from, $number_of_items, $column, $direction)

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

    $number_of_items = (int) $number_of_items;

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

        if ($is_western_name_order) {

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

    ($is_western_name_order xor $sort_by_first_name) ? 1 : 0,

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

    $number_of_items = (int) $number_of_items;

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

        $all_datas[] = $row;

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

$this_section = SECTION_TRACKING;

Missing function doc comment
Open

function get_count_users()

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

$is_western_name_order = api_is_western_name_order();

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

$sort_by_first_name = api_sort_by_first_name();

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

    return $all_datas;

Consider putting global function "get_count_users" in a static class
Open

function get_count_users()

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

    $is_western_name_order = api_is_western_name_order();

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

    ($is_western_name_order xor $sort_by_first_name) ? 1 : 0,

The variable $is_western_name_order is not named in camelCase.
Open

function get_users($from, $number_of_items, $column, $direction)
{
    $consideredWorkingTime = api_get_setting('work.considered_working_time');

    $courseId = api_get_course_int_id();
Severity: Minor
Found in public/main/my_space/work_stats.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 $number_of_items is not named in camelCase.
Open

function get_users($from, $number_of_items, $column, $direction)
{
    $consideredWorkingTime = api_get_setting('work.considered_working_time');

    $courseId = api_get_course_int_id();
Severity: Minor
Found in public/main/my_space/work_stats.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 $all_datas is not named in camelCase.
Open

function get_users($from, $number_of_items, $column, $direction)
{
    $consideredWorkingTime = api_get_setting('work.considered_working_time');

    $courseId = api_get_course_int_id();
Severity: Minor
Found in public/main/my_space/work_stats.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 $is_western_name_order is not named in camelCase.
Open

function get_users($from, $number_of_items, $column, $direction)
{
    $consideredWorkingTime = api_get_setting('work.considered_working_time');

    $courseId = api_get_course_int_id();
Severity: Minor
Found in public/main/my_space/work_stats.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 $number_of_items is not named in camelCase.
Open

function get_users($from, $number_of_items, $column, $direction)
{
    $consideredWorkingTime = api_get_setting('work.considered_working_time');

    $courseId = api_get_course_int_id();
Severity: Minor
Found in public/main/my_space/work_stats.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 $number_of_items is not named in camelCase.
Open

function get_users($from, $number_of_items, $column, $direction)
{
    $consideredWorkingTime = api_get_setting('work.considered_working_time');

    $courseId = api_get_course_int_id();
Severity: Minor
Found in public/main/my_space/work_stats.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 $all_datas is not named in camelCase.
Open

function get_users($from, $number_of_items, $column, $direction)
{
    $consideredWorkingTime = api_get_setting('work.considered_working_time');

    $courseId = api_get_course_int_id();
Severity: Minor
Found in public/main/my_space/work_stats.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 $all_datas is not named in camelCase.
Open

function get_users($from, $number_of_items, $column, $direction)
{
    $consideredWorkingTime = api_get_setting('work.considered_working_time');

    $courseId = api_get_course_int_id();
Severity: Minor
Found in public/main/my_space/work_stats.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

There are no issues that match your filters.

Category
Status