From 97b118593d774fa6dc614063a0357faa558a5472 Mon Sep 17 00:00:00 2001 From: Matthew Hilton Date: Mon, 5 Aug 2024 15:22:03 +1000 Subject: [PATCH] cleanup: fixup to match coding standards --- bootstrap.php | 1 + classes/calendar/calendar.php | 9 -------- classes/dml/outagedb.php | 12 ----------- classes/event/outage_created.php | 9 -------- classes/event/outage_deleted.php | 8 ------- classes/event/outage_updated.php | 9 -------- classes/form/outage/delete.php | 12 ----------- classes/form/outage/edit.php | 11 +--------- classes/form/outage/finish.php | 9 -------- classes/local/cli/cli_exception.php | 13 ++---------- classes/local/cli/clibase.php | 13 ++---------- classes/local/cli/create.php | 9 -------- classes/local/cli/finish.php | 9 -------- classes/local/cli/waitforit.php | 9 -------- classes/local/controllers/infopage.php | 13 ++---------- .../controllers/maintenance_static_page.php | 9 -------- .../maintenance_static_page_generator.php | 9 -------- .../maintenance_static_page_io.php | 9 -------- classes/local/outage.php | 9 -------- classes/local/outagelib.php | 11 ---------- classes/output/manage/base_table.php | 10 --------- classes/output/manage/history_table.php | 10 --------- classes/output/manage/planned_table.php | 10 --------- classes/output/renderer.php | 9 -------- classes/privacy/provider.php | 14 ++++--------- classes/task/update_static_page.php | 10 --------- db/access.php | 8 +++---- tests/base_testcase.php | 21 ++++++------------- tests/lib_test.php | 9 -------- .../maintenance_static_page_test.php | 17 ++++++++------- tests/local/outage_test.php | 9 -------- tests/local/outagelib_test.php | 17 ++++++--------- views/info/content.php | 1 + views/manage.php | 1 + views/warningbar/warningbar.php | 1 + 35 files changed, 40 insertions(+), 300 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index c1f83d6..5711215 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -13,6 +13,7 @@ // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . + /** * This file should run before config.php requires '/lib/setup.php'. * diff --git a/classes/calendar/calendar.php b/classes/calendar/calendar.php index dc86d47..d2ae3f0 100644 --- a/classes/calendar/calendar.php +++ b/classes/calendar/calendar.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * calendar class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\calendar; use auth_outage\local\outage; diff --git a/classes/dml/outagedb.php b/classes/dml/outagedb.php index 112787b..6582669 100644 --- a/classes/dml/outagedb.php +++ b/classes/dml/outagedb.php @@ -14,18 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * outagedb class. - * - * The DB Context to manipulate Outages. - * It will also commit changes to the calendar as you change outages. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\dml; use auth_outage\calendar\calendar; diff --git a/classes/event/outage_created.php b/classes/event/outage_created.php index ab15994..47dbaef 100644 --- a/classes/event/outage_created.php +++ b/classes/event/outage_created.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Toutage_created class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\event; use core\event\base; diff --git a/classes/event/outage_deleted.php b/classes/event/outage_deleted.php index 5f85fff..68392ac 100644 --- a/classes/event/outage_deleted.php +++ b/classes/event/outage_deleted.php @@ -14,14 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * outage_deleted class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ namespace auth_outage\event; use core\event\base; diff --git a/classes/event/outage_updated.php b/classes/event/outage_updated.php index c61113e..583af98 100644 --- a/classes/event/outage_updated.php +++ b/classes/event/outage_updated.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * outage_updated class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\event; use core\event\base; diff --git a/classes/form/outage/delete.php b/classes/form/outage/delete.php index d93793b..0d65da5 100644 --- a/classes/form/outage/delete.php +++ b/classes/form/outage/delete.php @@ -14,23 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * delete class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\form\outage; defined('MOODLE_INTERNAL') || die(); - require_once($CFG->libdir.'/formslib.php'); -defined('MOODLE_INTERNAL') || die(); - /** * delete class. * diff --git a/classes/form/outage/edit.php b/classes/form/outage/edit.php index 78f7108..55b4872 100644 --- a/classes/form/outage/edit.php +++ b/classes/form/outage/edit.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * edit class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\form\outage; use auth_outage\local\outage; @@ -166,7 +157,7 @@ public function set_data($outage) { if (array_key_exists('auth_outage', $CFG->forced_plugin_settings) && array_key_exists('default_autostart', $CFG->forced_plugin_settings['auth_outage'])) { $this->_form->setDefaults([ - 'autostart' => $CFG->forced_plugin_settings['auth_outage']['default_autostart'] + 'autostart' => $CFG->forced_plugin_settings['auth_outage']['default_autostart'], ]); $mform->freeze('autostart'); } diff --git a/classes/form/outage/finish.php b/classes/form/outage/finish.php index 4711f45..473ea60 100644 --- a/classes/form/outage/finish.php +++ b/classes/form/outage/finish.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * finish class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\form\outage; use moodleform; diff --git a/classes/local/cli/cli_exception.php b/classes/local/cli/cli_exception.php index 297e043..16926de 100644 --- a/classes/local/cli/cli_exception.php +++ b/classes/local/cli/cli_exception.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * cli_exception class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local\cli; use Exception; @@ -85,9 +76,9 @@ class cli_exception extends Exception { * cliexception constructor. * @param string $message An explanation of the exception. * @param int $code Exit code to be used. - * @param Exception $previous Another exception as reference or null. + * @param Exception|null $previous Another exception as reference or null. */ - public function __construct($message, $code = 1, Exception $previous = null) { + public function __construct($message, $code = 1, ?Exception $previous = null) { parent::__construct('*ERROR* '.$message, $code, $previous = null); } } diff --git a/classes/local/cli/clibase.php b/classes/local/cli/clibase.php index 78a52b9..699e87b 100644 --- a/classes/local/cli/clibase.php +++ b/classes/local/cli/clibase.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * clibase class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local\cli; use auth_outage\local\outagelib; @@ -50,10 +41,10 @@ abstract class clibase { /** * clibase constructor. - * @param array $options The parameters to use. + * @param array|null $options The parameters to use. * @throws cli_exception */ - public function __construct(array $options = null) { + public function __construct(?array $options = null) { global $CFG; require_once($CFG->libdir.'/clilib.php'); diff --git a/classes/local/cli/create.php b/classes/local/cli/create.php index 1c548a4..8ac8bbf 100644 --- a/classes/local/cli/create.php +++ b/classes/local/cli/create.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * create class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local\cli; use auth_outage\dml\outagedb; diff --git a/classes/local/cli/finish.php b/classes/local/cli/finish.php index 9600b51..9eeee37 100644 --- a/classes/local/cli/finish.php +++ b/classes/local/cli/finish.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * finish class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local\cli; use auth_outage\dml\outagedb; diff --git a/classes/local/cli/waitforit.php b/classes/local/cli/waitforit.php index a947ae1..0ae7c2a 100644 --- a/classes/local/cli/waitforit.php +++ b/classes/local/cli/waitforit.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * waitforit class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local\cli; use auth_outage\dml\outagedb; diff --git a/classes/local/controllers/infopage.php b/classes/local/controllers/infopage.php index ea1cdae..fcdf051 100644 --- a/classes/local/controllers/infopage.php +++ b/classes/local/controllers/infopage.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * infopage class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local\controllers; use auth_outage\dml\outagedb; @@ -53,9 +44,9 @@ class infopage { /** * infopage_controller constructor. - * @param array $params Parameters to use or null to get from Moodle API (request). + * @param array|null $params Parameters to use or null to get from Moodle API (request). */ - public function __construct(array $params = null) { + public function __construct(?array $params = null) { global $CFG; // Enable SVG support here to make sure all SVG files // used in the current theme are served properly. diff --git a/classes/local/controllers/maintenance_static_page.php b/classes/local/controllers/maintenance_static_page.php index 6d073a5..b2a6858 100644 --- a/classes/local/controllers/maintenance_static_page.php +++ b/classes/local/controllers/maintenance_static_page.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * maintenance_static_page class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local\controllers; use auth_outage\local\outage; diff --git a/classes/local/controllers/maintenance_static_page_generator.php b/classes/local/controllers/maintenance_static_page_generator.php index 130c395..f9a0cd9 100644 --- a/classes/local/controllers/maintenance_static_page_generator.php +++ b/classes/local/controllers/maintenance_static_page_generator.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * maintenance_static_page_generator class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local\controllers; use auth_outage\local\outagelib; diff --git a/classes/local/controllers/maintenance_static_page_io.php b/classes/local/controllers/maintenance_static_page_io.php index 572038d..239c3fd 100644 --- a/classes/local/controllers/maintenance_static_page_io.php +++ b/classes/local/controllers/maintenance_static_page_io.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * maintenance_static_page_io class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local\controllers; use auth_outage\local\outagelib; diff --git a/classes/local/outage.php b/classes/local/outage.php index f9907e4..e426d72 100644 --- a/classes/local/outage.php +++ b/classes/local/outage.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * outage class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local; use coding_exception; diff --git a/classes/local/outagelib.php b/classes/local/outagelib.php index 9b532b2..4c718fa 100644 --- a/classes/local/outagelib.php +++ b/classes/local/outagelib.php @@ -14,20 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * outagelib class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local; use auth_outage\dml\outagedb; use auth_outage\local\controllers\maintenance_static_page; -use auth_outage\output\renderer; use coding_exception; use curl; use Exception; @@ -36,7 +26,6 @@ use stdClass; defined('MOODLE_INTERNAL') || die(); - require_once(__DIR__.'/../../lib.php'); /** diff --git a/classes/output/manage/base_table.php b/classes/output/manage/base_table.php index 2366d36..db5e680 100644 --- a/classes/output/manage/base_table.php +++ b/classes/output/manage/base_table.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * base_table class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\output\manage; use auth_outage\local\outage; @@ -31,7 +22,6 @@ use moodle_url; defined('MOODLE_INTERNAL') || die(); - require_once($CFG->libdir.'/tablelib.php'); /** diff --git a/classes/output/manage/history_table.php b/classes/output/manage/history_table.php index 720a7f0..3b3e8bc 100644 --- a/classes/output/manage/history_table.php +++ b/classes/output/manage/history_table.php @@ -14,21 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * history_table class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\output\manage; use auth_outage\local\outage; defined('MOODLE_INTERNAL') || die(); - require_once($CFG->libdir.'/tablelib.php'); /** diff --git a/classes/output/manage/planned_table.php b/classes/output/manage/planned_table.php index a183147..a58e4a4 100644 --- a/classes/output/manage/planned_table.php +++ b/classes/output/manage/planned_table.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * planned_table class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\output\manage; use auth_outage\local\outage; @@ -30,7 +21,6 @@ use moodle_url; defined('MOODLE_INTERNAL') || die(); - require_once($CFG->libdir.'/tablelib.php'); /** diff --git a/classes/output/renderer.php b/classes/output/renderer.php index 7330f2c..03900f0 100644 --- a/classes/output/renderer.php +++ b/classes/output/renderer.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * auth_outage_renderer class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\output; use auth_outage\local\outage; diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 8cfaf14..a562d8d 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -13,20 +13,14 @@ // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Privacy Subsystem implementation for auth_outage. - * - * @package auth_outage - * @copyright 2018 Olivier SECRET - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ namespace auth_outage\privacy; /** - * Privacy provider for the authentication manual. + * Privacy Subsystem implementation for auth_outage. * - * @copyright 2018 Carlos Escobedo + * @package auth_outage + * @copyright 2018 Olivier SECRET * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements @@ -41,7 +35,7 @@ class provider implements * * @return string */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:no_data_reason'; } diff --git a/classes/task/update_static_page.php b/classes/task/update_static_page.php index e477f6c..2aeff3e 100644 --- a/classes/task/update_static_page.php +++ b/classes/task/update_static_page.php @@ -14,18 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * update_static_page class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\task; -use auth_outage\local\controllers\infopage; use auth_outage\local\outagelib; use core\task\scheduled_task; diff --git a/db/access.php b/db/access.php index cf0c3f5..c9eee33 100644 --- a/db/access.php +++ b/db/access.php @@ -26,12 +26,12 @@ defined('MOODLE_INTERNAL') || die(); $capabilities = [ - 'auth/outage:viewinfo' => array( + 'auth/outage:viewinfo' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_SYSTEM, - 'archetypes' => array( + 'archetypes' => [ 'guest' => CAP_ALLOW, 'user' => CAP_ALLOW, - ) - ), + ], + ], ]; diff --git a/tests/base_testcase.php b/tests/base_testcase.php index c236d74..43802a2 100644 --- a/tests/base_testcase.php +++ b/tests/base_testcase.php @@ -14,6 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace auth_outage; + +use auth_outage\dml\outagedb; +use auth_outage\local\outage; + /** * Base testcase for auth outage tests. * @@ -30,20 +35,6 @@ * @copyright 2016 Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -namespace auth_outage; - -use auth_outage\dml\outagedb; -use auth_outage\local\outage; - -/** - * base_testcase class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ abstract class base_testcase extends \advanced_testcase { /** * Checks PHPUnit version and calls the functions accordingly. @@ -72,7 +63,7 @@ public function set_expected_exception($exception, $message = null, $code = null protected function revoke_info_page_permissions() { global $DB; - $guestrole = $DB->get_record('role', array('shortname' => 'guest')); + $guestrole = $DB->get_record('role', ['shortname' => 'guest']); role_change_permission($guestrole->id, \context_system::instance(), 'auth/outage:viewinfo', CAP_PREVENT); $this->setGuestUser(); diff --git a/tests/lib_test.php b/tests/lib_test.php index 169fcdc..ec53cbe 100644 --- a/tests/lib_test.php +++ b/tests/lib_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * tests for lib.php - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2017 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage; defined('MOODLE_INTERNAL') || die(); diff --git a/tests/local/controllers/maintenance_static_page_test.php b/tests/local/controllers/maintenance_static_page_test.php index 51bd68f..5ee43fb 100644 --- a/tests/local/controllers/maintenance_static_page_test.php +++ b/tests/local/controllers/maintenance_static_page_test.php @@ -199,26 +199,27 @@ public function test_updatelinkfavicon() { * Data provider for test_update_inline_background_images * @return array */ - public function test_update_inline_background_images_provider() { + public static function update_inline_background_images_provider(): array { return [ // Empty string. ["", false], // URLs that should be retrieved. ["color: #FF00FF; background: lightblue url(/pluginfile.php/1/theme_custom/banner/251298630/0001.png) no-repeat", true], - ["background: lightblue url(https://www.example.com/moodle/pluginfile.php/1/theme_custom/banner/251298630/0001.png) no-repeat", true], + ["background: lightblue + url(https://www.example.com/moodle/pluginfile.php/1/theme_custom/banner/251298630/0001.png) no-repeat", true], ["background:url('https://www.example.com/moodle/pluginfile.php/1/theme_custom/banner/251298630/0001.png')", true], ["background-image : url( /pix/help.png);", true], ["background-image: url ('/pix/help.png')", true], // URLs that should not be retrieved. ["background-image:url(data:image/gif;base64,R0lGODlhYADIAP=)", false], - ["background-image:url('data:image/gif;base64,R0lGODlhYADIAP=')", false] + ["background-image:url('data:image/gif;base64,R0lGODlhYADIAP=')", false], ]; } /** * Tests update_inline_background_images() method to update the background images. * - * @dataProvider test_update_inline_background_images_provider + * @dataProvider update_inline_background_images_provider * @param string $stylecontent Content of the style to test * @param bool $rewrite Flag if URL should be rewritten * @throws coding_exception @@ -372,14 +373,14 @@ public function test_get_url_for_file() { /** * Return array of url data provider and true or false. */ - public function is_url_dataprovider() { + public static function is_url_dataprovider(): array { return [ [true, 'http://catalyst.net.nz'], [true, 'https://www.catalyst-au.net/'], [false, '/homepage'], [false, 'file://homepage'], [true, '//catalyst-au.net/img/test.jpg'], - [false, '://www.catalyst-au.net/img/test.jpg'] + [false, '://www.catalyst-au.net/img/test.jpg'], ]; } @@ -560,7 +561,7 @@ public function test_meta_refresh_maximum_5seconds() { * Data provider for test_get_urls_from_stylesheet * @return array */ - public function test_get_urls_from_stylesheet_provider() { + public static function get_urls_from_stylesheet_provider(): array { return [ // Empty string. ["", 0], @@ -582,7 +583,7 @@ public function test_get_urls_from_stylesheet_provider() { /** * Tests get_urls_from_stylesheet() method to get all appropriate URLS from the file. * - * @dataProvider test_get_urls_from_stylesheet_provider + * @dataProvider get_urls_from_stylesheet_provider * @param string $filecontent Content of the file * @param int $count Expected quantity of found URLs * @throws coding_exception diff --git a/tests/local/outage_test.php b/tests/local/outage_test.php index 81ce522..4bf5831 100644 --- a/tests/local/outage_test.php +++ b/tests/local/outage_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * outage_test test class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local; defined('MOODLE_INTERNAL') || die(); diff --git a/tests/local/outagelib_test.php b/tests/local/outagelib_test.php index 8a6618c..ebf6751 100644 --- a/tests/local/outagelib_test.php +++ b/tests/local/outagelib_test.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * outagelib_test test class. - * - * @package auth_outage - * @author Daniel Thee Roperto - * @copyright 2016 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace auth_outage\local; use auth_outage\dml\outagedb; @@ -361,7 +352,7 @@ public function test_createmaintenancephpcode() { * Test create maintenance php code without age * * @param string $configkey The key of the config. - * @dataProvider test_createmaintenancephpcode_withoutage_provider + * @dataProvider createmaintenancephpcode_withoutage_provider */ public function test_createmaintenancephpcode_withoutage($configkey) { global $CFG; @@ -414,7 +405,11 @@ public function test_createmaintenancephpcode_withoutage($configkey) { self::assertSame($found, $expected); } - public function test_createmaintenancephpcode_withoutage_provider(): array { + /** + * Provides values to test_createmaintenancephpcode_withoutage + * @return array + */ + public static function createmaintenancephpcode_withoutage_provider(): array { return [['allowedips'], ['allowedips_forced']]; } diff --git a/views/info/content.php b/views/info/content.php index ed6e0cd..83e3322 100644 --- a/views/info/content.php +++ b/views/info/content.php @@ -24,6 +24,7 @@ * * @var array $viewbag */ +// phpcs:disable moodle.Commenting.MissingDocblock.File defined('MOODLE_INTERNAL') || die(); ?> diff --git a/views/manage.php b/views/manage.php index 94a997f..74beb16 100644 --- a/views/manage.php +++ b/views/manage.php @@ -22,6 +22,7 @@ * @copyright 2016 Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +// phpcs:disable moodle.Commenting.MissingDocblock.File use auth_outage\output\manage\history_table; use auth_outage\output\manage\planned_table; diff --git a/views/warningbar/warningbar.php b/views/warningbar/warningbar.php index 935cb71..754e60c 100644 --- a/views/warningbar/warningbar.php +++ b/views/warningbar/warningbar.php @@ -22,6 +22,7 @@ * @copyright 2016 Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +// phpcs:disable moodle.Commenting.MissingDocblock.File use auth_outage\local\outagelib;