chamilo/chamilo-lms

View on GitHub
public/main/gradebook/lib/be/exerciselink.class.php

Summary

Maintainability
A
0 mins
Test Coverage

The method calc_score() has an NPath complexity of 3926664. The configured NPath complexity threshold is 200.
Open

    public function calc_score($studentId = null, $type = null)
    {
        $allowStats = ('true' === api_get_setting('gradebook.allow_gradebook_stats'));
        if ($allowStats) {
            $link = $this->entity;

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

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

            $cache = new \Symfony\Component\Cache\Adapter\ApcuAdapter();

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 '208', column '25').
Open

        $exercise = new Exercise($courseId);

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

        } else {
            $session_condition = api_get_session_condition($sessionId, true, true);
        }

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

            } else {
                if ($cacheAvailable) {
                    $cacheItem = $cache->getItem($key);
                    $cacheItem->set(null);
                    $cache->save($cacheItem);

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

        } else {
            // all students -> get average
            // normal way of getting the info
            $students = []; // user list, needed to make sure we only
            // take first attempts into account

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

                        } else {
                            if (in_array('session_id', $lpData) && (int) $lpData['session_id'] == $sessionId) {
                                $lpList[] = $lpData['lp_id'];
                            }
                        }

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

            } else {
                // Try with iid
                $sql = 'SELECT * FROM '.$table.'
                    WHERE
                        iid = '.$exerciseId;

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

            } else {
                $lpCondition = null;
                if (!empty($exercise->lpList)) {
                    //$lpId = $exercise->getLpBySession($sessionId);
                    $lpList = [];

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

        } else {
            $sql = "SELECT * FROM $tblHp hp
                    INNER JOIN $tblDoc doc
                    ON (hp.title = doc.path AND doc.c_id = hp.c_id)
                    WHERE

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

                        } else {
                            $studentCount = count($this->getStudentList());
                            $sumResult = array_sum($link->getUserScoreList());
                            $result = [$sumResult, $studentCount];
                        }

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

            } else {
                switch ($type) {
                    case 'best':
                        $result = [$bestResult, $weight];
                        if ($cacheAvailable) {

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

        } else {
            $table = Database::get_course_table(TABLE_QUIZ_TEST);
        }

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

                } else {
                    // Try wit id
                    $sql = 'SELECT * FROM '.$table.'
                        WHERE
                            c_id = '.$this->course_id.' AND

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 assigning values to variables in if clauses and the like (line '283', column '17').
Open

    public function calc_score($studentId = null, $type = null)
    {
        $allowStats = ('true' === api_get_setting('gradebook.allow_gradebook_stats'));
        if ($allowStats) {
            $link = $this->entity;

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid unused parameters such as '$getOnlyHotPotatoes'.
Open

    public function get_all_links($getOnlyHotPotatoes = false)

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

            $session_condition = api_get_session_condition(0, true);

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

                while ($attempt = Database::fetch_array($attempts)) {

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

        $uploadPath = null;

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

        $cacheDriver = null;

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

class ExerciseLink extends AbstractLink
{
    public $checkBaseExercises = false;
    private $exercise_table;
    private $exercise_data = [];

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

The property $exercise_table is not named in camelCase.
Open

class ExerciseLink extends AbstractLink
{
    public $checkBaseExercises = false;
    private $exercise_table;
    private $exercise_data = [];

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

The property $is_hp is not named in camelCase.
Open

class ExerciseLink extends AbstractLink
{
    public $checkBaseExercises = false;
    private $exercise_table;
    private $exercise_data = [];

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

Method name "ExerciseLink::has_results" is not in camel caps format
Open

    public function has_results()

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

                        $student_count++;

Method name "ExerciseLink::get_exercise_data" is not in camel caps format
Open

    public function get_exercise_data()

Method name "ExerciseLink::get_exercise_table" is not in camel caps format
Open

    private function get_exercise_table()

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

            $session_condition = api_get_session_condition($sessionId, true, true);

Method name "ExerciseLink::needs_name_and_description" is not in camel caps format
Open

    public function needs_name_and_description()

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

        if (1 == $this->is_hp) {

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

        $this->is_hp = $hp;

Method name "ExerciseLink::get_type_name" is not in camel caps format
Open

    public function get_type_name()

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

        return $this->exercise_data;

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

            if (false == $exercise->exercise_was_added_in_lp) {

Method name "ExerciseLink::needs_results" is not in camel caps format
Open

    public function needs_results()

Method name "ExerciseLink::is_allowed_to_change_name" is not in camel caps format
Open

    public function is_allowed_to_change_name()

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

                    $this->exercise_data = Database::fetch_array($result);

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

        $course = api_get_course_entity($this->course_id);

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

        $course_id = ($this->getCourseId());

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

            if (0 == $student_count) {

Method name "ExerciseLink::get_description" is not in camel caps format
Open

    public function get_description()

Missing function doc comment
Open

    public function getStats($type)

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

                    c_id = $course_id AND

Method name "ExerciseLink::calc_score" is not in camel caps format
Open

    public function calc_score($studentId = null, $type = null)

Method name "ExerciseLink::needs_max" is not in camel caps format
Open

    public function needs_max()

Missing function doc comment
Open

    public function needs_results()

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

                    $this->exercise_data = Database::fetch_array($result);

Method name "ExerciseLink::get_all_links" is not in camel caps format
Open

    public function get_all_links($getOnlyHotPotatoes = false)

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

        $tbl_stats = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);

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

                        $result = [$sum, $student_count];

Method name "ExerciseLink::get_link" is not in camel caps format
Open

    public function get_link()

Method name "ExerciseLink::is_valid_link" is not in camel caps format
Open

    public function is_valid_link()

Missing function doc comment
Open

    public function needs_max()

Missing function doc comment
Open

    public function is_allowed_to_change_name()

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

        if (empty($this->exercise_data)) {

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

        if (empty($this->exercise_data)) {

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

            if (1 == $this->is_hp) {

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

        $this->exercise_table = Database::get_course_table(TABLE_QUIZ_TEST);

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

            $student_count = 0;

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

        if (1 == $this->is_hp) {

Missing function doc comment
Open

    public function getBestScore()

Method name "ExerciseLink::get_name" is not in camel caps format
Open

    public function get_name()

Missing function doc comment
Open

    public function getLpListToString()

Missing function doc comment
Open

    public function needs_name_and_description()

Method name "ExerciseLink::get_icon_name" is not in camel caps format
Open

    public function get_icon_name()

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

        if (1 == $this->is_hp) {

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

        if (!$this->is_hp) {

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

                            c_id = '.$this->course_id.' AND

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

        return $this->exercise_table;

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

            $session_condition = api_get_session_condition(0, true);

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

                FROM $tbl_stats

The variable $student_count is not named in camelCase.
Open

    public function calc_score($studentId = null, $type = null)
    {
        $allowStats = ('true' === api_get_setting('gradebook.allow_gradebook_stats'));
        if ($allowStats) {
            $link = $this->entity;

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

    public function has_results()
    {
        $tbl_stats = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
        $sessionId = $this->get_session_id();
        $course_id = ($this->getCourseId());

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

    public function calc_score($studentId = null, $type = null)
    {
        $allowStats = ('true' === api_get_setting('gradebook.allow_gradebook_stats'));
        if ($allowStats) {
            $link = $this->entity;

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

    public function calc_score($studentId = null, $type = null)
    {
        $allowStats = ('true' === api_get_setting('gradebook.allow_gradebook_stats'));
        if ($allowStats) {
            $link = $this->entity;

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

    public function calc_score($studentId = null, $type = null)
    {
        $allowStats = ('true' === api_get_setting('gradebook.allow_gradebook_stats'));
        if ($allowStats) {
            $link = $this->entity;

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 has_results()
    {
        $tbl_stats = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
        $sessionId = $this->get_session_id();
        $course_id = ($this->getCourseId());

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

    public function get_all_links($getOnlyHotPotatoes = false)
    {
        $exerciseTable = $this->get_exercise_table();
        $lpItemTable = Database::get_course_table(TABLE_LP_ITEM);
        if (empty($this->getCourseId())) {

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

    public function get_all_links($getOnlyHotPotatoes = false)
    {
        $exerciseTable = $this->get_exercise_table();
        $lpItemTable = Database::get_course_table(TABLE_LP_ITEM);
        if (empty($this->getCourseId())) {

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 has_results()
    {
        $tbl_stats = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
        $sessionId = $this->get_session_id();
        $course_id = ($this->getCourseId());

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

    public function has_results()
    {
        $tbl_stats = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
        $sessionId = $this->get_session_id();
        $course_id = ($this->getCourseId());

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

    public function is_allowed_to_change_name()
    {
        return false;
    }

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

    public function is_valid_link()
    {
        $exerciseData = $this->get_exercise_data();

        return !empty($exerciseData);

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

    public function needs_results()
    {
        return false;
    }

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

    public function get_description()
    {
        $data = $this->get_exercise_data();

        return isset($data['description']) ? $data['description'] : null;

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

    public function get_exercise_data()
    {
        if (1 == $this->is_hp) {
            $table = Database::get_course_table(TABLE_DOCUMENT);
        } else {

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

    public function get_type_name()
    {
        if (1 == $this->is_hp) {
            return 'HotPotatoes';
        }

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

    public function needs_name_and_description()
    {
        return false;
    }

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

    public function get_all_links($getOnlyHotPotatoes = false)
    {
        $exerciseTable = $this->get_exercise_table();
        $lpItemTable = Database::get_course_table(TABLE_LP_ITEM);
        if (empty($this->getCourseId())) {

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

    public function get_icon_name()
    {
        return 'exercise';
    }

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

    public function get_name()
    {
        $data = $this->get_exercise_data();

        return $data['title'];

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

    public function get_link()
    {
        $sessionId = $this->get_session_id();
        $data = $this->get_exercise_data();
        $exerciseId = $data['iid'];

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

    public function calc_score($studentId = null, $type = null)
    {
        $allowStats = ('true' === api_get_setting('gradebook.allow_gradebook_stats'));
        if ($allowStats) {
            $link = $this->entity;

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

    private function get_exercise_table()
    {
        $this->exercise_table = Database::get_course_table(TABLE_QUIZ_TEST);

        return $this->exercise_table;

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

    public function needs_max()
    {
        return false;
    }

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

    public function has_results()
    {
        $tbl_stats = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
        $sessionId = $this->get_session_id();
        $course_id = ($this->getCourseId());

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