chamilo/chamilo-lms

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

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '117', column '26').
Open

        $skill_obj = new SkillModel();

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

Missing class import via use statement (line '118', column '31').
Open

        $skill_rel_user = new SkillRelUserModel();

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

                } else {
                    $skill = null;
                }

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

        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getSkillParents($skillId, $add_child_info = true)
    {
        $skillId = (int) $skillId;
        $sql = 'SELECT child.* FROM '.$this->table.' child
                LEFT JOIN '.$this->table.' parent

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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 relationExists($skill_id, $parent_id)
    {
        $result = $this->find(
            'all',
            [

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

    public function relationExists($skill_id, $parent_id)
    {
        $result = $this->find(
            'all',
            [

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

        $skill_obj = new SkillModel();

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

                        $parent_id,

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

    public function getSkillParents($skillId, $add_child_info = true)

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

        if ($load_user_data) {

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

            foreach ($passed_skills as $done_skill) {

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

                $done_skills[] = $done_skill['skill_id'];

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

                        if (in_array($skill['skill_id'], $done_skills)) {

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

class SkillRelSkillModel extends Model

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

            $passed_skills = $skill_rel_user->getUserSkills($user_id);

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

        $skill_rel_user = new SkillRelUserModel();

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

                        $skill_id,

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

                WHERE parent_id = '.$skill_id.'

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

            $passed_skills = $skill_rel_user->getUserSkills($user_id);

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

        $load_user_data = false,

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

            $done_skills = [];

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

                    if (!empty($done_skills)) {

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

        $skill_id,

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

                $skill['data'] = $skill_obj->get($skill['skill_id']);

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

        $user_id = false,

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

        $skill_id = (int) $skill_id;

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

        $skill_id = (int) $skill_id;

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

                $done_skills[] = $done_skill['skill_id'];

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

    public function relationExists($skill_id, $parent_id)

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

            $passed_skills = $skill_rel_user->getUserSkills($user_id);

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

            foreach ($passed_skills as $done_skill) {

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

            if ($add_child_info) {

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

    public function relationExists($skill_id, $parent_id)

The variable $skill_rel_user is not named in camelCase.
Open

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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 relationExists($skill_id, $parent_id)
    {
        $result = $this->find(
            'all',
            [

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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 getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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 getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function relationExists($skill_id, $parent_id)
    {
        $result = $this->find(
            'all',
            [

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 getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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

    public function getSkillParents($skillId, $add_child_info = true)
    {
        $skillId = (int) $skillId;
        $sql = 'SELECT child.* FROM '.$this->table.' child
                LEFT JOIN '.$this->table.' parent

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

    public function getChildren(
        $skill_id,
        $load_user_data = false,
        $user_id = false,
        $order = ''

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