chamilo/chamilo-lms

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

Summary

Maintainability
A
0 mins
Test Coverage

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

        $xajax_response = new xajaxResponse();

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

                } else {
                    $return .= '...<br />';
                }

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

    public static function search_users($needle, $id)

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

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

        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);

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

                    ) '.$order_clause.' LIMIT 11';

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

        $xajax_response->addAssign(

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

                    FROM '.$tbl_user.' u

Missing parameter name
Open

     * @param string Search string

Missing parameter name
Open

     * @param int Deprecated param

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

        $xajax_response = new xajaxResponse();

Method name "AccessUrlEditUsersToUrl::search_users" is not in camel caps format
Open

    public static function search_users($needle, $id)

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

            $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';

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

        return $xajax_response;

The variable $tbl_user is not named in camelCase.
Open

    public static function search_users($needle, $id)
    {
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $xajax_response = new xajaxResponse();
        $return = '';

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

    public static function search_users($needle, $id)
    {
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $xajax_response = new xajaxResponse();
        $return = '';

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

    public static function search_users($needle, $id)
    {
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $xajax_response = new xajaxResponse();
        $return = '';

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

    public static function search_users($needle, $id)
    {
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $xajax_response = new xajaxResponse();
        $return = '';

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

    public static function search_users($needle, $id)
    {
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $xajax_response = new xajaxResponse();
        $return = '';

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

    public static function search_users($needle, $id)
    {
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $xajax_response = new xajaxResponse();
        $return = '';

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

    public static function search_users($needle, $id)
    {
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $xajax_response = new xajaxResponse();
        $return = '';

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

    public static function search_users($needle, $id)
    {
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $xajax_response = new xajaxResponse();
        $return = '';

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