From 51a44db27936209d22058b63b1e006bbbbf23016 Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Thu, 19 Sep 2024 07:38:39 +0200 Subject: [PATCH] Make codechecker happy --- classes/admin_externalpage_in_tab.php | 4 +--- classes/admin_externalpage_tabs.php | 14 ++++++-------- classes/admin_settingspage_tabs_with_external.php | 13 ++++++------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/classes/admin_externalpage_in_tab.php b/classes/admin_externalpage_in_tab.php index a126fc729ba..caa3e6e8e84 100644 --- a/classes/admin_externalpage_in_tab.php +++ b/classes/admin_externalpage_in_tab.php @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace theme_boost_union; - /** * Theme Boost Union - External admin settings page which can be placed within a tab * @@ -24,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die(); +namespace theme_boost_union; /** * Class admin_externalpage_in_tab. diff --git a/classes/admin_externalpage_tabs.php b/classes/admin_externalpage_tabs.php index b08603decee..329bea2d4bb 100644 --- a/classes/admin_externalpage_tabs.php +++ b/classes/admin_externalpage_tabs.php @@ -14,12 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace theme_boost_union; - -use moodle_url; -use tabobject; -use tabtree; - /** * Theme Boost Union - Tabs to be shown within an external admin settings page * @@ -28,7 +22,11 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die(); +namespace theme_boost_union; + +use moodle_url; +use tabobject; +use tabtree; /** * Class admin_externalpage_tabs. @@ -50,7 +48,7 @@ class admin_externalpage_tabs { * * @return void */ - public function _construct() { + public function __construct() { // Initialize the tab tree. $this->tabs = []; } diff --git a/classes/admin_settingspage_tabs_with_external.php b/classes/admin_settingspage_tabs_with_external.php index 9717247071a..2ea742f499e 100644 --- a/classes/admin_settingspage_tabs_with_external.php +++ b/classes/admin_settingspage_tabs_with_external.php @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace theme_boost_union; - /** * Theme Boost Union - Admin settings page with tabs as well as external pages within a tab * @@ -25,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die(); +namespace theme_boost_union; /** * Class admin_settingspage_tabs_with_external. @@ -43,7 +41,8 @@ class admin_settingspage_tabs_with_external extends \theme_boost_admin_settingsp * * This function is amended with a switch for the external tabs. * - * @param $tab object A tab. + * @param object $tab A tab. + * @return bool */ public function add($tab) { // If the tab is an external page, add it as external tab. @@ -77,7 +76,7 @@ public function output_html() { global $OUTPUT; $activetab = optional_param('activetab', '', PARAM_TEXT); - $context = array('tabs' => array()); + $context = ['tabs' => []]; $havesetactive = false; foreach ($this->get_tabs() as $tab) { @@ -91,12 +90,12 @@ public function output_html() { $active = true; } - $newtab = array( + $newtab = [ 'name' => $tab->name, 'displayname' => $tab->visiblename, 'html' => $tab->output_html(), 'active' => $active, - ); + ]; // If the tab is an external page. if ($tab instanceof \admin_externalpage) { // Add a flag for the mustache template.