Skip to content

Commit f604d42

Browse files
committed
Resolve CI warnings and errors
1 parent fb46885 commit f604d42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+85
-116
lines changed

backup/moodle2/backup_hvp_activity_task.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function define_my_steps() {
6868
* @param string $content some HTML text that eventually contains URLs to the activity instance scripts
6969
* @return string the content with the URLs encoded
7070
*/
71-
static public function encode_content_links($content) {
71+
public static function encode_content_links($content) {
7272
global $CFG;
7373

7474
$base = preg_quote($CFG->wwwroot, "/");

backup/moodle2/restore_hvp_activity_task.class.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function define_my_steps() {
5757
* Define the contents in the activity that must be
5858
* processed by the link decoder
5959
*/
60-
static public function define_decode_contents() {
60+
public static function define_decode_contents() {
6161
$contents = array();
6262

6363
$contents[] = new restore_decode_content('hvp', array('intro'), 'hvp');
@@ -69,7 +69,7 @@ static public function define_decode_contents() {
6969
* Define the decoding rules for links belonging
7070
* to the activity to be executed by the link decoder
7171
*/
72-
static public function define_decode_rules() {
72+
public static function define_decode_rules() {
7373
$rules = array();
7474

7575
$rules[] = new restore_decode_rule('HVPVIEWBYID', '/mod/hvp/view.php?id=$1', 'course_module');
@@ -85,7 +85,7 @@ static public function define_decode_rules() {
8585
* hvp logs. It must return one array
8686
* of {@link restore_log_rule} objects
8787
*/
88-
static public function define_restore_log_rules() {
88+
public static function define_restore_log_rules() {
8989
$rules = array();
9090

9191
$rules[] = new restore_log_rule('hvp', 'add', 'view.php?id={course_module}', '{hvp}');
@@ -105,7 +105,7 @@ static public function define_restore_log_rules() {
105105
* by the restore final task, but are defined here at
106106
* activity level. All them are rules not linked to any module instance (cmid = 0)
107107
*/
108-
static public function define_restore_log_rules_for_course() {
108+
public static function define_restore_log_rules_for_course() {
109109
$rules = array();
110110

111111
$rules[] = new restore_log_rule('hvp', 'view all', 'index.php?id={course}', null);

classes/admin_setting_html.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

17-
defined('MOODLE_INTERNAL') || die();
18-
1917
/**
2018
* No setting - just html
2119
* Note: since admin_setting is not namespaced, this can not be namespaced and put into a class
@@ -27,7 +25,8 @@ class admin_setting_html extends admin_setting {
2725
/**
2826
* not a setting, just html
2927
*
30-
* @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins.
28+
* @param string $name unique ascii name, either 'mysetting' for settings that in config,
29+
* or 'myplugin/mysetting' for ones in config_plugins.
3130
*/
3231
public function __construct($name, $translation, $hubinfo) {
3332
$this->nosave = true;
@@ -68,7 +67,7 @@ public function output_html($data, $query = '') {
6867
global $OUTPUT;
6968
$registrationurl = new moodle_url('/mod/hvp/content_hub_registration.php');
7069
if ($this->hubinfo === false) {
71-
$this->hubinfo = (object) [];
70+
$this->hubinfo = (object) [];
7271
}
7372
$this->hubinfo->register = get_string('contenthub:register', 'hvp', $registrationurl->out(false));
7473
$this->hubinfo->changesettings = get_string('contenthub:changesettings', 'hvp', $registrationurl->out(false));

classes/content_hub_service.php

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
use Exception;
1919
use moodle_url;
2020

21-
defined('MOODLE_INTERNAL') || die();
22-
2321
/**
2422
* Service for communicating with the content hub
2523
*

classes/content_user_data.php

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace mod_hvp;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Class content_user_data handles user data and corresponding db operations.
3230
*

classes/curl.php

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
use curl as moodlecurl;
2929

30-
defined('MOODLE_INTERNAL') || die();
31-
3230
/**
3331
* Override Moodle's curl class to provide proper PUT support.
3432
*

classes/event.php

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
*/
2525

2626
namespace mod_hvp;
27-
defined('MOODLE_INTERNAL') || die();
2827

2928
class event extends \H5PEventBase {
3029
private $user;

classes/event/attempt_submitted.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,14 @@
2424

2525
namespace mod_hvp\event;
2626

27-
defined('MOODLE_INTERNAL') || die();
28-
2927
/**
3028
* The mod_hvp instance list viewed event class.
3129
*
3230
* @package mod_hvp
3331
* @copyright @copyright 2016 Joubel AS <[email protected]>
3432
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3533
*/
36-
class attempt_submitted extends \core\event\base
37-
{
34+
class attempt_submitted extends \core\event\base {
3835

3936
/**
4037
* @inheritDoc

classes/event/course_module_instance_list_viewed.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@
2424

2525
namespace mod_hvp\event;
2626

27-
defined('MOODLE_INTERNAL') || die();
28-
2927
/**
3028
* The mod_hvp instance list viewed event class.
3129
*
3230
* @package mod_hvp
3331
* @copyright @copyright 2016 Joubel AS <[email protected]>
3432
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3533
*/
36-
class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed
37-
{
34+
class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
3835
// No code required here as the parent class handles it all.
3936
}

classes/event/course_module_viewed.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,14 @@
2424

2525
namespace mod_hvp\event;
2626

27-
defined('MOODLE_INTERNAL') || die();
28-
2927
/**
3028
* The mod_hvp course module viewed event class.
3129
*
3230
* @package mod_hvp
3331
* @copyright @copyright 2016 Joubel AS <[email protected]>
3432
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3533
*/
36-
class course_module_viewed extends \core\event\course_module_viewed
37-
{
34+
class course_module_viewed extends \core\event\course_module_viewed {
3835

3936
/**
4037
* Set basic properties for the event.

classes/external/log_drain.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ public static function execute($logs) {
6060
global $USER;
6161

6262
// Just dump this directly to error_log.
63-
foreach($logs as $log) {
63+
foreach ($logs as $log) {
6464
$log = (object) $log;
65-
error_log("mod_hvp mobile javascript log: User: " . $USER->id . " Context: " . $log->contextId . ' at: ' . $log->at . " : " . $log->message);
65+
debugging("mod_hvp mobile javascript log: User: " . $USER->id . " Context: " . $log->contextId . ' at: ' . $log->at .
66+
" : " . $log->message);
6667
}
6768

6869
return ['success' => true];

classes/file_storage.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ public function saveFile($file, $contentid, $contextid = null) {
409409

410410
if (!has_capability('moodle/course:ignorefilesizelimits', $context)) {
411411
if ($uploadedfile['size'] > $maxsize) {
412-
\H5PCore::ajaxError(get_string('maxbytesfile', 'error', ['file' => $filename, 'size' => display_size($maxsize)]));
412+
\H5PCore::ajaxError(get_string('maxbytesfile', 'error',
413+
['file' => $filename, 'size' => display_size($maxsize)]));
413414
return;
414415
}
415416
}
@@ -543,7 +544,7 @@ private static function readFileTree($source, $options, $archive = null, $relati
543544
// Create an empty zip to store a full lib archive as well.
544545
if (empty($archive) && $exportzip) {
545546
$archive = new \ZipArchive();
546-
$path = tempnam(get_request_storage_directory(),'libdir');
547+
$path = tempnam(get_request_storage_directory(), 'libdir');
547548
$archive->open($path, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
548549
// Set recursion flag.
549550
$top = true;
@@ -643,7 +644,7 @@ private static function exportFileTree($target, $contextid, $filearea, $filepath
643644
$filepath,
644645
'lib-export.zip'
645646
)) {
646-
// Libraries may have a precompiled zip to extract
647+
// Libraries may have a precompiled zip to extract.
647648
$reqpath = get_request_storage_directory() . '/libzip.zip';
648649
$file->copy_content_to($reqpath);
649650

@@ -1004,7 +1005,7 @@ public function saveFileFromZip($path, $file, $stream) {
10041005
return file_put_contents($filepath, $stream);
10051006
}
10061007

1007-
// @codingStandardIgnoreLine
1008+
// @codingStandardsIgnoreLine
10081009
public function deleteLibrary($library) {
10091010
// TODO: Implement deleteLibrary() method.
10101011
}

classes/framework.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,8 @@ public function updateContent($content, $contentmainid = null) {
11521152
'mobilerendermethod' => $content['mobilerendermethod'] ?? mobile::RENDER_METHOD_UNSET,
11531153
));
11541154

1155-
if (isset($content[ 'completionpass'])) {
1156-
$data[ 'completionpass' ] = $content[ 'completionpass' ];
1155+
if (isset($content['completionpass'])) {
1156+
$data['completionpass'] = $content['completionpass'];
11571157
}
11581158

11591159
if (!isset($content['id'])) {

classes/local/bundled_mobile_handler.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function handle(): array {
121121
'selectors' => [
122122
'iframe' => 'hvp-mobile-iframe-' . $uniqueid,
123123
'gradesyncnotification' => 'hvp-grade-sync-notification-' . $uniqueid,
124-
'loadingnotification' => 'hvp-loading-notification-' . $uniqueid,
124+
'loadingnotification' => 'hvp-loading-notification-' . $uniqueid,
125125
]
126126
];
127127
$js .= 'window.' . js_writer::set_variable('hvp', $jsdata, false);
@@ -280,14 +280,14 @@ public function get_view_css(view_assets $view): string {
280280
*/
281281
private function ensure_h5p_core_fonts_stored() {
282282
global $CFG;
283-
283+
284284
$corefonts = [
285285
'h5p-core-28.ttf',
286286
];
287287

288288
$fs = get_file_storage();
289289

290-
foreach($corefonts as $font) {
290+
foreach ($corefonts as $font) {
291291
$record = (object) [
292292
'contextid' => context_system::instance()->id,
293293
'component' => 'mod_hvp',
@@ -477,9 +477,9 @@ public function extract_fontfiles_from_css($css) {
477477
// ../libraries/H5p.FontIcons/fonts/h5p.ttf.
478478

479479
$split = explode('/', $fonturl);
480-
foreach($split as $i => $val) {
480+
foreach ($split as $i => $val) {
481481
if ($val == '..' && $i != 0) {
482-
// Empty previous (dont remove to keep indexing the same)
482+
// Empty previous (dont remove to keep indexing the same).
483483
$split[$i - 1] = '';
484484
}
485485
}

classes/mobile_auth.php

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
namespace mod_hvp;
2626

27-
defined('MOODLE_INTERNAL') || die();
28-
2927
class mobile_auth {
3028

3129
const VALID_TIME = 60;

classes/output/mobile.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private static function handle($cm): array {
7070
$method = (int) $DB->get_field('hvp', 'mobilerendermethod', ['id' => $cm->instance]);;
7171

7272
// Unset, use site config to pick one.
73-
if($method == self::RENDER_METHOD_UNSET) {
73+
if ($method == self::RENDER_METHOD_UNSET) {
7474
$method = self::get_site_default_handler();
7575
}
7676

classes/privacy/provider.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
use \core_privacy\local\request\userlist;
2929
use \core_privacy\local\metadata\collection;
3030

31-
defined('MOODLE_INTERNAL') || die();
32-
3331
/**
3432
* Privacy Subsystem implementation for H5P.
3533
*/
@@ -49,7 +47,7 @@ class provider implements
4947
*
5048
* @return collection The array of metadata
5149
*/
52-
public static function _get_metadata(collection $items) {
50+
public static function get_metadata(collection $items): collection {
5351
// Stores files using the Moodle file api.
5452
$items->add_subsystem_link(
5553
'core_files',
@@ -117,7 +115,7 @@ public static function _get_metadata(collection $items) {
117115
*
118116
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
119117
*/
120-
public static function _get_contexts_for_userid($userid) {
118+
public static function get_contexts_for_userid($userid): contextlist {
121119
$contextlist = new contextlist();
122120

123121
// Context for content_user_data.
@@ -176,7 +174,7 @@ public static function _get_contexts_for_userid($userid) {
176174
*
177175
* @param approved_contextlist $contextlist The approved contexts to export information for.
178176
*/
179-
public static function _export_user_data(approved_contextlist $contextlist) {
177+
public static function export_user_data(approved_contextlist $contextlist) {
180178
global $DB;
181179

182180
if (!count($contextlist)) {
@@ -379,7 +377,7 @@ protected static function get_exportable_events($userid) {
379377
*
380378
* @param \context $context The specific context to delete data for.
381379
*/
382-
public static function _delete_data_for_all_users_in_context(\context $context) {
380+
public static function delete_data_for_all_users_in_context(\context $context) {
383381
global $DB;
384382

385383
if ($context->contextlevel == CONTEXT_USER) {
@@ -411,7 +409,7 @@ public static function _delete_data_for_all_users_in_context(\context $context)
411409
*
412410
* @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
413411
*/
414-
public static function _delete_data_for_user(approved_contextlist $contextlist) {
412+
public static function delete_data_for_user(approved_contextlist $contextlist) {
415413
global $DB;
416414

417415
$count = $contextlist->count();

classes/results.php

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424

2525
namespace mod_hvp;
26-
defined('MOODLE_INTERNAL') || die();
2726

2827
/**
2928
* The mod_hvp file storage class.

classes/task/look_for_updates.php

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
namespace mod_hvp\task;
2525

26-
defined('MOODLE_INTERNAL') || die();
27-
2826
/**
2927
* The mod_hvp look for updates task class
3028
*

classes/task/remove_old_auth_tokens.php

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
use mod_hvp\mobile_auth;
2828

29-
defined('MOODLE_INTERNAL') || die();
30-
3129
/**
3230
* The mod_hvp remove old auth tokens class
3331
*

classes/task/remove_old_log_entries.php

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
namespace mod_hvp\task;
2525

26-
defined('MOODLE_INTERNAL') || die();
27-
2826
/**
2927
* The mod_hvp look for updates task class
3028
*

classes/task/remove_tmpfiles.php

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
namespace mod_hvp\task;
2525

26-
defined('MOODLE_INTERNAL') || die();
27-
2826
/**
2927
* The mod_hvp look for updates task class
3028
*

0 commit comments

Comments
 (0)