chamilo/chamilo-lms

View on GitHub
public/main/inc/lib/plugin.class.php

Summary

Maintainability
A
0 mins
Test Coverage

The method install_course_fields() has an NPath complexity of 204. The configured NPath complexity threshold is 200.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 method getSettingsForm() has an NPath complexity of 6872. The configured NPath complexity threshold is 200.
Open

    public function getSettingsForm()
    {
        $result = new FormValidator($this->get_name());

        $defaults = [];
Severity: Minor
Found in public/main/inc/lib/plugin.class.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

Missing class import via use statement (line '205', column '23').
Open

        $result = new FormValidator($this->get_name());
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

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

Avoid assigning values to variables in if clauses and the like (line '211', column '13').
Open

    public function getSettingsForm()
    {
        $result = new FormValidator($this->get_name());

        $defaults = [];
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

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

    public function get_info()
    {
        $result = [];
        $result['obj'] = $this;
        $result['title'] = $this->get_title();
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

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

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

        } else {
            $settingsCurrentTable = Database::get_main_table(TABLE_MAIN_SETTINGS);
            $conditions = [
                'where' => [
                    "variable = 'show_tabs' AND title = ? AND comment = ? " => [
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 method install_course_fields uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $sql = "SELECT value FROM $t_course
                            WHERE c_id = $courseId AND variable = '$variable' ";
                    $result = Database::query($sql);
                    if (!Database::num_rows($result)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 method getCourseSettings uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $settings[] = $item['name'];
                }
Severity: Minor
Found in public/main/inc/lib/plugin.class.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

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

                    foreach ($type['options'] as $key => &$optionName) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 parameters such as '$values'.
Open

    public function course_settings_updated($values = [])
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

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 parameters such as '$variable'.
Open

    public function validateCourseSetting($variable)
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

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 parameters such as '$region'.
Open

    public function renderRegion($region)
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

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 parameters such as '$userId'.
Open

    public function doWhenDeletingUser($userId)
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

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 parameters such as '$courseId'.
Open

    public function doWhenDeletingCourse($courseId)
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

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 parameters such as '$sessionId'.
Open

    public function doWhenDeletingSession($sessionId)
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

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

class Plugin
{
    const TAB_FILTER_NO_STUDENT = '::no-student';
    const TAB_FILTER_ONLY_STUDENT = '::only-student';
    public $isCoursePlugin = false;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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

The property $course_settings is not named in camelCase.
Open

class Plugin
{
    const TAB_FILTER_NO_STUDENT = '::no-student';
    const TAB_FILTER_ONLY_STUDENT = '::only-student';
    public $isCoursePlugin = false;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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

The parameter $add_tool_link is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $add_tool_link is not named in camelCase.
Open

    public function install_course_fields_in_all_courses($add_tool_link = true)
    {
        // Update existing courses to add plugin settings
        $table = Database::get_main_table(TABLE_MAIN_COURSE);
        $sql = "SELECT id FROM $table ORDER BY id";
Severity: Minor
Found in public/main/inc/lib/plugin.class.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

Method name "Plugin::course_install" is not in camel caps format
Open

    public function course_install($courseId, $addToolLink = true)

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

                        Database::insert($t_course, $params);

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

                $sql = "DELETE FROM $t_course

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

        if (is_array($this->course_settings)) {

Method name "Plugin::course_settings_updated" is not in camel caps format
Open

    public function course_settings_updated($values = [])

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

                $language_interface = api_get_setting('platformLanguage');

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

    public function install_course_fields($courseId, $add_tool_link = true)

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

        if (!$add_tool_link || false == $this->addCourseTool) {

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

    public $course_settings = [];

Method name "Plugin::get_lang_plugin_exists" is not in camel caps format
Open

    public function get_lang_plugin_exists($name)

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

                $pluginGlobalValue = api_get_plugin_setting($plugin_name, $variable);

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

        $sql = "DELETE FROM $t_tool

Method name "Plugin::get_settings" is not in camel caps format
Open

    public function get_settings($forceFromDB = false)

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

                $interfaceLanguageId = api_get_language_id($language_interface);

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

                $parentPath = "{$root}{$plugin_name}/lang/{$languageParentFolder}.php";

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

            $this->install_course_fields($row['id'], $add_tool_link);

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

            foreach ($this->course_settings as $item) {

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

        global $language_files;

Method name "Plugin::get_lang" is not in camel caps format
Open

    public function get_lang($name)

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

            $interfaceLanguageId = api_get_language_id($language_interface);

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

            $english_path = $root.$plugin_name."/lang/english.php";

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

                include $english_path;

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

        $t_tool = Database::get_course_table(TABLE_TOOL_LIST);

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

            $language_interface = api_get_language_isocode();

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

            $plugin_name = $this->get_name();

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

        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);

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

                    $sql = "SELECT value FROM $t_course

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

    public function install_course_fields_in_all_courses($add_tool_link = true)

Method name "Plugin::get_comment" is not in camel caps format
Open

    public function get_comment()

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

                            FROM $t_course

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

        if (!empty($this->course_settings)) {

Method name "Plugin::uninstall_course_fields_in_all_courses" is not in camel caps format
Open

    public function uninstall_course_fields_in_all_courses()

Method name "Plugin::get_version" is not in camel caps format
Open

    public function get_version()

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

            $english_path = $root.$plugin_name."/lang/english.php";

Method name "Plugin::uninstall_course_fields" is not in camel caps format
Open

    public function uninstall_course_fields($courseId)

Method name "Plugin::install_course_fields_in_all_courses" is not in camel caps format
Open

    public function install_course_fields_in_all_courses($add_tool_link = true)

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

        $language_files[] = 'plugin_'.$this->get_name();

Method name "Plugin::get_title" is not in camel caps format
Open

    public function get_title()

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

            foreach ($this->course_settings as $setting) {

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

                            'subkey' => $plugin_name,

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

        $this->createLinkToCourseTool($plugin_name, $courseId);

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

    public function get_name()

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

            $path = $root.$plugin_name."/lang/$language_interface.php";

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

        if (!empty($this->course_settings)) {

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

    public $course_settings_callback = false;

Method name "Plugin::get_css" is not in camel caps format
Open

    public function get_css()

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

            if (is_readable($english_path)) {

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

            $path = $root.$plugin_name."/lang/$language_interface.php";

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

            foreach ($this->course_settings as $setting) {

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

                        Database::insert($t_course, $params);

Method name "Plugin::get_info" is not in camel caps format
Open

    public function get_info()

Method name "Plugin::get_author" is not in camel caps format
Open

    public function get_author()

Method name "Plugin::install_course_fields" is not in camel caps format
Open

    public function install_course_fields($courseId, $add_tool_link = true)

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

        $plugin_name = $this->get_name();

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

        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);

The 'get_lang_plugin_exists()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function get_lang_plugin_exists($name)
    {
        return isset($this->strings[$name]);
    }
Severity: Minor
Found in public/main/inc/lib/plugin.class.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

The variable $english_path is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $plugin_name is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $plugin_name is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $t_course is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $language_files is not named in camelCase.
Open

    protected function __construct($version, $author, $settings = [])
    {
        $this->version = $version;
        $this->author = $author;
        $this->fields = $settings;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $english_path is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $plugin_name is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $plugin_name is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $t_course is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $language_interface is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $t_course is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $language_interface is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $plugin_name is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $plugin_name is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $t_course is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $english_path is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $language_interface is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $language_interface is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $language_interface is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $language_files is not named in camelCase.
Open

    protected function __construct($version, $author, $settings = [])
    {
        $this->version = $version;
        $this->author = $author;
        $this->fields = $settings;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $t_course is not named in camelCase.
Open

    public function uninstall_course_fields($courseId)
    {
        $courseId = (int) $courseId;

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

    public function uninstall_course_fields($courseId)
    {
        $courseId = (int) $courseId;

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

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $t_course is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $plugin_name is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $t_tool is not named in camelCase.
Open

    public function uninstall_course_fields($courseId)
    {
        $courseId = (int) $courseId;

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

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 $t_course is not named in camelCase.
Open

    public function uninstall_course_fields($courseId)
    {
        $courseId = (int) $courseId;

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

    public function install_course_fields_in_all_courses($add_tool_link = true)
    {
        // Update existing courses to add plugin settings
        $table = Database::get_main_table(TABLE_MAIN_COURSE);
        $sql = "SELECT id FROM $table ORDER BY id";
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_lang is not named in camelCase.
Open

    public function get_lang($name)
    {
        // Check whether the language strings for the plugin have already been
        // loaded. If so, no need to load them again.
        if (is_null($this->strings)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 course_install is not named in camelCase.
Open

    public function course_install($courseId, $addToolLink = true)
    {
        $this->install_course_fields($courseId, $addToolLink);
    }
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_version is not named in camelCase.
Open

    public function get_version()
    {
        return $this->version;
    }
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_settings is not named in camelCase.
Open

    public function get_settings($forceFromDB = false)
    {
        if (empty($this->settings) || $forceFromDB) {
            $settings = api_get_settings_params(
                [
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_comment is not named in camelCase.
Open

    public function get_comment()
    {
        return $this->get_lang('plugin_comment');
    }
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_author is not named in camelCase.
Open

    public function get_author()
    {
        return $this->author;
    }
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_title is not named in camelCase.
Open

    public function get_title()
    {
        return $this->get_lang('plugin_title');
    }
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_name is not named in camelCase.
Open

    public function get_name()
    {
        $result = get_class($this);
        $result = str_replace('Plugin', '', $result);
        $result = strtolower($result);
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_css is not named in camelCase.
Open

    public function get_css()
    {
        $name = $this->get_name();
        $path = api_get_path(SYS_PLUGIN_PATH)."$name/resources/$name.css";
        if (!is_readable($path)) {
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_lang_plugin_exists is not named in camelCase.
Open

    public function get_lang_plugin_exists($name)
    {
        return isset($this->strings[$name]);
    }
Severity: Minor
Found in public/main/inc/lib/plugin.class.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_info is not named in camelCase.
Open

    public function get_info()
    {
        $result = [];
        $result['obj'] = $this;
        $result['title'] = $this->get_title();
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 install_course_fields_in_all_courses is not named in camelCase.
Open

    public function install_course_fields_in_all_courses($add_tool_link = true)
    {
        // Update existing courses to add plugin settings
        $table = Database::get_main_table(TABLE_MAIN_COURSE);
        $sql = "SELECT id FROM $table ORDER BY id";
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 install_course_fields is not named in camelCase.
Open

    public function install_course_fields($courseId, $add_tool_link = true)
    {
        $plugin_name = $this->get_name();
        $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
        $courseId = (int) $courseId;
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 uninstall_course_fields is not named in camelCase.
Open

    public function uninstall_course_fields($courseId)
    {
        $courseId = (int) $courseId;

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

    public function uninstall_course_fields_in_all_courses()
    {
        // Update existing courses to add conference settings
        $table = Database::get_main_table(TABLE_MAIN_COURSE);
        $sql = "SELECT id FROM $table
Severity: Minor
Found in public/main/inc/lib/plugin.class.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 course_settings_updated is not named in camelCase.
Open

    public function course_settings_updated($values = [])
    {
    }
Severity: Minor
Found in public/main/inc/lib/plugin.class.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