Skip to content

Commit 9c81f21

Browse files
committed
fix more linting
1 parent 0916c2f commit 9c81f21

25 files changed

+97
-117
lines changed

classes/claim/address.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
* @link https://openid.net/specs/openid-connect-core-1_0.html#AddressClaim
3030
*/
3131
class address implements claim {
32-
3332
/**
3433
* Get addres claim.
3534
* @param array $user core_user user user want the address claim from

classes/claim/claim.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
* @link https://openid.net/specs/openid-connect-core-1_0.html#Claims
3030
*/
3131
interface claim {
32-
3332
// TODO why array not the object.
3433

3534
/**

classes/claim/email.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
* @link https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
3030
*/
3131
class email implements claim {
32-
3332
/**
3433
* Get email claim.
3534
* @param array $user core_user user user want the email claim from

classes/claim/phone.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
* @link https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
3030
*/
3131
class phone implements claim {
32-
3332
/**
3433
* Get phone claim.
3534
* @param array $user core_user want the address claim from

classes/claim/profile.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* @link https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
3131
*/
3232
class profile implements claim {
33-
3433
/**
3534
* Get addres claim.
3635
* @param array $user core_user want the address claim from
@@ -46,7 +45,7 @@ public function claim($user) {
4645
'middle_name' => $user->middlename,
4746
'nickname' => $user->alternatename,
4847
'preferred_username' => $user->username,
49-
'profile' => $CFG->wwwroot."/user/profile.php?id=".$user->id,
48+
'profile' => $CFG->wwwroot . "/user/profile.php?id=" . $user->id,
5049
'picture' => $user->picture ? $userpicture->get_url($PAGE)->raw_out() : null,
5150
// NOTE moodle timezone is 99 if you set timezone is same as server.
5251
'zoneinfo' => $user->timezone == '99' ? date_default_timezone_get() : $user->timezone,

classes/event/user_granted.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
* Event that is triggered when user authenticated succesfull with this oauth plugin
2929
*/
3030
class user_granted extends \core\event\base {
31-
3231
/**
3332
* Returns description of what happened.
3433
*
@@ -83,5 +82,4 @@ protected function validate_data() {
8382
throw new \coding_exception('The property scope must be set.');
8483
}
8584
}
86-
8785
}

classes/event/user_not_granted.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
* Event that is triggered when user is NOT succesfull authenticated succesfull with this oauth plugin
2929
*/
3030
class user_not_granted extends user_granted {
31-
3231
/**
3332
* Returns description of what happened.
3433
*

classes/form/authorize.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
* Form that request the use if he the client should be authorize, to get information specified by the requested scope.
3030
*/
3131
class authorize extends moodleform {
32-
3332
/**
3433
* Defined fields for the authorize form.
3534
*/
@@ -38,14 +37,14 @@ public function definition() {
3837

3938
$clientid = required_param('client_id', PARAM_RAW);
4039

41-
$text = get_string('auth_question', 'local_oauth', $clientid).'<br />';
40+
$text = get_string('auth_question', 'local_oauth', $clientid) . '<br />';
4241
$mform->addElement('html', $text);
4342
$scope = optional_param('scope', false, PARAM_TEXT);
4443
if (!empty($scope)) {
4544
$scopes = explode(' ', $scope);
46-
$text = get_string('auth_question_desc', 'local_oauth').'<ul>';
45+
$text = get_string('auth_question_desc', 'local_oauth') . '<ul>';
4746
foreach ($scopes as $scope) {
48-
$text .= '<li>'.get_string('scope_'.$scope, 'local_oauth').'</li>';
47+
$text .= '<li>' . get_string('scope_' . $scope, 'local_oauth') . '</li>';
4948
}
5049
$text .= '</ul>';
5150
} else {

classes/form/edit_client.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
* Form for client options
3535
*/
3636
class edit_client extends moodleform {
37-
3837
/**
3938
* Define the fields of the form
4039
*/
@@ -68,7 +67,7 @@ public function definition() {
6867
$bform->setExpanded('othersettings', false);
6968
$grantoptions = $server->getGrantTypes();
7069
foreach ($grantoptions as $key => $value) {
71-
$grantoptions[$key] = $key . ": " . get_string($key."_explanation", "local_oauth");
70+
$grantoptions[$key] = $key . ": " . get_string($key . "_explanation", "local_oauth");
7271
}
7372
// TODO Consider replacing this with checkbox for granttypes.
7473
$select = $bform->addElement('select', 'granttypes', get_string('grant_types', 'local_oauth'), $grantoptions);
@@ -98,7 +97,6 @@ public function definition() {
9897
$bform->setType('noconfirmation', PARAM_BOOL);
9998

10099
$this->add_action_buttons();
101-
102100
}
103101

104102
/**

classes/privacy/provider.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@
3737
*
3838
*/
3939
class provider implements
40+
\core_privacy\local\request\core_userlist_provider,
4041
\core_privacy\local\metadata\provider,
41-
\core_privacy\local\request\plugin\provider,
42-
\core_privacy\local\request\core_userlist_provider {
43-
42+
\core_privacy\local\request\plugin\provider {
4443
/**
4544
* Return the fields which contain personal data.
4645
*
@@ -71,7 +70,8 @@ public static function get_metadata(collection $collection): collection {
7170
'expires' => 'privacy:metadata:local_oauth:refresh_tokens:expires',
7271
'scope' => 'privacy:metadata:local_oauth:refresh_tokens:scope',
7372
],
74-
'privacy:metadata:local_oauth:refresh_tokens:tableexplanation');
73+
'privacy:metadata:local_oauth:refresh_tokens:tableexplanation'
74+
);
7575

7676
$collection->add_database_table(
7777
'local_oauth_auth_codes',
@@ -85,9 +85,11 @@ public static function get_metadata(collection $collection): collection {
8585
'scope' => 'privacy:metadata:local_oauth:auth_codes:scope',
8686
'id_token' => 'privacy:metadata:local_oauth:auth_codes:id_token',
8787
],
88-
'privacy:metadata:local_oauth:auth_codes:tableexplanation');
88+
'privacy:metadata:local_oauth:auth_codes:tableexplanation'
89+
);
8990

90-
$collection->add_database_table('local_oauth_access_tokens',
91+
$collection->add_database_table(
92+
'local_oauth_access_tokens',
9193
[
9294
'id' => 'privacy:metadata:local_oauth:access_tokens:id',
9395
'access_token' => 'privacy:metadata:local_oauth:access_tokens:access_token',
@@ -96,7 +98,8 @@ public static function get_metadata(collection $collection): collection {
9698
'expires' => 'privacy:metadata:local_oauth:access_tokens:expires',
9799
'scope' => 'privacy:metadata:local_oauth:access_tokens:scope',
98100
],
99-
'privacy:metadata:local_oauth:access_tokens:tableexplanation');
101+
'privacy:metadata:local_oauth:access_tokens:tableexplanation'
102+
);
100103

101104
$collection->add_external_location_link(
102105
'oauth_client',
@@ -116,7 +119,9 @@ public static function get_metadata(collection $collection): collection {
116119
'locality ' => 'privacy:metadata:oauth_client:locality',
117120
'country' => 'privacy:metadata:oauth_client:country',
118121
'enrolments' => 'privacy:metadata:oauth_client:enrolments',
119-
], 'privacy:metadata:oauth_client');
122+
],
123+
'privacy:metadata:oauth_client'
124+
);
120125

121126
// Plugin also access user and enrolment data but does not store or modify it.
122127
// So we dont have to specify that.
@@ -134,7 +139,6 @@ public static function get_contexts_for_userid(int $userid): contextlist {
134139

135140
$contextlist = new \core_privacy\local\request\contextlist();
136141
return $contextlist->add_user_context($userid);
137-
138142
}
139143

140144
/**
@@ -181,7 +185,7 @@ public static function export_user_data(approved_contextlist $contextlist) {
181185
$userauthscopes = $DB->get_records('local_oauth_user_auth_scopes', ['user_id' => $user->id]);
182186
foreach ($userauthscopes as $scope) {
183187
$scope->user_id = transform::user($scope->user_id);
184-
writer::with_context($context)->export_data( array_merge($subcontext, [
188+
writer::with_context($context)->export_data(array_merge($subcontext, [
185189
$scope->client_id,
186190
$scope->scope,
187191
get_string('privacy:metadata:local_oauth:auth_scopes', 'local_oauth'),
@@ -217,7 +221,7 @@ public static function export_user_data(approved_contextlist $contextlist) {
217221
$token->user_id = transform::user($token->user_id);
218222
$token->expires = transform::datetime($token->expires);
219223
$token->access_token = $notexportedstr;
220-
writer::with_context($context)->export_data( array_merge($subcontext, [
224+
writer::with_context($context)->export_data(array_merge($subcontext, [
221225
$token->client_id,
222226
$token->scope,
223227
get_string('privacy:metadata:local_oauth:access_tokens', 'local_oauth'),
@@ -283,8 +287,5 @@ private static function delete_user(int $userid) {
283287
$DB->delete_records('local_oauth_refresh_tokens', ['user_id' => $userid]);
284288
$DB->delete_records('local_oauth_auth_codes', ['user_id' => $userid]);
285289
$DB->delete_records('local_oauth_access_tokens', ['user_id' => $userid]);
286-
287290
}
288-
289291
}
290-

0 commit comments

Comments
 (0)