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']);
}
- Read upRead up
- Exclude checks
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 {
- Read upRead up
- Exclude checks
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 {
- Read upRead up
- Exclude checks
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 {
- Read upRead up
- Exclude checks
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']);
}
- Read upRead up
- Exclude checks
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 {
- Read upRead up
- Exclude checks
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']);
}
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Exclude checks
Variable "current_course_tool" is not in valid camel caps format Open
$current_course_tool = TOOL_GROUP;
- Exclude checks
Variable "is_group_member" is not in valid camel caps format Open
$is_group_member = GroupManager::isTutorOfGroup(api_get_user_id(), $groupEntity);
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
return api_strcmp($user_a['username'], $user_b['username']);
- Exclude checks
Variable "group_tutor_list" is not in valid camel caps format Open
$group_tutor_list = $groupEntity->getTutors();
- Exclude checks
Variable "complete_user_list" is not in valid camel caps format Open
if (!empty($complete_user_list)) {
- Exclude checks
Variable "selected_tutors" is not in valid camel caps format Open
$defaults['group_tutors'] = $selected_tutors;
- Exclude checks
Variable "user_a" is not in valid camel caps format Open
function sort_users($user_a, $user_b)
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
$groupEntity = api_get_group_entity($group_id);
- Exclude checks
Variable "selected_tutors" is not in valid camel caps format Open
$selected_tutors[] = $user->getUser()->getId();
- Exclude checks
Variable "possible_users" is not in valid camel caps format Open
$possible_users[$user['user_id']] = $name.$groupNameListToString;
- Exclude checks
Variable "current_group" is not in valid camel caps format Open
$defaults = $current_group;
- Exclude checks
Variable "keyword_name" is not in valid camel caps format Open
$keyword_name = Security::remove_XSS($_GET['keyword']);
- Exclude checks
Variable "is_group_member" is not in valid camel caps format Open
if (!api_is_allowed_to_edit(false, true) && !$is_group_member) {
- Exclude checks
Variable "user_a" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
- Exclude checks
Variable "user_a" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
return api_strcmp($user_a['username'], $user_b['username']);
- Exclude checks
Variable "complete_user_list" is not in valid camel caps format Open
foreach ($complete_user_list as $index => $user) {
- Exclude checks
Variable "max_member" is not in valid camel caps format Open
$max_member = $cat['max_student'];
- Exclude checks
Variable "user_a" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
GroupManager::unsubscribe_all_tutors($group_id);
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
$group_id = api_get_group_id();
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
return api_strcmp($user_a['username'], $user_b['username']);
- Exclude checks
Variable "selected_tutors" is not in valid camel caps format Open
$selected_tutors = [];
- Exclude checks
Variable "group_tutors_element" is not in valid camel caps format Open
$group_tutors_element = $form->addMultiSelect(
- Exclude checks
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>';
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
- Exclude checks
Variable "user_a" is not in valid camel caps format Open
return api_strcmp($user_a['username'], $user_b['username']);
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
$current_group = GroupManager::get_group_properties($group_id);
- Exclude checks
Variable "user_a" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
- Exclude checks
Variable "user_a" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
- Exclude checks
Variable "complete_user_list" is not in valid camel caps format Open
usort($complete_user_list, 'sort_users');
- Exclude checks
Variable "max_member" is not in valid camel caps format Open
count($_POST['group_members']) > $max_member &&
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['firstname'], $user_b['firstname']);
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['lastname'], $user_b['lastname']);
- Exclude checks
Variable "user_a" is not in valid camel caps format Open
return api_strcmp($user_a['username'], $user_b['username']);
- Exclude checks
Variable "possible_users" is not in valid camel caps format Open
$possible_users = [];
- Exclude checks
Consider putting global function "sort_users" in a static class Open
function sort_users($user_a, $user_b)
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
function sort_users($user_a, $user_b)
- Exclude checks
Variable "user_b" is not in valid camel caps format Open
$cmp = api_strcmp($user_a['official_code'], $user_b['official_code']);
- Exclude checks
Variable "complete_user_list" is not in valid camel caps format Open
$complete_user_list = CourseManager::get_user_list_from_course_code(
- Exclude checks
Variable "max_member" is not in valid camel caps format Open
$max_member = null;
- Exclude checks
Variable "current_group" is not in valid camel caps format Open
$current_group = GroupManager::get_group_properties($group_id);
- Exclude checks
Variable "group_tutor_list" is not in valid camel caps format Open
foreach ($group_tutor_list as $user) {
- Exclude checks
Variable "possible_users" is not in valid camel caps format Open
$possible_users,
- Exclude checks
Variable "max_member" is not in valid camel caps format Open
GroupManager::MEMBER_PER_GROUP_NO_LIMIT != $max_member
- Exclude checks
Variable "this_section" is not in valid camel caps format Open
$this_section = SECTION_COURSES;
- Exclude checks
Variable "user_a" is not in valid camel caps format Open
return api_strcmp($user_a['username'], $user_b['username']);
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
$cat = GroupManager::get_category_from_group($group_id);
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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();
}
}