chamilo/chamilo-lms

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

Summary

Maintainability
A
0 mins
Test Coverage

The method updateGradeBookListBySkill() has an NPath complexity of 252. The configured NPath complexity threshold is 200.
Open

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

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

        } else {
            $result = $this->save($params);
        }

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function getSkillInfo($skill_id, $gradebookId)
    {
        if (empty($skill_id)) {
            return [];
        }

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

                    'skill_id' => $skill_id,

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

    public function getSkillInfo($skill_id, $gradebookId)

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)

You must use "/**" style comments for a class comment
Open

class SkillRelGradebookModel extends Model

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

        $gradebooks_to_remove = [];

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)

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

                        $skill_id,

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

                $original_gradebook_list_ids[] = $gradebook_item['gradebook_id'];

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

            foreach ($gradebook_list as $gradebook_id) {

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

        if (!empty($gradebooks_to_add)) {

Missing function doc comment
Open

    public function __construct()

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

        if (empty($skill_id)) {

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

        if (!empty($original_gradebook_list)) {

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

                    $gradebooks_to_remove[] = $gradebook['id'];

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

                $original_gradebook_list_ids[] = $gradebook_item['gradebook_id'];

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

                    $gradebooks_to_add[] = $gradebook_id;

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

            ['where' => ['skill_id = ?' => [$skill_id]]]

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

            foreach ($gradebook_list as $gradebook_id) {

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

                if (!in_array($gradebook_id, $original_gradebook_list_ids)) {

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

            foreach ($original_gradebook_list as $gradebook_item) {

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

                if (!in_array($gradebook_id, $original_gradebook_list_ids)) {

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

        $original_gradebook_list = $this->find(

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

        $original_gradebook_list_ids = [];

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

        if (!empty($gradebook_list)) {

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

                if (!in_array($gradebook['gradebook_id'], $gradebook_list)) {

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

                    $gradebooks_to_add[] = $gradebook_id;

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

            foreach ($gradebooks_to_remove as $id) {

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

            foreach ($gradebooks_to_add as $gradebook_id) {

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

            foreach ($gradebooks_to_add as $gradebook_id) {

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

            foreach ($original_gradebook_list as $gradebook_item) {

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

            foreach ($original_gradebook_list as $gradebook) {

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

        if (!empty($gradebooks_to_remove)) {

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

                    'gradebook_id' => $gradebook_id,

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

        $gradebooks_to_add = [];

The variable $gradebook_item is not named in camelCase.
Open

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function getSkillInfo($skill_id, $gradebookId)
    {
        if (empty($skill_id)) {
            return [];
        }

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function getSkillInfo($skill_id, $gradebookId)
    {
        if (empty($skill_id)) {
            return [];
        }

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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

    public function updateGradeBookListBySkill($skill_id, $gradebook_list)
    {
        $original_gradebook_list = $this->find(
            'all',
            ['where' => ['skill_id = ?' => [$skill_id]]]

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