learningworks/moodle-block_lw_courses

View on GitHub

Showing 169 of 169 total issues

Missing class import via use statement (line '45', column '33').
Open

$PAGE->requires->js(new moodle_url($CFG->wwwroot.'/blocks/lw_courses/js/custom.js'));
Severity: Minor
Found in renderer.php by phpmd

Missing class import via use statement (line '61', column '30').
Open

$this->content = new stdClass();
Severity: Minor
Found in block_lw_courses.php by phpmd

Missing class import via use statement (line '258', column '20').
Open

$url = new moodle_url("/pluginfile.php/{$filecontextid}/{$filecomponent}/{$filearea}/{$filepath}/{$filename}");
Severity: Minor
Found in locallib.php by phpmd

Avoid assigning values to variables in if clauses and the like (line '95', column '9').
Open

function block_lw_courses_get_myorder() {
if ($value = get_user_preferences('lw_courses_course_sortorder')) {
return explode(',', $value);
}
// If preference was not found, look in the old location and convert if found.
Severity: Minor
Found in locallib.php by phpmd

Avoid unused local variables such as '$id'.
Open

foreach ($remotecourses as $id => $val) {
Severity: Minor
Found in locallib.php by phpmd

Avoid unused parameters such as '$course'.
Open

function block_lw_courses_pluginfile($course, $birecord, $context, $filearea, $args, $forcedownload, array $options = array()) {
Severity: Minor
Found in lib.php by phpmd

Avoid assigning values to variables in if clauses and the like (line '124', column '9').
Open

function block_lw_courses_get_child_shortnames($courseid) {
global $DB;
$ctxselect = context_helper::get_preload_record_columns_sql('ctx');
$sql = "SELECT c.id, c.shortname, $ctxselect
FROM {enrol} e
Severity: Minor
Found in locallib.php by phpmd

Avoid unused parameters such as '$options'.
Open

function block_lw_courses_pluginfile($course, $birecord, $context, $filearea, $args, $forcedownload, array $options = array()) {
Severity: Minor
Found in lib.php by phpmd

Avoid unused local variables such as '$key'.
Open

foreach ($order as $key => $cid) {
Severity: Minor
Found in locallib.php by phpmd

Avoid unused local variables such as '$listonly'.
Open

$listonly = false;
Severity: Minor
Found in renderer.php by phpmd

Avoid assigning values to variables in if clauses and the like (line '44', column '10').
Open

function block_lw_courses_pluginfile($course, $birecord, $context, $filearea, $args, $forcedownload, array $options = array()) {
$fs = get_file_storage();
 
$filename = array_pop($args);
$filepath = $args ? '/'.implode('/', $args).'/' : '/';
Severity: Minor
Found in lib.php by phpmd

Avoid assigning values to variables in if clauses and the like (line '100', column '9').
Open

function block_lw_courses_get_myorder() {
if ($value = get_user_preferences('lw_courses_course_sortorder')) {
return explode(',', $value);
}
// If preference was not found, look in the old location and convert if found.
Severity: Minor
Found in locallib.php by phpmd

Avoid assigning values to variables in if clauses and the like (line '499', column '13').
Open

public function course_image_defaults() {
 
$config = get_config('block_lw_courses');
 
if (method_exists($this->output, 'image_url')) {
Severity: Minor
Found in renderer.php by phpmd

The function block_lw_courses_get_sorted_courses() has an NPath complexity of 882. The configured NPath complexity threshold is 200.
Open

function block_lw_courses_get_sorted_courses($showallcourses = false) {
global $USER;
 
$limit = block_lw_courses_get_max_user_courses($showallcourses);
 
 
Severity: Minor
Found in locallib.php by phpmd

The method lw_courses() has an NPath complexity of 14930208. The configured NPath complexity threshold is 200.
Open

public function lw_courses($courses) {
global $CFG, $PAGE, $DB, $OUTPUT;
$html = '';
// LearningWorks.
$PAGE->requires->js(new moodle_url($CFG->wwwroot.'/blocks/lw_courses/js/custom.js'));
Severity: Minor
Found in renderer.php by phpmd

Avoid unused parameters such as '$birecord'.
Open

function block_lw_courses_pluginfile($course, $birecord, $context, $filearea, $args, $forcedownload, array $options = array()) {
Severity: Minor
Found in lib.php by phpmd

Avoid unused parameters such as '$filearea'.
Open

function block_lw_courses_pluginfile($course, $birecord, $context, $filearea, $args, $forcedownload, array $options = array()) {
Severity: Minor
Found in lib.php by phpmd

Avoid assigning values to variables in if clauses and the like (line '48', column '9').
Open

function block_lw_courses_get_overviews($courses) {
$htmlarray = array();
if ($modules = get_plugin_list_with_function('mod', 'print_overview')) {
// Split courses list into batches with no more than MAX_MODINFO_CACHE_SIZE courses in one batch.
// Otherwise we exceed the cache limit in get_fast_modinfo() and rebuild it too often.
Severity: Minor
Found in locallib.php by phpmd

Avoid assigning values to variables in if clauses and the like (line '193', column '21').
Open

public function lw_courses($courses) {
global $CFG, $PAGE, $DB, $OUTPUT;
$html = '';
// LearningWorks.
$PAGE->requires->js(new moodle_url($CFG->wwwroot.'/blocks/lw_courses/js/custom.js'));
Severity: Minor
Found in renderer.php by phpmd

The function block_lw_courses_get_sorted_courses() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
Open

function block_lw_courses_get_sorted_courses($showallcourses = false) {
global $USER;
 
$limit = block_lw_courses_get_max_user_courses($showallcourses);
 
 
Severity: Minor
Found in locallib.php by phpmd
Severity
Category
Status
Source
Language