The method get_group_user_data uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sql = 'SELECT DISTINCT
user.id AS col0,
'.(
api_is_western_name_order() ?
- 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 get_group_user_data uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (api_is_allowed_to_edit()) {
$sql = 'SELECT DISTINCT
u.id AS col0,
'.(api_is_western_name_order() ?
- 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 $number_of_items is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 "unsubscribe_group" is not in valid camel caps format Open
$unsubscribe_group = '';
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
if (GroupManager::is_self_unregistration_allowed($user_id, $groupEntity)) {
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
echo Display::actions($actions_array);
- Exclude checks
Variable "tutor_info" is not in valid camel caps format Open
$tutor_info .= '<li>';
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
if (empty($groupInfo) || empty($course_id)) {
- Exclude checks
Variable "table_group_user" is not in valid camel caps format Open
$table_group_user = Database::get_course_table(TABLE_GROUP_USER);
- Exclude checks
Variable "current_course_tool" is not in valid camel caps format Open
$current_course_tool = TOOL_GROUP;
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$user_id = api_get_user_id();
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
href="'.api_get_self().'?selfReg=1&group_id='.$group_id.'"
- Exclude checks
Variable "edit_url" is not in valid camel caps format Open
$edit_url = '<a
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
if (empty($groupInfo) || empty($course_id)) {
- Exclude checks
Missing function doc comment Open
function activeFilter($isActive)
- Exclude checks
Variable "edit_url" is not in valid camel caps format Open
Security::remove_XSS($groupEntity->getTitle()).' '.$edit_url.' '.$subscribe_group.' '.$unsubscribe_group
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
if (!empty($group_id)) {
- Exclude checks
Variable "tutor_info" is not in valid camel caps format Open
$tutor_info .= '<ul class="thumbnails">';
- Exclude checks
Variable "my_gidreq" is not in valid camel caps format Open
$my_gidreq = isset($_GET['gid']) ? (int) $_GET['gid'] : 0;
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
c_id = $course_id AND
- Exclude checks
Variable "number_of_items" is not in valid camel caps format Open
function get_group_user_data($from, $number_of_items, $column, $direction)
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
GroupManager::userHasAccessToBrowse($user_id, $groupEntity, api_get_session_id())
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
$groupFilter = "&type=course&user_id=GROUP:$group_id";
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
if (!empty($actions_array)) {
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "tutor_info" is not in valid camel caps format Open
$tutor_info = get_lang('(none)');
- Exclude checks
Consider putting global function "get_number_of_group_users" in a static class Open
function get_number_of_group_users()
- Exclude checks
Variable "table_user" is not in valid camel caps format Open
$table_user = Database::get_main_table(TABLE_MAIN_USER);
- Exclude checks
Variable "number_of_items" is not in valid camel caps format Open
LIMIT $from, $number_of_items";
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
$groupEntity = api_get_group_entity($group_id);
- Exclude checks
Variable "unsubscribe_group" is not in valid camel caps format Open
Security::remove_XSS($groupEntity->getTitle()).' '.$edit_url.' '.$subscribe_group.' '.$unsubscribe_group
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
$groupFilter = "&type=course&user_id=GROUP:$group_id";
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
api_get_cidreq().'&action=show&title=index&sid='.api_get_session_id().'&gid='.$group_id,
- Exclude checks
Variable "table_user" is not in valid camel caps format Open
FROM $table_user u
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
group_rel_user.c_id = $course_id AND
- Exclude checks
Variable "subscribe_group" is not in valid camel caps format Open
$subscribe_group = '<a
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
'url' => api_get_path(WEB_CODE_PATH).'chat/chat.php?'.api_get_cidreq().'&toolgroup='.$group_id,
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
if (!empty($actions_array)) {
- Exclude checks
Variable "tutor_info" is not in valid camel caps format Open
$tutor_info = '';
- Exclude checks
Variable "tutor_info" is not in valid camel caps format Open
if (!empty($tutor_info)) {
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
gu.c_id = $course_id
- Exclude checks
Variable "table_user" is not in valid camel caps format Open
FROM $table_user user
- Exclude checks
Variable "number_of_items" is not in valid camel caps format Open
LIMIT $from, $number_of_items";
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
GroupManager::subscribeUsers($user_id, $groupEntity);
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
GroupManager::isTutorOfGroup($user_id, $groupEntity)
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
echo Display::actions($actions_array);
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
group_rel_user.c_id = $course_id AND
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq().'&toolgroup='.$group_id."','window_chat_group_".api_get_course_id().'_'.api_get_group_id()."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"",
- Exclude checks
Variable "tutor_info" is not in valid camel caps format Open
echo $tutor_info;
- Exclude checks
Variable "my_cidreq" is not in valid camel caps format Open
$my_cidreq = isset($_GET['cid']) ? (int) $_GET['cid'] : 0;
- Exclude checks
Variable "my_cidreq" is not in valid camel caps format Open
$parameters = ['cid' => $my_cidreq, 'origin' => $origin, 'gid' => $my_gidreq];
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
$course_id = api_get_course_int_id();
- Exclude checks
Variable "table_group_user" is not in valid camel caps format Open
INNER JOIN $table_group_user gu
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
if (!GroupManager::userHasAccessToBrowse($user_id, $groupEntity, api_get_session_id())) {
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array = [];
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array = [];
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "tutor_info" is not in valid camel caps format Open
$tutor_info .= $photo.$completeName;
- Exclude checks
Variable "user_is_tutor" is not in valid camel caps format Open
!empty($user_is_tutor) ||
- Exclude checks
Variable "my_gidreq" is not in valid camel caps format Open
$parameters = ['cid' => $my_cidreq, 'origin' => $origin, 'gid' => $my_gidreq];
- Exclude checks
Consider putting global function "activeFilter" in a static class Open
function activeFilter($isActive)
- Exclude checks
Variable "unsubscribe_group" is not in valid camel caps format Open
$unsubscribe_group = '<a
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Consider putting global function "get_group_user_data" in a static class Open
function get_group_user_data($from, $number_of_items, $column, $direction)
- Exclude checks
Variable "table_group_user" is not in valid camel caps format Open
INNER JOIN $table_group_user group_rel_user
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
if (!empty($group_id)) {
- Exclude checks
Variable "this_section" is not in valid camel caps format Open
$this_section = SECTION_COURSES;
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
if (GroupManager::is_self_registration_allowed($user_id, $groupEntity)) {
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
if (!empty($group_id)) {
- Exclude checks
Variable "tutor_info" is not in valid camel caps format Open
$tutor_info .= '</li>';
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
GroupManager::unsubscribeUsers($user_id, $groupEntity);
- Exclude checks
Variable "subscribe_group" is not in valid camel caps format Open
$subscribe_group = '';
- Exclude checks
Variable "edit_url" is not in valid camel caps format Open
$edit_url = '';
- Exclude checks
Variable "subscribe_group" is not in valid camel caps format Open
Security::remove_XSS($groupEntity->getTitle()).' '.$edit_url.' '.$subscribe_group.' '.$unsubscribe_group
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "group_id" is not in valid camel caps format Open
$group_id = api_get_group_id();
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
GroupManager::is_self_registration_allowed($user_id, $groupEntity)
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
GroupManager::is_self_unregistration_allowed($user_id, $groupEntity)
- Exclude checks
Variable "tutor_info" is not in valid camel caps format Open
$tutor_info .= '</ul>';
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
$course_id = api_get_course_int_id();
- Exclude checks
Consider putting global function "email_filter" in a static class Open
function email_filter($email)
- Exclude checks
Variable "actions_array" is not in valid camel caps format Open
$actions_array[] = [
- Exclude checks
Variable "table_user" is not in valid camel caps format Open
FROM $table_user user
- Exclude checks
Variable "table_group_user" is not in valid camel caps format Open
INNER JOIN $table_group_user group_rel_user
- Exclude checks
Variable "number_of_items" is not in valid camel caps format Open
LIMIT $from, $number_of_items";
- Exclude checks
The variable $number_of_items is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $number_of_items is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $table_group_user is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $course_id is not named in camelCase. Open
function get_number_of_group_users()
{
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $table_group_user is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $table_group_user is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $table_user is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $course_id is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $table_group_user is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $number_of_items is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $course_id is not named in camelCase. Open
function get_number_of_group_users()
{
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $table_user is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $course_id is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $course_id is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $course_id is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $table_user is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $course_id is not named in camelCase. Open
function get_number_of_group_users()
{
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $course_id is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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 $table_user is not named in camelCase. Open
function get_group_user_data($from, $number_of_items, $column, $direction)
{
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$groupInfo = GroupManager::get_group_properties(api_get_group_id());
$course_id = api_get_course_int_id();
- 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();
}
}