Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONTRIB-9416: Fix codechecker errors #612

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backup/moodle2/backup_bigbluebuttonbn_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ protected function define_structure() {
'recordings_html', 'recordings_imported', 'recordings_preview',
'clienttype', 'muteonstart', 'completionattendance',
'completionengagementchats', 'completionengagementtalks', 'completionengagementraisehand',
'completionengagementpollvotes', 'completionengagementemojis']);
'completionengagementpollvotes', 'completionengagementemojis', ]);

$logs = new backup_nested_element('logs');

$log = new backup_nested_element('log', ['id'], [
'courseid', 'bigbluebuttonbnid', 'userid', 'timecreated', 'meetingid', 'log', 'meta']);
'courseid', 'bigbluebuttonbnid', 'userid', 'timecreated', 'meetingid', 'log', 'meta', ]);

$recordings = new backup_nested_element('recordings');

$recording = new backup_nested_element('recording', ['id'], [
'courseid', 'bigbluebuttonbnid', 'groupid', 'recordingid', 'headlesss', 'imported', 'status', 'importeddata',
'timecreated']);
'timecreated', ]);

// Build the tree.
$bigbluebuttonbn->add_child($logs);
Expand Down
8 changes: 4 additions & 4 deletions classes/broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class broker {
protected $requiredparams = [
'recording_ready' => [
'bigbluebuttonbn' => 'The BigBlueButtonBN instance ID must be specified.',
'signed_parameters' => 'A JWT encoded string must be included as [signed_parameters].'
'signed_parameters' => 'A JWT encoded string must be included as [signed_parameters].',
],
'meeting_events' => [
'bigbluebuttonbn' => 'The BigBlueButtonBN instance ID must be specified.'
'bigbluebuttonbn' => 'The BigBlueButtonBN instance ID must be specified.',
],
];

Expand Down Expand Up @@ -89,7 +89,7 @@ public static function process_recording_ready(instance $instance, array $params
$decodedparameters = JWT::decode(
$params['signed_parameters'],
config::get('shared_secret'),
array('HS256')
['HS256'],
);
} catch (Exception $e) {
$error = 'Caught exception: ' . $e->getMessage();
Expand Down Expand Up @@ -153,7 +153,7 @@ public static function process_meeting_events(instance $instance) {
$token = JWT::decode(
$authorization[1],
config::get('shared_secret'),
array('HS512')
['HS512'],
);

// Get JSON string from the body.
Expand Down
2 changes: 1 addition & 1 deletion classes/event/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function get_description() {
'courseid' => $this->courseid,
'objectid' => $this->objectid,
'contextinstanceid' => $this->contextinstanceid,
'other' => $this->other
'other' => $this->other,
];
$string = $this->description;
foreach ($vars as $key => $value) {
Expand Down
2 changes: 1 addition & 1 deletion classes/event/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ class events {
'recording_unpublish' => 'recording_unpublished',
'recording_edit' => 'recording_edited',
'recording_play' => 'recording_viewed',
'live_session' => 'live_session'
'live_session' => 'live_session',
];
}
6 changes: 3 additions & 3 deletions classes/external/completion_validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ public static function execute(
'item' => 'mod_bigbluebuttonbn',
'itemid' => $instance->get_instance_id(),
'warningcode' => 'nopermissions',
'message' => get_string('nopermissions', 'error', 'completion_validate')
'message' => get_string('nopermissions', 'error', 'completion_validate'),
];
}
} else {
$result['warnings'][] = [
'item' => 'mod_bigbluebuttonbn',
'itemid' => $bigbluebuttonbnid,
'warningcode' => 'indexerrorbbtn',
'message' => get_string('index_error_bbtn', 'mod_bigbluebuttonbn', $bigbluebuttonbnid)
'message' => get_string('index_error_bbtn', 'mod_bigbluebuttonbn', $bigbluebuttonbnid),
];
}
// We might want to return a status here or some warnings.
Expand All @@ -108,7 +108,7 @@ public static function execute(
*/
public static function execute_returns(): external_single_structure {
return new external_single_structure([
'warnings' => new \external_warnings()
'warnings' => new \external_warnings(),
]
);
}
Expand Down
8 changes: 4 additions & 4 deletions classes/external/end_meeting.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public static function execute(
'item' => $instance->get_meeting_name(),
'itemid' => $instance->get_instance_id(),
'warningcode' => 'notFound',
'message' => $e->getMessage()
]
]
'message' => $e->getMessage(),
],
],
];
}
logger::log_meeting_ended_event($instance);
Expand All @@ -125,7 +125,7 @@ public static function execute(
*/
public static function execute_returns(): external_single_structure {
return new external_single_structure([
'warnings' => new \external_warnings()
'warnings' => new \external_warnings(),
]);
}
}
2 changes: 1 addition & 1 deletion classes/external/get_bigbluebuttonbns_by_courses.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static function execute($courseids = []) {

$result = [
'bigbluebuttonbns' => $returnedbigbluebuttonbns,
'warnings' => $warnings
'warnings' => $warnings,
];
return $result;
}
Expand Down
4 changes: 2 additions & 2 deletions classes/external/get_join_url.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static function execute(
'item' => 'mod_bigbluebuttonbn',
'itemid' => $instance->get_instance_id(),
'warningcode' => $e->errorcode,
'message' => $e->getMessage()
'message' => $e->getMessage(),
];
}
return $result;
Expand All @@ -109,7 +109,7 @@ public static function execute(
public static function execute_returns(): external_single_structure {
return new external_single_structure([
'join_url' => new external_value(PARAM_RAW, 'Can join session', VALUE_OPTIONAL),
'warnings' => new \external_warnings()
'warnings' => new \external_warnings(),
]);
}
}
6 changes: 3 additions & 3 deletions classes/external/get_recordings.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static function execute(
'item' => $bigbluebuttonbnid,
'warningcode' => 'nosuchinstance',
'message' => get_string('nosuchinstance', 'mod_bigbluebuttonbn',
(object) ['id' => $bigbluebuttonbnid, 'entity' => 'bigbluebuttonbn'])
(object) ['id' => $bigbluebuttonbnid, 'entity' => 'bigbluebuttonbn']),
];
} else {
$typeprofiles = bigbluebutton_proxy::get_instance_type_profiles();
Expand All @@ -122,7 +122,7 @@ public static function execute(
$returnval['warnings'][] = [
'item' => $bigbluebuttonbnid,
'warningcode' => 'instanceprofilewithoutrecordings',
'message' => get_string('instanceprofilewithoutrecordings', 'mod_bigbluebuttonbn')
'message' => get_string('instanceprofilewithoutrecordings', 'mod_bigbluebuttonbn'),
];
}
}
Expand Down Expand Up @@ -154,7 +154,7 @@ public static function execute_returns(): external_single_structure {
])),
'data' => new external_value(PARAM_RAW), // For now it will be json encoded.
], '', VALUE_OPTIONAL),
'warnings' => new external_warnings()
'warnings' => new external_warnings(),
]);
}
}
4 changes: 2 additions & 2 deletions classes/external/get_recordings_to_import.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static function execute(
'sourcebigbluebuttonbnid' => $sourcebigbluebuttonbnid,
'sourcecourseid' => $sourcecourseid,
'tools' => $tools,
'groupid' => $groupid
'groupid' => $groupid,
]);

