chamilo/chamilo-lms

View on GitHub
public/main/group/tutor_settings.php

Summary

Maintainability
A
0 mins
Test Coverage

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

            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
Severity: Minor
Found in public/main/group/tutor_settings.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 sort_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if (0 !== $cmp) {
                return $cmp;
            } else {
Severity: Minor
Found in public/main/group/tutor_settings.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 sort_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
            if (0 !== $cmp) {
                return $cmp;
            } else {
Severity: Minor
Found in public/main/group/tutor_settings.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 sort_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
            if (0 !== $cmp) {
                return $cmp;
            } else {
Severity: Minor
Found in public/main/group/tutor_settings.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 sort_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
Severity: Minor
Found in public/main/group/tutor_settings.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 sort_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
        if (0 !== $cmp) {
            return $cmp;
        } else {
Severity: Minor
Found in public/main/group/tutor_settings.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 sort_users uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                return api_strcmp($user_a['username'], $user_b['username']);
            }
Severity: Minor
Found in public/main/group/tutor_settings.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 parameter $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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

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

            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);

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

$current_course_tool = TOOL_GROUP;

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

$is_group_member = GroupManager::isTutorOfGroup(api_get_user_id(), $groupEntity);

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

                return api_strcmp($user_a['username'], $user_b['username']);

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

$group_tutor_list = $groupEntity->getTutors();

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

if (!empty($complete_user_list)) {

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

$defaults['group_tutors'] = $selected_tutors;

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

function sort_users($user_a, $user_b)

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

$groupEntity = api_get_group_entity($group_id);

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

    $selected_tutors[] = $user->getUser()->getId();

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

            $possible_users[$user['user_id']] = $name.$groupNameListToString;

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

$defaults = $current_group;

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

    $keyword_name = Security::remove_XSS($_GET['keyword']);

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

if (!api_is_allowed_to_edit(false, true) && !$is_group_member) {

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

        $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);

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

        $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);

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

        $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);

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

                return api_strcmp($user_a['username'], $user_b['username']);

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

    foreach ($complete_user_list as $index => $user) {

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

        $max_member = $cat['max_student'];

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

            $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);

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

    GroupManager::unsubscribe_all_tutors($group_id);

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

        $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);

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

$group_id = api_get_group_id();

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

                return api_strcmp($user_a['username'], $user_b['username']);

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

$selected_tutors = [];

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

$group_tutors_element = $form->addMultiSelect(

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

    echo '<br/>'.get_lang('Search results for:').' <span style="font-style: italic ;"> '.$keyword_name.' </span><br>';

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

            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);

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

                return api_strcmp($user_a['username'], $user_b['username']);

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

$current_group = GroupManager::get_group_properties($group_id);

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

        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);

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

            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);

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

    usort($complete_user_list, 'sort_users');

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

        count($_POST['group_members']) > $max_member &&

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

            $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);

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

            $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);

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

                return api_strcmp($user_a['username'], $user_b['username']);

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

$possible_users = [];

Consider putting global function "sort_users" in a static class
Open

function sort_users($user_a, $user_b)

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

function sort_users($user_a, $user_b)

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

        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);

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

$complete_user_list = CourseManager::get_user_list_from_course_code(

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

    $max_member = null;

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

$current_group = GroupManager::get_group_properties($group_id);

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

foreach ($group_tutor_list as $user) {

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

    $possible_users,

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

        GroupManager::MEMBER_PER_GROUP_NO_LIMIT != $max_member

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

$this_section = SECTION_COURSES;

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

                return api_strcmp($user_a['username'], $user_b['username']);

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

    $cat = GroupManager::get_category_from_group($group_id);

The variable $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_a is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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 $user_b is not named in camelCase.
Open

function sort_users($user_a, $user_b)
{
    $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
    if ('true' === $orderListByOfficialCode) {
        $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
Severity: Minor
Found in public/main/group/tutor_settings.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

There are no issues that match your filters.

Category
Status