Minor: Format code - refs BT#21930

pull/5763/head
Angel Fernando Quiroz Campos 1 year ago
parent e3978e15d4
commit 228c3dc8fd
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 11
      plugin/azure_active_directory/src/AzureActiveDirectory.php
  2. 13
      plugin/azure_active_directory/src/AzureSyncUsergroupsCommand.php
  3. 10
      plugin/azure_active_directory/src/AzureSyncUsersCommand.php

@ -180,7 +180,8 @@ class AzureActiveDirectory extends Plugin
return $defaultOrder;
}
public function getUserIdByVerificationOrder(array $azureUserData, string $azureUidKey = 'objectId'): ?int {
public function getUserIdByVerificationOrder(array $azureUserData, string $azureUidKey = 'objectId'): ?int
{
$selectedOrder = $this->getExistingUserVerificationOrder();
$extraFieldValue = new ExtraFieldValue('user');
@ -228,7 +229,7 @@ class AzureActiveDirectory extends Plugin
if (empty($userId)) {
// If we didn't find the user
if ($this->get(self::SETTING_PROVISION_USERS) !== 'true') {
throw new Exception('User not found when checking the extra fields from ' . $azureUserInfo['mail'] . ' or ' . $azureUserInfo['mailNickname'] . ' or ' . $azureUserInfo[$azureUidKey] . '.');
throw new Exception('User not found when checking the extra fields from '.$azureUserInfo['mail'].' or '.$azureUserInfo['mailNickname'].' or '.$azureUserInfo[$azureUidKey].'.');
}
[
@ -267,7 +268,7 @@ class AzureActiveDirectory extends Plugin
);
if (!$userId) {
throw new Exception(get_lang('UserNotAdded') . ' ' . $azureUserInfo['userPrincipalName']);
throw new Exception(get_lang('UserNotAdded').' '.$azureUserInfo['userPrincipalName']);
}
return $userId;
@ -333,9 +334,7 @@ class AzureActiveDirectory extends Plugin
$groupObjectIdKey
);
} catch (Exception $e) {
throw new Exception(
'Exception when formatting user '.$azureUserInfo[$azureUidKey].' data: '.$e->getMessage()
);
throw new Exception('Exception when formatting user '.$azureUserInfo[$azureUidKey].' data: '.$e->getMessage());
}
$phone = null;

@ -7,8 +7,9 @@ use League\OAuth2\Client\Token\AccessTokenInterface;
class AzureSyncUsergroupsCommand extends AzureCommand
{
/**
* @return Generator<int, string>
* @throws Exception
*
* @return Generator<int, string>
*/
public function __invoke(): Generator
{
@ -60,8 +61,9 @@ class AzureSyncUsergroupsCommand extends AzureCommand
}
/**
* @return Generator<int, array<string, string>>
* @throws Exception
*
* @return Generator<int, array<string, string>>
*/
private function getAzureGroups(AccessTokenInterface $token): Generator
{
@ -96,19 +98,20 @@ class AzureSyncUsergroupsCommand extends AzureCommand
$hasNextLink = true;
$query = parse_url($azureGroupsRequest['@odata.nextLink'], PHP_URL_QUERY);
}
} while($hasNextLink);
} while ($hasNextLink);
}
/**
* @return Generator<int, array<string, string>>
* @throws Exception
*
* @return Generator<int, array<string, string>>
*/
private function getAzureGroupMembers(AccessTokenInterface $token, string $groupObjectId): Generator
{
$userFields = [
'mail',
'mailNickname',
'id'
'id',
];
$query = sprintf(
'$top=%d&$select=%s',

@ -7,8 +7,9 @@ use League\OAuth2\Client\Token\AccessTokenInterface;
class AzureSyncUsersCommand extends AzureCommand
{
/**
* @return Generator<int, string>
* @throws Exception
*
* @return Generator<int, string>
*/
public function __invoke(): Generator
{
@ -27,7 +28,7 @@ class AzureSyncUsersCommand extends AzureCommand
$token,
$this->provider,
$azureUserInfo,
'users/' . $azureUserInfo['id'] . '/memberOf',
'users/'.$azureUserInfo['id'].'/memberOf',
'id',
'id'
);
@ -69,8 +70,9 @@ class AzureSyncUsersCommand extends AzureCommand
}
/**
* @return Generator<int, array<string, string>>
* @throws Exception
*
* @return Generator<int, array<string, string>>
*/
private function getAzureUsers(AccessTokenInterface $token): Generator
{
@ -83,7 +85,7 @@ class AzureSyncUsersCommand extends AzureCommand
'mobilePhone',
'accountEnabled',
'mailNickname',
'id'
'id',
];
$query = sprintf(

Loading…
Cancel
Save