Skip to content

Commit e71efd1

Browse files
committed
Use consistent nameing
1 parent 30644cf commit e71efd1

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

src/Auth/Source/External.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,21 @@ public function __construct(array $info, array $config)
125125
* @return array|NULL The user's attributes, or NULL if the user isn't
126126
* authenticated.
127127
*/
128-
private function getUser($drupaluid): ?array
128+
private function getUser($drupalUid): ?array
129129
{
130-
if (!empty($drupaluid)) {
130+
if (!empty($drupalUid)) {
131131
$drupalHelper = new DrupalHelper();
132-
$drupalHelper->bootDrupal($this->config->getDrupalroot());
132+
$drupalHelper->bootDrupal($this->config->getDrupalRoot());
133133

134134
// Load the user object from Drupal.
135-
$drupaluser = User::load($drupaluid);
136-
if ($drupaluser->isBlocked()) {
135+
$drupalUser = User::load($drupalUid);
136+
if ($drupalUser->isBlocked()) {
137137
throw new Error('NOACCESS');
138138
}
139139

140-
$requested_attributes = $this->config->getAttributes();
140+
$requestedAttributes = $this->config->getAttributes();
141141

142-
return $drupalHelper->getAttributes($drupaluser, $requested_attributes);
142+
return $drupalHelper->getAttributes($drupalUser, $requestedAttributes);
143143
}
144144

145145
return null;
@@ -207,16 +207,16 @@ public function authenticate(array &$state): void
207207
* is also part of this module, but in a real example, this would likely be
208208
* the absolute URL of the login page for the site.
209209
*/
210-
$authPage = $this->config->getDrupalLoginURL();
210+
$authPage = $this->config->getDrupalLoginUrl();
211211

212212
/*
213213
* The redirect to the authentication page.
214214
*
215215
* Note the 'ReturnTo' parameter. This must most likely be replaced with
216216
* the real name of the parameter for the login page.
217217
*/
218-
$HTTP = new HTTP();
219-
$HTTP->redirectTrustedURL($authPage, [
218+
$http = new HTTP();
219+
$http->redirectTrustedURL($authPage, [
220220
'ReturnTo' => $returnTo,
221221
]);
222222

@@ -322,13 +322,13 @@ public function logout(array &$state): void
322322
session_start();
323323
}
324324

325-
$logout_url = $this->config->getDrupalLogoutURL();
325+
$logoutUrl = $this->config->getDrupalLogoutUrl();
326326
$parameters = [];
327327
if (!empty($state['ReturnTo'])) {
328328
$parameters['ReturnTo'] = $state['ReturnTo'];
329329
}
330330

331-
$HTTP = new HTTP();
332-
$HTTP->redirectTrustedURL($logout_url, $parameters);
331+
$http = new HTTP();
332+
$http->redirectTrustedURL($logoutUrl, $parameters);
333333
}
334334
}

src/Auth/Source/UserPass.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected function login(string $username, string $password): array
108108
assert(is_string($password));
109109

110110
$drupalHelper = new DrupalHelper();
111-
$drupalHelper->bootDrupal($this->config->getDrupalroot());
111+
$drupalHelper->bootDrupal($this->config->getDrupalRoot());
112112

113113
/* @value \Drupal\user\UserAuth $userAuth */
114114
$userAuth = \Drupal::service('user.auth');
@@ -120,13 +120,13 @@ protected function login(string $username, string $password): array
120120
}
121121

122122
// Load the user object from Drupal.
123-
$drupaluser = User::load($uid);
124-
if ($drupaluser->isBlocked()) {
123+
$drupalUser = User::load($uid);
124+
if ($drupalUser->isBlocked()) {
125125
throw new Error('NOACCESS');
126126
}
127127

128-
$requested_attributes = $this->config->getAttributes();
128+
$requestedAttributes = $this->config->getAttributes();
129129

130-
return $drupalHelper->getAttributes($drupaluser, $requested_attributes);
130+
return $drupalHelper->getAttributes($drupalUser, $requestedAttributes);
131131
}
132132
}

src/ConfigHelper.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ConfigHelper
1919
/**
2020
* The filesystem path to the Drupal directory
2121
*/
22-
private string $drupalroot;
22+
private string $drupalRoot;
2323

2424

2525
/**
@@ -39,13 +39,13 @@ class ConfigHelper
3939
/**
4040
* The Drupal logout URL
4141
*/
42-
private string $drupal_logout_url;
42+
private string $drupalLogoutUrl;
4343

4444

4545
/**
4646
* The Drupal login URL
4747
*/
48-
private string $drupal_login_url;
48+
private string $drupalLoginUrl;
4949

5050

5151
/**
@@ -64,11 +64,11 @@ public function __construct(array $config, string $location)
6464
/* Get authsource configuration. */
6565
$config = Configuration::loadFromArray($config, $location);
6666

67-
$this->drupalroot = $config->getString('drupalroot');
67+
$this->drupalRoot = $config->getString('drupalroot');
6868
$this->debug = $config->getOptionalBoolean('debug', false);
6969
$this->attributes = $config->getOptionalArray('attributes', null);
70-
$this->drupal_logout_url = $config->getString('drupal_logout_url');
71-
$this->drupal_login_url = $config->getString('drupal_login_url');
70+
$this->drupalLogoutUrl = $config->getString('drupal_logout_url');
71+
$this->drupalLoginUrl = $config->getString('drupal_login_url');
7272
}
7373

7474
/**
@@ -86,9 +86,9 @@ public function getDebug(): bool
8686
*
8787
* @return string
8888
*/
89-
public function getDrupalroot(): string
89+
public function getDrupalRoot(): string
9090
{
91-
return $this->drupalroot;
91+
return $this->drupalRoot;
9292
}
9393

9494
/**
@@ -107,18 +107,18 @@ public function getAttributes(): ?array
107107
*
108108
* @return string
109109
*/
110-
public function getDrupalLogoutURL(): string
110+
public function getDrupalLogoutUrl(): string
111111
{
112-
return $this->drupal_logout_url;
112+
return $this->drupalLogoutUrl;
113113
}
114114

115115
/**
116116
* Returns Drupal login URL.
117117
*
118118
* @return string
119119
*/
120-
public function getDrupalLoginURL(): string
120+
public function getDrupalLoginUrl(): string
121121
{
122-
return $this->drupal_login_url;
122+
return $this->drupalLoginUrl;
123123
}
124124
}

0 commit comments

Comments
 (0)