@@ -412,12 +412,9 @@ protected function replace_arguments(string $text): string {
412412 preg_match_all ("/ \\$ \\{([^:}]+):([^}]+) \\}/ " , $ text , $ matches );
413413
414414 foreach ($ matches [0 ] as $ index => $ match ) {
415- switch ($ matches [2 ][$ index ]) {
416- case 'cmid ' :
417- $ coursemodule = $ DB ->get_record ('course_modules ' , ['idnumber ' => $ matches [1 ][$ index ]]);
418- $ text = str_replace ($ match , $ coursemodule ->id , $ text );
419-
420- break ;
415+ if ($ matches [2 ][$ index ] == 'cmid ' ) {
416+ $ coursemodule = $ DB ->get_record ('course_modules ' , ['idnumber ' => $ matches [1 ][$ index ]]);
417+ $ text = str_replace ($ match , $ coursemodule ->id , $ text );
421418 }
422419 }
423420
@@ -550,7 +547,7 @@ protected function handle_url(string $customurl, string $successXPath = '') {
550547 if (!empty ($ successXPath )) {
551548 // Wait until the page appears.
552549 $ this ->spin (
553- function ($ context, $ args ) use ($ successXPath ) {
550+ function ($ context ) use ($ successXPath ) {
554551 $ found = $ context ->getSession ()->getPage ()->find ('xpath ' , $ successXPath );
555552 if ($ found ) {
556553 return true ;
@@ -597,7 +594,6 @@ protected function get_cm_by_activity_name_and_course(string $activity, string $
597594 $ cmfrom = $ cmtable ->get_from_sql ();
598595
599596 $ acttable = new \core \dml \table ($ activity , 'a ' , 'a ' );
600- $ actselect = $ acttable ->get_field_select ();
601597 $ actfrom = $ acttable ->get_from_sql ();
602598
603599 $ sql = <<<EOF
@@ -662,7 +658,7 @@ protected function get_first_restricted_version_tag(): ?string {
662658 // Set up relevant tags for each version.
663659 $ usedtags = array_keys ($ usedtags );
664660 foreach ($ usedtags as $ usedtag ) {
665- if (!preg_match ('~^lms_(from|upto)([0-9] +(?:\.[0-9] +)*)$~ ' , $ usedtag , $ matches )) {
661+ if (!preg_match ('~^lms_(from|upto)(\d +(?:\.\d +)*)$~ ' , $ usedtag , $ matches )) {
666662 // No match, ignore.
667663 continue ;
668664 }
0 commit comments