Skip to content

Commit 29e0a33

Browse files
committed
Fix Moodle plugin CI errors
1 parent fba24a9 commit 29e0a33

Some content is hidden

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

53 files changed

+390
-294
lines changed

auth.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function __construct($forceloginflow = null) {
7878
*
7979
* @return bool
8080
*/
81-
function can_be_manually_set() {
81+
public function can_be_manually_set() {
8282
return true;
8383
}
8484

@@ -197,8 +197,8 @@ public function handleredirect() {
197197
* @param null $userid
198198
* @return mixed
199199
*/
200-
public function disconnect($justremovetokens = false, $donotremovetokens = false, \moodle_url $redirect = null,
201-
\moodle_url $selfurl = null, $userid = null) {
200+
public function disconnect($justremovetokens = false, $donotremovetokens = false, ?\moodle_url $redirect = null,
201+
?\moodle_url $selfurl = null, $userid = null) {
202202
return $this->loginflow->disconnect($justremovetokens, $donotremovetokens, $redirect, $selfurl, $userid);
203203
}
204204

binding_username_claim.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050

5151
$oidcconfig = get_config('auth_oidc');
5252
if (!isset($oidcconfig->bindingusernameclaim)) {
53-
// bindingusernameclaim is not set, set default value.
53+
// Bindingusernameclaim is not set, set default value.
5454
$formdata['bindingusernameclaim'] = 'auto';
5555
$formdata['customclaimname'] = '';
5656
set_config('bindingusernameclaim', 'auto', 'auth_oidc');
57-
} else if(!$oidcconfig->bindingusernameclaim) {
57+
} else if (!$oidcconfig->bindingusernameclaim) {
5858
$formdata['bindingusernameclaim'] = 'auto';
5959
$formdata['customclaimname'] = '';
6060
} else if (in_array($oidcconfig->bindingusernameclaim, $predefinedbindingclaims)) {

classes/adminsetting/auth_oidc_admin_setting_iconselect.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace auth_oidc\adminsetting;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Choose an icon for the identity provider entry on the login page.
3230
*/
@@ -93,8 +91,8 @@ public function write_setting($data) {
9391
*/
9492
public function output_html($data, $query = '') {
9593
global $CFG, $OUTPUT;
96-
$attrs = array('type' => 'text/css', 'rel' => 'stylesheet',
97-
'href' => new \moodle_url('/auth/oidc/classes/adminsetting/iconselect.css'));
94+
$attrs = ['type' => 'text/css', 'rel' => 'stylesheet',
95+
'href' => new \moodle_url('/auth/oidc/classes/adminsetting/iconselect.css')];
9896
$html = \html_writer::empty_tag('link', $attrs);
9997
$html .= \html_writer::start_tag('div', ['style' => 'max-width: 390px']);
10098
$selected = (!empty($data)) ? $data : $this->defaultsetting;
@@ -114,7 +112,7 @@ public function output_html($data, $query = '') {
114112
}
115113
$html .= \html_writer::empty_tag('input', $inputattrs);
116114
$labelattrs = [
117-
'class' => 'iconselect'
115+
'class' => 'iconselect',
118116
];
119117
$html .= \html_writer::label($iconhtml, $id, true, $labelattrs);
120118
}

classes/adminsetting/auth_oidc_admin_setting_label.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,22 @@
2727

2828
use admin_setting;
2929

30-
defined('MOODLE_INTERNAL') || die();
31-
3230
/**
3331
* Display a static text.
3432
*/
3533
class auth_oidc_admin_setting_label extends admin_setting {
34+
/**
35+
* @var string $label The label for display purposes.
36+
*/
3637
private $label;
3738

3839
/**
3940
* Constructor.
4041
*
41-
* @param $name
42-
* @param $label
43-
* @param $visiblename
44-
* @param $description
42+
* @param string $name The setting name.
43+
* @param string $label The label to display.
44+
* @param string $visiblename The visible name for the setting.
45+
* @param string $description A description of the setting.
4546
*/
4647
public function __construct($name, $label, $visiblename, $description) {
4748
parent::__construct($name, $visiblename, $description, '');

classes/adminsetting/auth_oidc_admin_setting_loginflow.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace auth_oidc\adminsetting;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Displays the redirect URI for easier config.
3230
*/
@@ -79,7 +77,7 @@ public function output_html($data, $query = '') {
7977
'type' => 'radio',
8078
'name' => $inputname,
8179
'id' => $flowtypeid,
82-
'value' => $flowtype
80+
'value' => $flowtype,
8381
];
8482
if ($data === $flowtype || (empty($data) && $flowtype === $this->get_defaultsetting())) {
8583
$radioattrs['checked'] = 'checked';

classes/adminsetting/auth_oidc_admin_setting_redirecturi.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,22 @@
2727

2828
use auth_oidc\utils;
2929

30-
defined('MOODLE_INTERNAL') || die();
31-
3230
/**
3331
* Displays the redirect URI for easier config.
3432
*/
3533
class auth_oidc_admin_setting_redirecturi extends \admin_setting {
34+
/**
35+
* @var string $url The redirect URL for the configuration.
36+
*/
3637
private $url;
3738

3839
/**
3940
* Constructor.
4041
*
41-
* @param $name
42-
* @param $heading
43-
* @param $description
42+
* @param string $name The setting name.
43+
* @param string $heading The setting heading.
44+
* @param string $description The setting description.
45+
* @param string $url The redirect URL.
4446
*/
4547
public function __construct($name, $heading, $description, $url) {
4648
$this->nosave = true;

classes/event/action_failed.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace auth_oidc\event;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Event fired whenever we need to record a debug message.
3230
*/

classes/event/user_authed.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace auth_oidc\event;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Event fired when a user authenticated with OIDC, but does not log in.
3230
*/

classes/event/user_connected.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace auth_oidc\event;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Fired when a user connects to OpenID Connect.
3230
*/

classes/event/user_created.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace auth_oidc\event;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Event fired when OIDC creates a new user.
3230
*/

classes/event/user_disconnected.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace auth_oidc\event;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Fired when a user disconnects from OpenID Connect.
3230
*/

classes/event/user_loggedin.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace auth_oidc\event;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Fired when a user uses OIDC to log in.
3230
*/

classes/event/user_rename_attempt.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
use context_system;
2929
use core\event\base;
3030

31-
defined('MOODLE_INTERNAL') || die();
32-
3331
/**
3432
* Fired when a user attempts to change their username from the auth_oidc plugin.
3533
*/
@@ -63,4 +61,4 @@ protected function init() {
6361
$this->data['edulevel'] = self::LEVEL_OTHER;
6462
$this->data['objecttable'] = 'user';
6563
}
66-
}
64+
}

classes/form/application.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected function definition() {
8686
// Certificate source.
8787
$mform->addElement('select', 'clientcertsource', auth_oidc_config_name_in_form('clientcertsource'), [
8888
AUTH_OIDC_AUTH_CERT_SOURCE_TEXT => get_string('cert_source_text', 'auth_oidc'),
89-
AUTH_OIDC_AUTH_CERT_SOURCE_FILE => get_string('cert_source_path', 'auth_oidc')
89+
AUTH_OIDC_AUTH_CERT_SOURCE_FILE => get_string('cert_source_path', 'auth_oidc'),
9090
]);
9191
$mform->setDefault('clientcertsource', 0);
9292
$mform->disabledIf('clientcertsource', 'clientauthmethod', 'neq', AUTH_OIDC_AUTH_METHOD_CERTIFICATE);
@@ -146,7 +146,7 @@ protected function definition() {
146146
$mform->addElement('static', 'tokenendpoint_help', '', get_string('tokenendpoint_help', 'auth_oidc'));
147147
$mform->addRule('tokenendpoint', null, 'required', null, 'client');
148148

149-
// "Other parameters" header.
149+
// Other parameters header.
150150
$mform->addElement('header', 'otherparams', get_string('settings_section_other_params', 'auth_oidc'));
151151
$mform->setExpanded('otherparams');
152152

@@ -184,11 +184,11 @@ protected function definition() {
184184
/**
185185
* Additional validate rules.
186186
*
187-
* @param $data
188-
* @param $files
189-
* @return array
187+
* @param array $data Submitted data for validation.
188+
* @param array $files Uploaded files for validation.
189+
* @return array An array of validation errors, if any.
190190
*/
191-
function validation($data, $files) {
191+
public function validation($data, $files) {
192192
$errors = parent::validation($data, $files);
193193

194194
if (!isset($data['clientauthmethod'])) {
@@ -278,4 +278,4 @@ function validation($data, $files) {
278278

279279
return $errors;
280280
}
281-
}
281+
}

classes/form/binding_username_claim.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,19 @@
3636
* Class bindingusernameclaim represents the form on the binding username claim configuration page.
3737
*/
3838
class binding_username_claim extends moodleform {
39+
/**
40+
* Option for setting a non-Microsoft IdP.
41+
*/
3942
const OPTION_SET_NON_MS_IDP = 1;
43+
44+
/**
45+
* Option for setting a Microsoft IdP without user sync.
46+
*/
4047
const OPTION_SET_MS_NO_USER_SYNC = 2;
48+
49+
/**
50+
* Option for setting a Microsoft IdP with user sync enabled.
51+
*/
4152
const OPTION_SET_MS_WITH_USER_SYNC = 3;
4253

4354
/** @var int */
@@ -102,7 +113,12 @@ protected function definition() {
102113
throw new moodle_exception('missing_idp_type', 'auth_oidc');
103114
}
104115

105-
$mform->addElement('select', 'bindingusernameclaim', auth_oidc_config_name_in_form('binding_username_claim'), $bindingusernameoptions);
116+
$mform->addElement(
117+
'select',
118+
'bindingusernameclaim',
119+
auth_oidc_config_name_in_form('binding_username_claim'),
120+
$bindingusernameoptions
121+
);
106122
$mform->setDefault('bindingusernameclaim', 'auto');
107123
$mform->addElement('static', 'bindingusernameclaim_description', '', get_string($descriptionidentifier, 'auth_oidc'));
108124

classes/form/change_binding_username_claim_tool_form1.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
use moodle_url;
3232
use moodleform;
3333

34-
defined('MOODLE_INTERNAL') || die();
35-
3634
/**
3735
* Class change_binding_username_claim_tool_form1 represents the form on the change binding username claim tool page.
3836
*/

classes/form/change_binding_username_claim_tool_form2.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
use moodleform;
2929

30-
defined('MOODLE_INTERNAL') || die();
31-
3230
/**
3331
* Class change_binding_username_claim_tool_form2 represents the form on the change binding username claim tool page.
3432
*/
@@ -38,7 +36,7 @@ class change_binding_username_claim_tool_form2 extends moodleform {
3836
*
3937
* @return void
4038
*/
41-
function definition() {
39+
public function definition() {
4240
$mform =& $this->_form;
4341
$data = $this->_customdata['data'];
4442

classes/httpclient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function get_moodle_version() {
8585
* @param array $options
8686
* @return bool
8787
*/
88-
protected function request($url, $options = array()) {
88+
protected function request($url, $options = []) {
8989
$this->setHeader($this->get_clienttag_headers());
9090
$result = parent::request($url, $options);
9191
$this->resetHeader();
@@ -100,7 +100,7 @@ protected function request($url, $options = array()) {
100100
* @param array $options
101101
* @return bool
102102
*/
103-
public function post($url, $params = '', $options = array()) {
103+
public function post($url, $params = '', $options = []) {
104104
// Encode data to disable uploading files when values are prefixed @.
105105
if (is_array($params)) {
106106
$params = http_build_query($params, '', '&');

classes/httpclientinterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace auth_oidc;
2727

28-
defined('MOODLE_INTERNAL') || die();
29-
3028
/**
3129
* Interface defining an HTTP client.
3230
*/
@@ -39,5 +37,5 @@ interface httpclientinterface {
3937
* @param array $options
4038
* @return bool
4139
*/
42-
public function post($url, $params = '', $options = array());
40+
public function post($url, $params = '', $options = []);
4341
}

classes/jwt.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
use moodle_exception;
2929

30-
defined('MOODLE_INTERNAL') || die();
31-
3230
/**
3331
* Class for working with JWTs.
3432
*/

0 commit comments

Comments
 (0)