infection #1
Annotations
11 warnings
infection (main, 8.3, pgsql)
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L111
Escaped Mutant for Mutator "ArrayItemRemoval":
@@ @@
$i = 1;
foreach ($items as $item) {
$name = $formatter->format_string(get_course($item)->fullname, context: context_course::instance($item));
- $data[] = ['first' => $i === 1, 'course' => $item == $instance->courseid, 'title' => $name, 'href' => new moodle_url('/course/view.php', ['id' => $item]), 'seqnumber' => $i];
+ $data[] = ['course' => $item == $instance->courseid, 'title' => $name, 'href' => new moodle_url('/course/view.php', ['id' => $item]), 'seqnumber' => $i];
$i++;
}
}
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L112
Escaped Mutant for Mutator "IncrementInteger":
@@ @@
$i = 1;
foreach ($items as $item) {
$name = $formatter->format_string(get_course($item)->fullname, context: context_course::instance($item));
- $data[] = ['first' => $i === 1, 'course' => $item == $instance->courseid, 'title' => $name, 'href' => new moodle_url('/course/view.php', ['id' => $item]), 'seqnumber' => $i];
+ $data[] = ['first' => $i === 2, 'course' => $item == $instance->courseid, 'title' => $name, 'href' => new moodle_url('/course/view.php', ['id' => $item]), 'seqnumber' => $i];
$i++;
}
}
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L112
Escaped Mutant for Mutator "Identical":
@@ @@
$i = 1;
foreach ($items as $item) {
$name = $formatter->format_string(get_course($item)->fullname, context: context_course::instance($item));
- $data[] = ['first' => $i === 1, 'course' => $item == $instance->courseid, 'title' => $name, 'href' => new moodle_url('/course/view.php', ['id' => $item]), 'seqnumber' => $i];
+ $data[] = ['first' => $i !== 1, 'course' => $item == $instance->courseid, 'title' => $name, 'href' => new moodle_url('/course/view.php', ['id' => $item]), 'seqnumber' => $i];
$i++;
}
}
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L128
Escaped Mutant for Mutator "ArrayItemRemoval":
@@ @@
}
}
$name = $formatter->format_string(get_course($instance->customint1)->fullname, context: context_course::instance($instance->customint1));
- $rdata = ['coursetitle' => $name, 'courseurl' => new moodle_url('/course/view.php', ['id' => $instance->customint1]), 'hasdata' => count($data) >= 2, 'items' => $data];
+ $rdata = ['coursetitle' => $name, 'courseurl' => new moodle_url('/course/view.php', []), 'hasdata' => count($data) >= 2, 'items' => $data];
$str = $OUTPUT->render_from_template('enrol_coursecompleted/learnpath', $rdata);
return $OUTPUT->box($str);
}
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L129
Escaped Mutant for Mutator "GreaterThanOrEqualTo":
@@ @@
}
}
$name = $formatter->format_string(get_course($instance->customint1)->fullname, context: context_course::instance($instance->customint1));
- $rdata = ['coursetitle' => $name, 'courseurl' => new moodle_url('/course/view.php', ['id' => $instance->customint1]), 'hasdata' => count($data) >= 2, 'items' => $data];
+ $rdata = ['coursetitle' => $name, 'courseurl' => new moodle_url('/course/view.php', ['id' => $instance->customint1]), 'hasdata' => count($data) > 2, 'items' => $data];
$str = $OUTPUT->render_from_template('enrol_coursecompleted/learnpath', $rdata);
return $OUTPUT->box($str);
}
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L171
Escaped Mutant for Mutator "ArrayItemRemoval":
@@ @@
$icons = [];
if (has_capability('enrol/coursecompleted:enrolpast', $context)) {
$managelink = new moodle_url('/enrol/coursecompleted/manage.php', ['enrolid' => $instance->id]);
- $icon = new pix_icon('t/enrolusers', get_string('enrolusers', 'enrol_manual'), 'core', ['class' => 'iconsmall']);
+ $icon = new pix_icon('t/enrolusers', get_string('enrolusers', 'enrol_manual'), 'core', []);
$icons[] = $OUTPUT->action_icon($managelink, $icon);
}
return array_merge(parent::get_action_icons($instance), $icons);
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L190
Escaped Mutant for Mutator "ArrayItemRemoval":
@@ @@
if ($step->get_task()->get_target() == backup::TARGET_NEW_COURSE) {
$merge = false;
} else {
- $merge = ['courseid' => $course->id, 'enrol' => 'coursecompleted', 'roleid' => $data->roleid, 'customint1' => $data->customint1];
+ $merge = ['enrol' => 'coursecompleted', 'roleid' => $data->roleid, 'customint1' => $data->customint1];
}
if ($merge && $instances = $DB->get_records('enrol', $merge, 'id')) {
$instance = reset($instances);
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L203
Escaped Mutant for Mutator "MethodCallRemoval":
@@ @@
} else {
$instanceid = $this->add_instance($course, (array) $data);
}
- $step->set_mapping('enrol', $oldid, $instanceid);
+
}
/**
* Enrol user into course via enrol instance.
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L361
Escaped Mutant for Mutator "IfNegation":
@@ @@
$mform->setDefault('status', $this->get_config('status'));
$role = $this->get_config('roleid');
$start = time();
- if ($instance) {
+ if (!$instance) {
if (isset($instance->roleid)) {
$role = $instance->roleid;
}
|
infection (main, 8.3, pgsql):
moodle/enrol/coursecompleted/classes/plugin.php#L377
Escaped Mutant for Mutator "TrueValue":
@@ @@
$arr = ['optional' => true, 'defaulttime' => $start];
$mform->addElement('date_time_selector', 'customint4', get_string('enroldate', $plugin), $arr);
$mform->addHelpButton('customint4', 'enroldate', $plugin);
- $arr = ['optional' => true, 'defaultunit' => 86400];
+ $arr = ['optional' => false, 'defaultunit' => 86400];
$mform->addElement('duration', 'enrolperiod', get_string('enrolperiod', $plugin), $arr);
$mform->setDefault('enrolperiod', $this->get_config('enrolperiod'));
$mform->addHelpButton('enrolperiod', 'enrolperiod', $plugin);
|