diff --git a/auth.php b/auth.php
index 91c2321..38ab397 100644
--- a/auth.php
+++ b/auth.php
@@ -32,6 +32,11 @@
*/
class auth_plugin_basic extends auth_plugin_base {
+ /**
+ * Defaults.
+ *
+ * @var int[]
+ */
public $defaults = array(
'debug' => 0,
'send401' => 0,
@@ -49,9 +54,9 @@ public function __construct() {
/**
* A debug function, dumps to the php log as well as into the
* response headers for easy curl based debugging
- *
+ * @param string $msg Message
*/
- private function log($msg) {
+ private function log(string $msg) {
if ($this->config->debug) {
// @codingStandardsIgnoreStart
error_log('auth_basic: ' . $msg);
@@ -161,17 +166,16 @@ public function loginpage_hook() {
* @param string $username The username
* @param string $password The password
* @return bool Authentication success or failure.
- *
- * @SuppressWarnings("unused")
*/
public function user_login ($username, $password) {
return false;
}
/**
+ * Check if provided password is master password.
+ *
* @param $userpassword
* @return bool
- * @throws dml_exception
*/
private function is_master_password($userpassword) {
global $CFG, $DB;
@@ -213,8 +217,9 @@ private function get_random_user() {
/**
* Get a user by site role.
+ *
+ * @param mixed $roleid Role ID
* @return bool|mixed
- * @throws dml_exception
*/
private function get_random_user_by_roleid($roleid) {
$sql = "SELECT u.*
@@ -243,7 +248,10 @@ private function get_random_user_by_courseid($courseid) {
* Get a user who is enrolled in a course with a specified role.
* This will only get student with role at Course Level.
* It will ignore roles at other context level (module, category, block, site).
- * @param $courseid
+ *
+ * @param mixed $courseid
+ * @param mixed $roleid Role ID
+ *
* @return bool|mixed
* @throws dml_exception
*/
@@ -260,9 +268,9 @@ private function get_random_user_by_courseid_with_roleid($courseid, $roleid) {
/**
* Get user based on template value.
- * @param $template
+ *
+ * @param mixed $template
* @return bool|mixed
- * @throws dml_exception
*/
private function get_user($template) {
$user = false;
@@ -300,12 +308,13 @@ private function get_user($template) {
/**
* Get random record.
- * @param $sql
- * @param null $params
+ *
+ * @param string $sql SQL
+ * @param null|array $params
* @return mixed
* @throws dml_exception
*/
- private function random_record($sql, $params=null) {
+ private function random_record(string $sql, ?array $params = null) {
global $DB;
if ($DB->get_dbfamily() == 'mysql') {
$sql = $sql . " ORDER BY rand() LIMIT 1";
diff --git a/classes/form/savepassword.php b/classes/form/savepassword.php
index bf87d19..7bb4dff 100644
--- a/classes/form/savepassword.php
+++ b/classes/form/savepassword.php
@@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
+defined('MOODLE_INTERNAL') || die();
+require_once("$CFG->libdir/formslib.php");
+
/**
* Master Password Form
*
@@ -21,12 +25,13 @@
* @copyright 2018 Nathan Nguyen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
-defined('MOODLE_INTERNAL') || die();
-require_once("$CFG->libdir/formslib.php");
-
class savepassword extends moodleform {
+ /**
+ * Form definition.
+ *
+ * @return void
+ */
protected function definition() {
$mform = $this->_form;
diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php
index 57adca0..abb0616 100644
--- a/classes/privacy/provider.php
+++ b/classes/privacy/provider.php
@@ -13,13 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-/**
- * Privacy Subsystem implementation for auth_basic.
- *
- * @package auth_basic
- * @copyright 2018 Olivier SECRET
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
namespace auth_basic\privacy;
@@ -33,6 +26,13 @@
use core_privacy\local\request\userlist;
use core_privacy\local\request\writer;
+/**
+ * Privacy Subsystem implementation for auth_basic.
+ *
+ * @package auth_basic
+ * @copyright 2018 Olivier SECRET
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class provider implements
\core_privacy\local\metadata\provider,
\core_privacy\local\request\core_userlist_provider,
diff --git a/db/upgrade.php b/db/upgrade.php
index 22ab962..91725b3 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -24,6 +24,11 @@
defined('MOODLE_INTERNAL') || die();
+/**
+ * Upgrade hook.
+ *
+ * @param int $oldversion the version we are upgrading from
+ */
function xmldb_auth_basic_upgrade($oldversion) {
global $DB;
diff --git a/tests/auth_basic_test.php b/tests/auth_basic_test.php
index bfebcee..67dba58 100644
--- a/tests/auth_basic_test.php
+++ b/tests/auth_basic_test.php
@@ -13,19 +13,19 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-/**
- * Base class for unit tests for auth_basic.
- *
- * @package auth_basic
- * @category test
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot.'/auth/basic/auth.php');
+/**
+ * Base class for unit tests for auth_basic.
+ * @package auth_basic
+ * @category test
+ * @copyright Brendan Heywood
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class auth_basic_test extends advanced_testcase {
/** @var auth_plugin_basic Keeps the authentication plugin. */
protected $authplugin;