Skip to content

Commit c2911d1

Browse files
committed
issue #43: fix CI complains
1 parent cb8dd98 commit c2911d1

File tree

5 files changed

+51
-32
lines changed

5 files changed

+51
-32
lines changed

auth.php

+23-14
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
*/
3333
class auth_plugin_basic extends auth_plugin_base {
3434

35+
/**
36+
* Defaults.
37+
*
38+
* @var int[]
39+
*/
3540
public $defaults = array(
3641
'debug' => 0,
3742
'send401' => 0,
@@ -49,9 +54,9 @@ public function __construct() {
4954
/**
5055
* A debug function, dumps to the php log as well as into the
5156
* response headers for easy curl based debugging
52-
*
57+
* @param string $msg Message
5358
*/
54-
private function log($msg) {
59+
private function log(string $msg) {
5560
if ($this->config->debug) {
5661
// @codingStandardsIgnoreStart
5762
error_log('auth_basic: ' . $msg);
@@ -161,17 +166,16 @@ public function loginpage_hook() {
161166
* @param string $username The username
162167
* @param string $password The password
163168
* @return bool Authentication success or failure.
164-
*
165-
* @SuppressWarnings("unused")
166169
*/
167170
public function user_login ($username, $password) {
168171
return false;
169172
}
170173

171174
/**
172-
* @param $userpassword
175+
* Check if provided password is master password.
176+
*
177+
* @param string $userpassword User password.
173178
* @return bool
174-
* @throws dml_exception
175179
*/
176180
private function is_master_password($userpassword) {
177181
global $CFG, $DB;
@@ -213,8 +217,9 @@ private function get_random_user() {
213217

214218
/**
215219
* Get a user by site role.
220+
*
221+
* @param mixed $roleid Role ID
216222
* @return bool|mixed
217-
* @throws dml_exception
218223
*/
219224
private function get_random_user_by_roleid($roleid) {
220225
$sql = "SELECT u.*
@@ -226,7 +231,7 @@ private function get_random_user_by_roleid($roleid) {
226231

227232
/**
228233
* Get a user who is enrolled in a course.
229-
* @param $courseid
234+
* @param int $courseid
230235
* @return bool|mixed
231236
* @throws dml_exception
232237
*/
@@ -243,7 +248,10 @@ private function get_random_user_by_courseid($courseid) {
243248
* Get a user who is enrolled in a course with a specified role.
244249
* This will only get student with role at Course Level.
245250
* It will ignore roles at other context level (module, category, block, site).
246-
* @param $courseid
251+
*
252+
* @param int $courseid
253+
* @param int $roleid Role ID
254+
*
247255
* @return bool|mixed
248256
* @throws dml_exception
249257
*/
@@ -260,9 +268,9 @@ private function get_random_user_by_courseid_with_roleid($courseid, $roleid) {
260268

261269
/**
262270
* Get user based on template value.
263-
* @param $template
271+
*
272+
* @param mixed $template
264273
* @return bool|mixed
265-
* @throws dml_exception
266274
*/
267275
private function get_user($template) {
268276
$user = false;
@@ -300,12 +308,13 @@ private function get_user($template) {
300308

301309
/**
302310
* Get random record.
303-
* @param $sql
304-
* @param null $params
311+
*
312+
* @param string $sql SQL
313+
* @param null|array $params
305314
* @return mixed
306315
* @throws dml_exception
307316
*/
308-
private function random_record($sql, $params=null) {
317+
private function random_record(string $sql, ?array $params = null) {
309318
global $DB;
310319
if ($DB->get_dbfamily() == 'mysql') {
311320
$sql = $sql . " ORDER BY rand() LIMIT 1";

classes/form/savepassword.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,24 @@
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+
18+
defined('MOODLE_INTERNAL') || die();
19+
require_once("$CFG->libdir/formslib.php");
20+
1721
/**
1822
* Master Password Form
1923
*
2024
* @package auth_basic
2125
* @copyright 2018 Nathan Nguyen <[email protected]>
2226
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2327
*/
24-
25-
defined('MOODLE_INTERNAL') || die();
26-
require_once("$CFG->libdir/formslib.php");
27-
2828
class savepassword extends moodleform {
2929

30+
/**
31+
* Form definition.
32+
*
33+
* @return void
34+
*/
3035
protected function definition() {
3136
$mform = $this->_form;
3237

classes/privacy/provider.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
//
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/>.
16-
/**
17-
* Privacy Subsystem implementation for auth_basic.
18-
*
19-
* @package auth_basic
20-
* @copyright 2018 Olivier SECRET <[email protected]>
21-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22-
*/
2316

2417
namespace auth_basic\privacy;
2518

@@ -33,6 +26,13 @@
3326
use core_privacy\local\request\userlist;
3427
use core_privacy\local\request\writer;
3528

29+
/**
30+
* Privacy Subsystem implementation for auth_basic.
31+
*
32+
* @package auth_basic
33+
* @copyright 2018 Olivier SECRET <[email protected]>
34+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35+
*/
3636
class provider implements
3737
\core_privacy\local\metadata\provider,
3838
\core_privacy\local\request\core_userlist_provider,

db/upgrade.php

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424

2525
defined('MOODLE_INTERNAL') || die();
2626

27+
/**
28+
* Upgrade hook.
29+
*
30+
* @param int $oldversion the version we are upgrading from
31+
*/
2732
function xmldb_auth_basic_upgrade($oldversion) {
2833
global $DB;
2934

tests/auth_basic_test.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
//
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/>.
16-
/**
17-
* Base class for unit tests for auth_basic.
18-
*
19-
* @package auth_basic
20-
* @category test
21-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22-
*/
2316

2417
defined('MOODLE_INTERNAL') || die();
2518

2619
global $CFG;
2720
require_once($CFG->dirroot.'/auth/basic/auth.php');
2821

22+
/**
23+
* Base class for unit tests for auth_basic.
24+
* @package auth_basic
25+
* @category test
26+
* @copyright Brendan Heywood <[email protected]>
27+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28+
*/
2929
class auth_basic_test extends advanced_testcase {
3030
/** @var auth_plugin_basic Keeps the authentication plugin. */
3131
protected $authplugin;

0 commit comments

Comments
 (0)