$tools = explode(',', $tools ?? 'protect,unprotect,publish,unpublish,delete');
Expand Down Expand Up @@ -200,7 +200,7 @@ public static function execute_returns(): external_single_structure {
])),
'data' => new external_value(PARAM_RAW), // For now it will be json encoded.
], '', VALUE_OPTIONAL),
'warnings' => new external_warnings()
'warnings' => new external_warnings(),
]);
}
}
10 changes: 5 additions & 5 deletions classes/external/view_bigbluebuttonbn.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public static function execute($instanceid) {
'itemid' => 0,
'warningcode' => 'nosuchinstance',
'message' => get_string('nosuchinstance', 'mod_bigbluebuttonbn',
(object) ['id' => $instanceid, 'entity' => 'bigbluebuttonbn'])
]
]
(object) ['id' => $instanceid, 'entity' => 'bigbluebuttonbn']),
],
],
];
}
$context = context_module::instance($instance->get_cm_id());
Expand All @@ -94,7 +94,7 @@ public static function execute($instanceid) {
bigbluebuttonbn_view($instance->get_instance_data(), $instance->get_course(), $instance->get_cm(), $context);
return [
'status' => true,
'warnings' => []
'warnings' => [],
];
}

Expand All @@ -107,7 +107,7 @@ public static function execute($instanceid) {
public static function execute_returns() {
return new external_single_structure([
'status' => new external_value(PARAM_BOOL, 'status: true if success'),
'warnings' => new external_warnings()
'warnings' => new external_warnings(),
]
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function delete(recording $recording) {
// As the recordingid was not identified as imported recording link, execute delete on a real recording.
// Step 1, delete imported links associated to the recording.
$recordingstodelete = recording::get_records(['recordingid' => $recording->get('recordingid'),
'imported' => true]);
'imported' => true, ]);
foreach ($recordingstodelete as $rec) {
$rec->delete();
}
Expand Down
4 changes: 2 additions & 2 deletions classes/local/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class config {
const CHECKSUM_ALGORITHMS = [
self::DEFAULT_CHECKSUM_ALGORITHM,
'SHA256',
'SHA512'
'SHA512',
];

/**
Expand Down Expand Up @@ -117,7 +117,7 @@ protected static function defaultvalues() {
'lockonjoin_default' => true,
'lockonjoin_editable' => false,
'welcome_default' => '',
'checksum_algorithm' => self::DEFAULT_CHECKSUM_ALGORITHM
'checksum_algorithm' => self::DEFAULT_CHECKSUM_ALGORITHM,
];
}

Expand Down
2 changes: 1 addition & 1 deletion classes/local/helpers/mod_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected static function process_post_save_event(stdClass $bigbluebuttonbn): vo
$eventid = $DB->get_field('event', 'id', [
'modulename' => 'bigbluebuttonbn',
'instance' => $bigbluebuttonbn->id,
'eventtype' => logger::EVENT_MEETING_START
'eventtype' => logger::EVENT_MEETING_START,
]);

// Delete the event from calendar when/if openingtime is NOT set.
Expand Down
2 changes: 1 addition & 1 deletion classes/local/helpers/reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static function reset_events($courseid) {
public static function reset_getstatus(string $item): array {
return ['component' => get_string('modulenameplural', 'bigbluebuttonbn'),
'item' => get_string("removed{$item}", 'bigbluebuttonbn'),
'error' => false];
'error' => false, ];
}

/**
Expand Down
14 changes: 7 additions & 7 deletions classes/local/helpers/roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ public static function get_participant_data(context $context, ?stdClass $bbactiv
$data = [
'all' => [
'name' => get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn'),
'children' => []
'children' => [],
],
];
$data['role'] = [
'name' => get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn'),
'children' => self::get_roles_select($context, true)
'children' => self::get_roles_select($context, true),
];
$data['user'] = [
'name' => get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn'),
Expand Down Expand Up @@ -253,7 +253,7 @@ public static function get_participant_list(?stdClass $bigbluebuttonbn, context
* Returns an array to populate a list of participants used in mod_form.php with default values.
*
* @param context $context
* @param int $ownerid
* @param int|null $ownerid
*
* @return array
*/
Expand All @@ -271,14 +271,14 @@ protected static function get_participant_list_default(context $context, ?int $o
$participantlist[] = [
'selectiontype' => 'user',
'selectionid' => (string) $ownerid,
'role' => self::ROLE_MODERATOR];
'role' => self::ROLE_MODERATOR, ];
}
continue;
}
$participantlist[] = [
'selectiontype' => 'role',
'selectionid' => $defaultrule,
'role' => self::ROLE_MODERATOR];
'role' => self::ROLE_MODERATOR, ];
}
return $participantlist;
}
Expand Down Expand Up @@ -329,7 +329,7 @@ public static function get_participant_selection_data(): array {
*
* @param context $context
* @param array $participantlist
* @param int $userid
* @param int|null $userid
*
* @return bool
*/
Expand Down Expand Up @@ -420,7 +420,7 @@ public static function participant_joined(string $meetingid, bool $ismoderator):
$meetinginfo->moderatorCount += 1;
}
$cache->set($meetingid, ['creation_time' => $result['creation_time'],
'meeting_info' => json_encode($meetinginfo)]);
'meeting_info' => json_encode($meetinginfo), ]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/local/helpers/user_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class user_info {
*/
const EVENT_TO_WATCH = [
'join' => logger::EVENT_JOIN,
'play_recording' => logger::EVENT_PLAYED
'play_recording' => logger::EVENT_PLAYED,
];

/**
Expand Down
10 changes: 5 additions & 5 deletions classes/local/proxy/bigbluebutton_proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function get_join_url(
'fullName' => $username,
'password' => $pw,
'logoutURL' => $logouturl,
'role' => $role
'role' => $role,
];

if (!is_null($configtoken)) {
Expand Down Expand Up @@ -262,20 +262,20 @@ public static function get_instance_type_profiles(): array {
instance::TYPE_ALL => [
'id' => instance::TYPE_ALL,
'name' => get_string('instance_type_default', 'bigbluebuttonbn'),
'features' => ['all']
'features' => ['all'],
],
instance::TYPE_ROOM_ONLY => [
'id' => instance::TYPE_ROOM_ONLY,
'name' => get_string('instance_type_room_only', 'bigbluebuttonbn'),
'features' => ['showroom', 'welcomemessage', 'voicebridge', 'waitformoderator', 'userlimit',
'recording', 'sendnotifications', 'lock', 'preuploadpresentation', 'permissions', 'schedule', 'groups',
'modstandardelshdr', 'availabilityconditionsheader', 'tagshdr', 'competenciessection',
'completionattendance', 'completionengagement', 'availabilityconditionsheader']
'completionattendance', 'completionengagement', 'availabilityconditionsheader', ],
],
instance::TYPE_RECORDING_ONLY => [
'id' => instance::TYPE_RECORDING_ONLY,
'name' => get_string('instance_type_recording_only', 'bigbluebuttonbn'),
'features' => ['showrecordings', 'importrecordings', 'availabilityconditionsheader']
'features' => ['showrecordings', 'importrecordings', 'availabilityconditionsheader'],
],
];
return $instanceprofiles;
Expand Down Expand Up @@ -439,7 +439,7 @@ public static function create_meeting(
'meetingID' => (string) $xml->meetingID,
'internalMeetingID' => (string) $xml->internalMeetingID,
'attendeePW' => (string) $xml->attendeePW,
'moderatorPW' => (string) $xml->moderatorPW
'moderatorPW' => (string) $xml->moderatorPW,
];
}

Expand Down
2 changes: 1 addition & 1 deletion classes/local/proxy/curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function post($url, $params = '', $options = []) {
'Content-Type: ' . $this->get_content_type(),
'Content-Length: ' . strlen($params),
'Content-Language: en-US',
]
],
]);

return $this->handle_response(parent::post($url, $params, $options));
Expand Down
Loading
Loading