Skip to content

Commit 195da32

Browse files
committed
style(PHP): code cleanup, no effective changes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
1 parent d2f7e89 commit 195da32

File tree

1 file changed

+7
-11
lines changed
  • apps/files_external/lib/Lib/Backend

1 file changed

+7
-11
lines changed

apps/files_external/lib/Lib/Backend/SMB.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ public function __construct(IL10N $l, Password $legacyAuth) {
6060
->setLegacyAuthMechanism($legacyAuth);
6161
}
6262

63-
/**
64-
* @return void
65-
*/
66-
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
63+
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null): void {
6764
$auth = $storage->getAuthMechanism();
6865
if ($auth->getScheme() === AuthMechanism::SCHEME_PASSWORD) {
6966
if (!is_string($storage->getBackendOption('user')) || !is_string($storage->getBackendOption('password'))) {
@@ -93,26 +90,25 @@ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user =
9390
} else {
9491
try {
9592
$credentials = $credentialsStore->getLoginCredentials();
96-
$user = $credentials->getLoginName();
93+
$loginName = $credentials->getLoginName();
9794
$pass = $credentials->getPassword();
98-
preg_match('/(.*)@(.*)/', $user, $matches);
95+
preg_match('/(.*)@(.*)/', $loginName, $matches);
9996
$realm = $storage->getBackendOption('default_realm');
10097
if (empty($realm)) {
10198
$realm = 'WORKGROUP';
10299
}
103100
if (count($matches) === 0) {
104-
$username = $user;
101+
$username = $loginName;
105102
$workgroup = $realm;
106103
} else {
107-
$username = $matches[1];
108-
$workgroup = $matches[2];
104+
[, $username, $workgroup] = $matches;
109105
}
110106
$smbAuth = new BasicAuth(
111107
$username,
112108
$workgroup,
113109
$pass
114110
);
115-
} catch (\Exception $e) {
111+
} catch (\Exception) {
116112
throw new InsufficientDataForMeaningfulAnswerException('No session credentials saved');
117113
}
118114
}
@@ -126,7 +122,7 @@ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user =
126122
$storage->setBackendOption('auth', $smbAuth);
127123
}
128124

129-
public function checkDependencies() {
125+
public function checkDependencies(): array {
130126
$system = \OCP\Server::get(SystemBridge::class);
131127
if (NativeServer::available($system)) {
132128
return [];

0 commit comments

Comments
 (0)