chamilo/chamilo-lms

View on GitHub
public/main/gradebook/lib/fe/dataform.class.php

Summary

Maintainability
A
0 mins
Test Coverage

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

            } else {
                $this->build_export_form();
            }

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

    protected function build_export_form_option($show_pdf = true)

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

    public function __construct(
        $form_type,
        $form_name,
        $method = 'post',
        $action = null,

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

    public function __construct(
        $form_type,
        $form_name,
        $method = 'post',
        $action = null,

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

    public function __construct(
        $form_type,
        $form_name,
        $method = 'post',
        $action = null,

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

    protected function build_export_form_option($show_pdf = true)
    {
        $this->addElement('header', get_lang('PDF report'));
        $this->addElement('radio', 'file_type', get_lang('Output file type'), 'CSV (Comma-Separated Values)', 'csv');
        $this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml');

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

Missing parameter name
Open

     * @param int form_type 1=import, 2=export

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

        $this->form_type = $form_type;

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

        } elseif (self::TYPE_EXPORT == $this->form_type) {

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

        } elseif (self::TYPE_EXPORT_PDF == $this->form_type) {

Missing function doc comment
Open

    public function setDefaults($defaultValues = [], $filter = null)

Missing parameter name
Open

     * @param obj cat_obj the category object

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

        $this->form_type = $form_type;

Missing parameter name
Open

     * @param obj res_obj the result object

Missing parameter name
Open

     * @param action

Method name "DataForm::build_export_form" is not in camel caps format
Open

    protected function build_export_form()

Missing parameter name
Open

     * @param method

Method name "DataForm::build_export_form_option" is not in camel caps format
Open

    protected function build_export_form_option($show_pdf = true)

Method name "DataForm::build_pdf_export_form" is not in camel caps format
Open

    protected function build_pdf_export_form()

Method name "DataForm::build_import_form" is not in camel caps format
Open

    protected function build_import_form()

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

        $form_name,

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

        parent:: __construct($form_name, $method, $action, $target);

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

        if (self::TYPE_IMPORT == $this->form_type) {

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

            if (0 == $locked_status) {

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

    protected function build_export_form_option($show_pdf = true)

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

        $form_type,

Missing parameter name
Open

     * @param string form name

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

        $locked_status

Missing function doc comment
Open

    public function display()

Arguments with default values must be at the end of the argument list
Open

        $locked_status

The variable $form_name is not named in camelCase.
Open

    public function __construct(
        $form_type,
        $form_name,
        $method = 'post',
        $action = null,

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

    public function __construct(
        $form_type,
        $form_name,
        $method = 'post',
        $action = null,

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

    public function __construct(
        $form_type,
        $form_name,
        $method = 'post',
        $action = null,

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

    protected function build_export_form_option($show_pdf = true)
    {
        $this->addElement('header', get_lang('PDF report'));
        $this->addElement('radio', 'file_type', get_lang('Output file type'), 'CSV (Comma-Separated Values)', 'csv');
        $this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml');

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

    protected function build_import_form()
    {
        $this->addElement('hidden', 'formSent');
        $this->addElement('header', get_lang('Import marks in an assessment'));
        $this->addElement('file', 'import_file', get_lang('URL/URI'));

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

    protected function build_pdf_export_form()
    {
        $renderer = &$this->defaultRenderer();
        $renderer->setCustomElementTemplate('<span>{element}</span>');
        $this->addElement('header', get_lang('Choose orientation'));

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

    protected function build_export_form()
    {
        $this->addElement('header', get_lang('PDF report'));
        $this->addElement('radio', 'file_type', get_lang('Output file type'), 'CSV (Comma-Separated Values)', 'csv');
        $this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml');

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