chamilo/chamilo-lms

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

Summary

Maintainability
A
0 mins
Test Coverage

The method save() has an NPath complexity of 336. The configured NPath complexity threshold is 200.
Open

    public function save($params, $showQuery = false)
    {
        $params = $this->clean_parameters($params);

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

The property $is_course_model is not named in camelCase.
Open

class Model
{
    public $table;
    public $columns;
    public array $required;
Severity: Minor
Found in public/main/inc/lib/model.lib.php by phpmd

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

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

        if ($this->is_course_model) {

Method name "Model::get_all" is not in camel caps format
Open

    public function get_all(array $options = []): array

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

            $key_params = array_keys($params);

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

            $course_id = api_get_course_int_id();

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

        if ($this->is_course_model) {

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

        return $clean_params;

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

        if ($this->is_course_model) {

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

            if (!$require_ok) {

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

            $params = ['id = ? AND c_id = ?' => [$id, $course_id]];

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

                    $require_ok = false;

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

        $clean_params = [];

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

            $require_ok = true;

Missing function doc comment
Open

    public function get_all(array $options = []): array

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

        if ($this->is_course_model) {

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

                    $clean_params[$key] = $value;

Method name "Model::get_count" is not in camel caps format
Open

    public function get_count()

Member variable "is_course_model" is not in valid camel caps format
Open

    public $is_course_model = false;

Missing function doc comment
Open

    public function __construct()

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

                if (!in_array($field, $key_params)) {

Method name "Model::clean_parameters" is not in camel caps format
Open

    private function clean_parameters($params)

The variable $require_ok is not named in camelCase.
Open

    public function save($params, $showQuery = false)
    {
        $params = $this->clean_parameters($params);

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

    private function clean_parameters($params)
    {
        $clean_params = [];
        if (!empty($params)) {
            foreach ($params as $key => $value) {
Severity: Minor
Found in public/main/inc/lib/model.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 $clean_params is not named in camelCase.
Open

    private function clean_parameters($params)
    {
        $clean_params = [];
        if (!empty($params)) {
            foreach ($params as $key => $value) {
Severity: Minor
Found in public/main/inc/lib/model.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 function get($id)
    {
        if (empty($id)) {
            return [];
        }
Severity: Minor
Found in public/main/inc/lib/model.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 $key_params is not named in camelCase.
Open

    public function save($params, $showQuery = false)
    {
        $params = $this->clean_parameters($params);

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

    private function clean_parameters($params)
    {
        $clean_params = [];
        if (!empty($params)) {
            foreach ($params as $key => $value) {
Severity: Minor
Found in public/main/inc/lib/model.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 $require_ok is not named in camelCase.
Open

    public function save($params, $showQuery = false)
    {
        $params = $this->clean_parameters($params);

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

    public function save($params, $showQuery = false)
    {
        $params = $this->clean_parameters($params);

        if ($this->is_course_model) {
Severity: Minor
Found in public/main/inc/lib/model.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 function get($id)
    {
        if (empty($id)) {
            return [];
        }
Severity: Minor
Found in public/main/inc/lib/model.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 $require_ok is not named in camelCase.
Open

    public function save($params, $showQuery = false)
    {
        $params = $this->clean_parameters($params);

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

    private function clean_parameters($params)
    {
        $clean_params = [];
        if (!empty($params)) {
            foreach ($params as $key => $value) {
Severity: Minor
Found in public/main/inc/lib/model.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 get_all is not named in camelCase.
Open

    public function get_all(array $options = []): array
    {
        return Database::select('*', $this->table, $options);
    }
Severity: Minor
Found in public/main/inc/lib/model.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 get_count is not named in camelCase.
Open

    public function get_count()
    {
        $row = Database::select(
            'count(*) as count',
            $this->table,
Severity: Minor
Found in public/main/inc/lib/model.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