@@ -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 );
0 commit comments