This commit is contained in:
Jun Pataleta 2024-03-08 08:00:41 +08:00
commit 3278ce7aba
No known key found for this signature in database
GPG key ID: F83510526D99E2C7
1147 changed files with 2621 additions and 2617 deletions

View file

@ -73,7 +73,7 @@ class backup_lti_activity_task extends backup_activity_task {
* @param string $content some HTML text that eventually contains URLs to the activity instance scripts
* @return string the content with the URLs encoded
*/
static public function encode_content_links($content) {
public static function encode_content_links($content) {
global $CFG;
$base = preg_quote($CFG->wwwroot, "/");

View file

@ -74,7 +74,7 @@ class restore_lti_activity_task extends restore_activity_task {
* Define the contents in the activity that must be
* processed by the link decoder
*/
static public function define_decode_contents() {
public static function define_decode_contents() {
$contents = array();
$contents[] = new restore_decode_content('lti', array('intro'), 'lti');
@ -86,7 +86,7 @@ class restore_lti_activity_task extends restore_activity_task {
* Define the decoding rules for links belonging
* to the activity to be executed by the link decoder
*/
static public function define_decode_rules() {
public static function define_decode_rules() {
$rules = array();
$rules[] = new restore_decode_rule('LTIVIEWBYID', '/mod/lti/view.php?id=$1', 'course_module');
@ -102,7 +102,7 @@ class restore_lti_activity_task extends restore_activity_task {
* basiclti logs. It must return one array
* of {@link restore_log_rule} objects
*/
static public function define_restore_log_rules() {
public static function define_restore_log_rules() {
$rules = array();
$rules[] = new restore_log_rule('lti', 'add', 'view.php?id={course_module}', '{lti}');
@ -122,7 +122,7 @@ class restore_lti_activity_task extends restore_activity_task {
* by the restore final task, but are defined here at
* activity level. All them are rules not linked to any module instance (cmid = 0)
*/
static public function define_restore_log_rules_for_course() {
public static function define_restore_log_rules_for_course() {
$rules = array();
$rules[] = new restore_log_rule('lti', 'view all', 'index.php?id={course}', null);

View file

@ -42,7 +42,7 @@ class cognitive_depth extends activity_base {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:cognitivedepth', 'mod_lti');
}

View file

@ -42,7 +42,7 @@ class social_breadth extends activity_base {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:socialbreadth', 'mod_lti');
}

View file

@ -443,7 +443,7 @@ class registration_helper {
*
* @return mixed Tool Proxy details
*/
public function get_tool_proxy(int $proxyid) : array {
public function get_tool_proxy(int $proxyid): array {
return lti_get_tool_proxy($proxyid);
}
}

View file

@ -207,7 +207,7 @@ abstract class resource_base {
*
* @param response $response Response object for this request.
*/
public abstract function execute($response);
abstract public function execute($response);
/**
* Check to make sure the request is valid.

View file

@ -51,7 +51,7 @@ class provider implements
* @param collection $items a reference to the collection to use to store the metadata.
* @return collection the updated collection of metadata items.
*/
public static function get_metadata(collection $items) : collection {
public static function get_metadata(collection $items): collection {
$items->add_external_location_link(
'lti_provider',
[
@ -114,7 +114,7 @@ class provider implements
* @param int $userid the userid.
* @return contextlist the list of contexts containing user info for the user.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
// Fetch all LTI submissions.
$sql = "SELECT c.id
FROM {context} c

View file

@ -179,7 +179,7 @@ class tool_types extends base {
"{$tablealias}.ltiversion"
))
->add_joins($this->get_joins())
->set_options_callback(static function() : array {
->set_options_callback(static function(): array {
return ['LTI-1p0' => 'Legacy LTI', '1.3.0' => "LTI Advantage"];
})
];

View file

@ -412,7 +412,7 @@ class mod_lti_edit_types_form extends moodleform {
* @param int $parentid
* @return array category tree
*/
public function lti_build_category_tree(array $elements, int $parentid = 0) : array {
public function lti_build_category_tree(array $elements, int $parentid = 0): array {
$branch = [];
foreach ($elements as $element) {

View file

@ -460,7 +460,7 @@ function lti_get_jwt_claim_mapping() {
* @return object|null
* @since Moodle 3.9
*/
function lti_get_instance_type(object $instance) : ?object {
function lti_get_instance_type(object $instance): ?object {
if (empty($instance->typeid)) {
if (!$tool = lti_get_tool_by_url_match($instance->toolurl, $instance->course)) {
$tool = lti_get_tool_by_url_match($instance->securetoolurl, $instance->course);
@ -1422,7 +1422,7 @@ function params_to_string(object $params) {
*
* @return stdClass Form config for the item
*/
function content_item_to_form(object $tool, object $typeconfig, object $item) : stdClass {
function content_item_to_form(object $tool, object $typeconfig, object $item): stdClass {
global $OUTPUT;
$config = new stdClass();
@ -2880,7 +2880,7 @@ function lti_update_type($type, $config) {
* @param string $lticoursecategories Comma separated list of course categories.
* @return void
*/
function lti_type_add_categories(int $typeid, string $lticoursecategories = '') : void {
function lti_type_add_categories(int $typeid, string $lticoursecategories = ''): void {
global $DB;
$coursecategories = explode(',', $lticoursecategories);
foreach ($coursecategories as $coursecategory) {

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->link_external_location('External LTI provider.', [
'userid' => 'privacy:metadata:userid',
'grade' => 'privacy:metadata:grade',
@ -64,7 +64,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
return new contextlist();
}

View file

@ -446,7 +446,7 @@ class gradebookservices extends service_base {
*/
public function add_standalone_lineitem(string $courseid, string $label, float $maximumscore,
string $baseurl, ?int $ltilinkid, ?string $resourceid, ?string $tag, int $typeid,
int $toolproxyid = null) : int {
int $toolproxyid = null): int {
global $DB;
$params = array();
$params['itemname'] = $label;
@ -728,7 +728,7 @@ class gradebookservices extends service_base {
*
*/
public static function update_coupled_gradebookservices(object $ltiinstance,
?string $resourceid, ?string $tag, ?\moodle_url $subreviewurl, ?string $subreviewparams) : void {
?string $resourceid, ?string $tag, ?\moodle_url $subreviewurl, ?string $subreviewparams): void {
global $DB;
if ($ltiinstance && $ltiinstance->typeid) {

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->link_external_location('External LTI provider.', [
'userid' => 'privacy:metadata:userid',
'grade' => 'privacy:metadata:grade',
@ -67,7 +67,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
return new contextlist();
}

View file

@ -288,7 +288,7 @@ class gradebookservices_test extends \advanced_testcase {
*/
private function assert_lineitems(object $course, int $typeid,
string $label, ?object $ltiinstance, ?string $resourceid, ?string $tag,
?string $subreviewurl = null, ?string $subreviewparams = null) : void {
?string $subreviewurl = null, ?string $subreviewparams = null): void {
$gbservice = new gradebookservices();
$gradeitems = $gbservice->get_lineitems($course->id, null, null, null, null, null, $typeid);
@ -347,7 +347,7 @@ class gradebookservices_test extends \advanced_testcase {
* @return object lti instance created
*/
private function create_graded_lti(int $typeid, object $course, ?string $resourceid, ?string $tag,
?string $subreviewurl = null, ?string $subreviewparams = null) : object {
?string $subreviewurl = null, ?string $subreviewparams = null): object {
$lti = ['course' => $course->id,
'typeid' => $typeid,
@ -369,7 +369,7 @@ class gradebookservices_test extends \advanced_testcase {
*
* @return object lti instance created
*/
private function create_notgraded_lti(int $typeid, object $course) : object {
private function create_notgraded_lti(int $typeid, object $course): object {
$lti = ['course' => $course->id,
'typeid' => $typeid,
@ -389,7 +389,7 @@ class gradebookservices_test extends \advanced_testcase {
*
*/
private function create_standalone_lineitem(int $courseid, int $typeid, ?string $resourceid,
?string $tag, int $ltiinstanceid = null) : void {
?string $tag, int $ltiinstanceid = null): void {
$gbservice = new gradebookservices();
$gbservice->add_standalone_lineitem($courseid,
"manualtest",

View file

@ -187,7 +187,7 @@ class lineitem_test extends \advanced_testcase {
* @return object lti instance created
*/
private function create_graded_lti(int $typeid, object $course, ?string $resourceid, ?string $tag,
?string $subreviewurl = null, ?string $subreviewparams = null) : object {
?string $subreviewurl = null, ?string $subreviewparams = null): object {
$lti = ['course' => $course->id,
'typeid' => $typeid,

View file

@ -49,7 +49,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->link_external_location('External LTI provider.', [
'userid' => 'privacy:metadata:userid',
'useridnumber' => 'privacy:metadata:useridnumber',
@ -68,7 +68,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
return new contextlist();
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -40,7 +40,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}

View file

@ -29,7 +29,7 @@ trait mod_lti_course_categories_trait {
*
* @return array
*/
public function setup_course_categories() : array {
public function setup_course_categories(): array {
global $DB;
$topcatdbrecord = $DB->get_record('course_categories', ['parent' => 0]);