Skip to content

Commit ec004ce

Browse files
committed
Fix CI errors
1 parent 8f5ea6e commit ec004ce

File tree

5 files changed

+53
-26
lines changed

5 files changed

+53
-26
lines changed

classes/api.php

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ class api {
8080
* @return array Messages to be displayed (related to the migration process).
8181
* @throws moodle_exception if something happens during the migration
8282
*/
83-
public static function migrate_hvp2h5p(int $hvpid, int $keeporiginal = self::KEEPORIGINAL,
84-
int $copy2cb = self::COPY2CBYESWITHLINK): array {
83+
public static function migrate_hvp2h5p(
84+
int $hvpid,
85+
int $keeporiginal = self::KEEPORIGINAL,
86+
int $copy2cb = self::COPY2CBYESWITHLINK
87+
): array {
8588
global $DB;
8689

8790
self::check_requirements($copy2cb);
@@ -126,12 +129,12 @@ public static function migrate_hvp2h5p(int $hvpid, int $keeporiginal = self::KEE
126129
$tmpkeeporiginal = self::HIDEORIGINAL;
127130
$messages[] = [
128131
get_string('migrate_gradesoverridden_notdelete', 'tool_migratehvp2h5p', $params),
129-
notification::NOTIFY_WARNING
132+
notification::NOTIFY_WARNING,
130133
];
131134
} else {
132135
$messages[] = [
133136
get_string('migrate_gradesoverridden', 'tool_migratehvp2h5p', $params),
134-
notification::NOTIFY_WARNING
137+
notification::NOTIFY_WARNING,
135138
];
136139
}
137140
}
@@ -183,13 +186,17 @@ public static function check_requirements(int $copy2cb) {
183186
* the CLI migrate.php command. The SQL is quite complex so having it in one place
184187
* is a good idea.
185188
*
186-
* @param bool $count when true, returns the count SQL.
187-
* @param string $sort sorting criteria.
188-
* @param array $libraryids List of the library ids for the mod_hvp contents to migrate. Only contents with these
189+
* @param bool $count when true, returns the count SQL.
190+
* @param string|null $sort sorting criteria.
191+
* @param array|null $libraryids List of the library ids for the mod_hvp contents to migrate. Only contents with these
189192
* main libraries will be returned.
190193
* @return array containing sql to use and an array of params.
191194
*/
192-
public static function get_sql_hvp_to_migrate(bool $count = false, ?string $sort = null, ?array $libraryids = null): array {
195+
public static function get_sql_hvp_to_migrate(
196+
bool $count = false,
197+
?string $sort = null,
198+
?array $libraryids = null
199+
): array {
193200

194201
self::fix_duplicated_hvp();
195202

@@ -292,12 +299,16 @@ private static function fix_duplicated_hvp(): void {
292299
/**
293300
* Create an h5pactivity copying information from the existing $hvp activity.
294301
*
295-
* @param stdClass $hvp The mod_hvp activity to be migrated from.
296-
* @param stdClass $hvpgradeitem This information is required to update the h5pactivity grading information.
297-
* @param int $copy2cb Whether H5P files should be added to the content bank or not.
302+
* @param stdClass $hvp The mod_hvp activity to be migrated from.
303+
* @param stdClass $hvpgradeitem This information is required to update the h5pactivity grading information.
304+
* @param int $copy2cb Whether H5P files should be added to the content bank or not.
298305
* @return stdClass|null The new h5pactivity created from the $hvp activity.
299306
*/
300-
private static function create_mod_h5pactivity(stdClass $hvp, stdClass $hvpgradeitem, int $copy2cb): ?stdClass {
307+
private static function create_mod_h5pactivity(
308+
stdClass $hvp,
309+
stdClass $hvpgradeitem,
310+
int $copy2cb
311+
): ?stdClass {
301312
global $CFG, $DB;
302313

303314
require_once($CFG->dirroot . '/mod/h5pactivity/lib.php');
@@ -368,7 +379,7 @@ private static function create_mod_h5pactivity(stdClass $hvp, stdClass $hvpgrade
368379
* @param stdClass $hvpcm the hvp course_module
369380
* @param stdClass $h5pactivity the new activity object
370381
*/
371-
private static function copy_tags($hvpcm, $h5pactivity): void {
382+
private static function copy_tags(stdClass $hvpcm, stdClass $h5pactivity): void {
372383
$tags = core_tag_tag::get_item_tags_array('core', 'course_modules', $hvpcm->id);
373384
$h5pcontext = context_module::instance($h5pactivity->coursemodule);
374385
core_tag_tag::set_item_tags('core', 'course_modules', $h5pactivity->coursemodule, $h5pcontext, $tags);
@@ -478,7 +489,7 @@ public static function get_hvp_author(stdClass $hvp): string {
478489
* @param stdClass $hvpcm the hvp course_module
479490
* @param stdClass $h5pactivity the new activity object
480491
*/
481-
private static function copy_completion($hvpcm, $h5pactivity): void {
492+
private static function copy_completion(stdClass $hvpcm, stdClass $h5pactivity): void {
482493
$course = get_course($hvpcm->course);
483494
$completion = new completion_info($course);
484495
if ($completion->is_enabled($hvpcm)) {
@@ -662,7 +673,7 @@ private static function duplicate_course_module(stdClass $cm, int $moduleid): st
662673
* Add the course module to the course section.
663674
*
664675
* @param stdClass $hvpcm
665-
* @param int $h5pcmid
676+
* @param int $h5pcmid
666677
* @return stdClass|null The course module object for the h5pactivity.
667678
*/
668679
private static function add_course_module_to_section(stdClass $hvpcm, int $h5pcmid): ?stdClass {
@@ -693,7 +704,11 @@ private static function add_course_module_to_section(stdClass $hvpcm, int $h5pcm
693704
* @param stdClass $h5pactivity mod_h5p object
694705
* @return int total of files copied.
695706
*/
696-
private static function copy_area_files(stdClass $hvp, stdClass $hvpcm, stdClass $h5pactivity): int {
707+
private static function copy_area_files(
708+
stdClass $hvp,
709+
stdClass $hvpcm,
710+
stdClass $h5pactivity
711+
): int {
697712
$count = 0;
698713

699714
$hvpcontext = context_module::instance($hvpcm->id);

classes/event/hvp_migrated.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ protected function validate_data() {
124124
*/
125125
public static function get_other_mapping() {
126126
$othermapped = [
127-
'h5pactivityid' => ['db' => 'h5pactivity', 'restore' => 'h5pactivity']
127+
'h5pactivityid' => [
128+
'db' => 'h5pactivity',
129+
'restore' => 'h5pactivity',
130+
],
128131
];
129132

130133
return $othermapped;

classes/output/hvpactivities_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected function define_table_configs() {
116116
* @throws \moodle_exception
117117
* @throws \coding_exception
118118
*/
119-
public function col_select(stdClass $data):string {
119+
public function col_select(stdClass $data): string {
120120
global $OUTPUT;
121121

122122
$stringdata = [

classes/output/listnotmigrated.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,35 @@ public function export_for_template(renderer_base $output): stdClass {
6666
'name' => 'keeporiginal',
6767
'label' => get_string('keeporiginal', 'tool_migratehvp2h5p'),
6868
'options' => [
69-
['value' => api::HIDEORIGINAL, 'text' => get_string('keeporiginal_hide', 'tool_migratehvp2h5p')],
70-
['value' => api::DELETEORIGINAL, 'text' => get_string('keeporiginal_delete', 'tool_migratehvp2h5p')],
71-
['value' => api::KEEPORIGINAL, 'text' => get_string('keeporiginal_nothing', 'tool_migratehvp2h5p')],
72-
]
69+
[
70+
'value' => api::HIDEORIGINAL,
71+
'text' => get_string('keeporiginal_hide', 'tool_migratehvp2h5p'),
72+
],
73+
[
74+
'value' => api::DELETEORIGINAL,
75+
'text' => get_string('keeporiginal_delete', 'tool_migratehvp2h5p'),
76+
],
77+
[
78+
'value' => api::KEEPORIGINAL,
79+
'text' => get_string('keeporiginal_nothing', 'tool_migratehvp2h5p'),
80+
],
81+
],
7382
],
7483
[
7584
'name' => 'copy2cb',
7685
'label' => get_string('copy2cb', 'tool_migratehvp2h5p'),
7786
'options' => [
7887
[
7988
'value' => api::COPY2CBYESWITHLINK,
80-
'text' => get_string('copy2cb_yeswithlink', 'tool_migratehvp2h5p')
89+
'text' => get_string('copy2cb_yeswithlink', 'tool_migratehvp2h5p'),
8190
],
8291
[
8392
'value' => api::COPY2CBYESWITHOUTLINK,
84-
'text' => get_string('copy2cb_yeswithoutlink', 'tool_migratehvp2h5p')
93+
'text' => get_string('copy2cb_yeswithoutlink', 'tool_migratehvp2h5p'),
8594
],
8695
[
8796
'value' => api::COPY2CBNO,
88-
'text' => get_string('copy2cb_no', 'tool_migratehvp2h5p')
97+
'text' => get_string('copy2cb_no', 'tool_migratehvp2h5p'),
8998
],
9099
],
91100
],

classes/privacy/provider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
3838
*
3939
* @return string
4040
*/
41-
public static function get_reason() : string {
41+
public static function get_reason(): string {
4242
return 'privacy:metadata';
4343
}
4444
}

0 commit comments

Comments
 (0)