chamilo/chamilo-lms

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

Summary

Maintainability
A
0 mins
Test Coverage

The method display_notes() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid unused local variables such as '$course_id'.
Open

        $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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

Avoid unused local variables such as '$course_id'.
Open

        $course_id = api_get_course_int_id();
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 method display_notes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $sort_direction = 'DESC';
            $link_sort_direction = 'ASC';
        }
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 parameter $notebook_id is not named in camelCase.
Open

    public static function delete_note($notebook_id)
    {
        $notebook_id = (int) $notebook_id;

        if (empty($notebook_id)) {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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

The parameter $notebook_id is not named in camelCase.
Open

    public static function get_note_information($notebook_id)
    {
        if (empty($notebook_id)) {
            return [];
        }
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 "course_id" is not in valid camel caps format
Open

                    c_id = $course_id AND

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

            $session_img = api_get_session_image($row['session_id'], $user);

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

        $notebook_id = (int) $notebook_id;

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

        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.

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

        if (empty($notebook_id)) {

Method name "NotebookManager::display_notes" is not in camel caps format
Open

    public static function display_notes()

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

        $course_id = api_get_course_int_id();

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

        $affected_rows = Database::affected_rows($result);

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

            $sort_direction = 'ASC';

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

            href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.

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

        $order_by = " ORDER BY `$notebookView` $sort_direction ";

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

                    $condition_session

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

                    $cond_extra $order_by

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

        $notebook_id = (int) $notebook_id;

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

            $sort_direction = 'DESC';

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

                $row['title'].$session_img.' <div class="pull-right">'.$actions.'</div>',

Method name "NotebookManager::javascript_notebook" is not in camel caps format
Open

    public static function javascript_notebook()

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

            $link_sort_direction = 'DESC';

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

                    iid='".$notebook_id."' AND

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

            href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.

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

        $course_id = api_get_course_int_id();

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

        $order_by = " ORDER BY `$notebookView` $sort_direction ";

Method name "NotebookManager::get_note_information" is not in camel caps format
Open

    public static function get_note_information($notebook_id)

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

    public static function get_note_information($notebook_id)

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

    public static function delete_note($notebook_id)

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

        $notebook_id = (int) $notebook_id;

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

        if (empty($notebook_id)) {

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

        $condition_session = api_get_session_condition($sessionId);

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

            $sort_direction = 'ASC';

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

                    $cond_extra $order_by

Missing function doc comment
Open

    public static function saveNote(array $values, $userId = 0, $courseId = 0, $sessionId = 0)

Method name "NotebookManager::delete_note" is not in camel caps format
Open

    public static function delete_note($notebook_id)

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

            $link_sort_direction = 'DESC';

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

                WHERE iid = '".$notebook_id."' ";

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

        $course_id = api_get_course_int_id();

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

            $link_sort_direction = 'ASC';

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

        $notebook_id = (int) $notebook_id;

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

        $cond_extra = 'update_date' === $notebookView ? " AND update_date <> ''" : ' ';

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

        if (1 != $affected_rows) {

The variable $course_id is not named in camelCase.
Open

    public static function get_note_information($notebook_id)
    {
        if (empty($notebook_id)) {
            return [];
        }
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $notebook_id is not named in camelCase.
Open

    public static function get_note_information($notebook_id)
    {
        if (empty($notebook_id)) {
            return [];
        }
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $notebook_id is not named in camelCase.
Open

    public static function get_note_information($notebook_id)
    {
        if (empty($notebook_id)) {
            return [];
        }
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $notebook_id is not named in camelCase.
Open

    public static function delete_note($notebook_id)
    {
        $notebook_id = (int) $notebook_id;

        if (empty($notebook_id)) {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $notebook_id is not named in camelCase.
Open

    public static function get_note_information($notebook_id)
    {
        if (empty($notebook_id)) {
            return [];
        }
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $notebook_id is not named in camelCase.
Open

    public static function get_note_information($notebook_id)
    {
        if (empty($notebook_id)) {
            return [];
        }
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $link_sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $cond_extra is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $order_by is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $course_id is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $link_sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $link_sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $notebook_id is not named in camelCase.
Open

    public static function delete_note($notebook_id)
    {
        $notebook_id = (int) $notebook_id;

        if (empty($notebook_id)) {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $course_id is not named in camelCase.
Open

    public static function delete_note($notebook_id)
    {
        $notebook_id = (int) $notebook_id;

        if (empty($notebook_id)) {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $condition_session is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $affected_rows is not named in camelCase.
Open

    public static function delete_note($notebook_id)
    {
        $notebook_id = (int) $notebook_id;

        if (empty($notebook_id)) {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $condition_session is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $notebook_id is not named in camelCase.
Open

    public static function delete_note($notebook_id)
    {
        $notebook_id = (int) $notebook_id;

        if (empty($notebook_id)) {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $session_img is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $course_id is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $session_img is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $notebook_id is not named in camelCase.
Open

    public static function delete_note($notebook_id)
    {
        $notebook_id = (int) $notebook_id;

        if (empty($notebook_id)) {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $link_sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $order_by is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $link_sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $affected_rows is not named in camelCase.
Open

    public static function delete_note($notebook_id)
    {
        $notebook_id = (int) $notebook_id;

        if (empty($notebook_id)) {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $link_sort_direction is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 $cond_extra is not named in camelCase.
Open

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.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 method get_note_information is not named in camelCase.
Open

    public static function get_note_information($notebook_id)
    {
        if (empty($notebook_id)) {
            return [];
        }
Severity: Minor
Found in public/main/inc/lib/notebook.lib.php by phpmd

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

    public static function javascript_notebook()
    {
        return "<script>
                function confirmation (name)
                {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.php by phpmd

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

    public static function display_notes()
    {
        $sessionId = api_get_session_id();
        $user = api_get_user_entity();

Severity: Minor
Found in public/main/inc/lib/notebook.lib.php by phpmd

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

    public static function delete_note($notebook_id)
    {
        $notebook_id = (int) $notebook_id;

        if (empty($notebook_id)) {
Severity: Minor
Found in public/main/inc/lib/notebook.lib.php by phpmd

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