diff options
author | Joas Schilling <coding@schilljs.com> | 2023-11-23 10:22:34 +0100 |
---|---|---|
committer | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2023-11-23 10:36:13 +0100 |
commit | aa5f037af71c915424c6dcfd5ad2dc82797dc0d6 (patch) | |
tree | 843203cd1346158aab3515687e37a90e78c929e9 /apps/user_status/lib | |
parent | 272719ed1cba6836ea0a597bb9767754eeb1e0d4 (diff) | |
download | nextcloud-server-aa5f037af71c915424c6dcfd5ad2dc82797dc0d6.tar.gz nextcloud-server-aa5f037af71c915424c6dcfd5ad2dc82797dc0d6.zip |
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Diffstat (limited to 'apps/user_status/lib')
17 files changed, 52 insertions, 56 deletions
diff --git a/apps/user_status/lib/AppInfo/Application.php b/apps/user_status/lib/AppInfo/Application.php index 7a47fc45c95..68e5e6169ee 100644 --- a/apps/user_status/lib/AppInfo/Application.php +++ b/apps/user_status/lib/AppInfo/Application.php @@ -27,10 +27,10 @@ namespace OCA\UserStatus\AppInfo; use OCA\UserStatus\Capabilities; use OCA\UserStatus\Connector\UserStatusProvider; +use OCA\UserStatus\Dashboard\UserStatusWidget; use OCA\UserStatus\Listener\BeforeTemplateRenderedListener; use OCA\UserStatus\Listener\UserDeletedListener; use OCA\UserStatus\Listener\UserLiveStatusListener; -use OCA\UserStatus\Dashboard\UserStatusWidget; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; diff --git a/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php b/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php index 8f2ef421597..7118f748f37 100644 --- a/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php +++ b/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php @@ -47,7 +47,7 @@ class ClearOldStatusesBackgroundJob extends TimedJob { * @param UserStatusMapper $mapper */ public function __construct(ITimeFactory $time, - UserStatusMapper $mapper) { + UserStatusMapper $mapper) { parent::__construct($time); $this->mapper = $mapper; diff --git a/apps/user_status/lib/Connector/UserStatus.php b/apps/user_status/lib/Connector/UserStatus.php index ff05ded9e2b..41dd2513964 100644 --- a/apps/user_status/lib/Connector/UserStatus.php +++ b/apps/user_status/lib/Connector/UserStatus.php @@ -26,8 +26,8 @@ declare(strict_types=1); namespace OCA\UserStatus\Connector; use DateTimeImmutable; -use OCP\UserStatus\IUserStatus; use OCA\UserStatus\Db; +use OCP\UserStatus\IUserStatus; class UserStatus implements IUserStatus { diff --git a/apps/user_status/lib/Connector/UserStatusProvider.php b/apps/user_status/lib/Connector/UserStatusProvider.php index cc674c9967e..4bc2645dceb 100644 --- a/apps/user_status/lib/Connector/UserStatusProvider.php +++ b/apps/user_status/lib/Connector/UserStatusProvider.php @@ -25,9 +25,9 @@ declare(strict_types=1); */ namespace OCA\UserStatus\Connector; +use OC\UserStatus\ISettableProvider; use OCA\UserStatus\Service\StatusService; use OCP\UserStatus\IProvider; -use OC\UserStatus\ISettableProvider; class UserStatusProvider implements IProvider, ISettableProvider { diff --git a/apps/user_status/lib/ContactsMenu/StatusProvider.php b/apps/user_status/lib/ContactsMenu/StatusProvider.php index f1316f02df8..7eb0d7a41e1 100644 --- a/apps/user_status/lib/ContactsMenu/StatusProvider.php +++ b/apps/user_status/lib/ContactsMenu/StatusProvider.php @@ -46,7 +46,7 @@ class StatusProvider implements IBulkProvider { $statuses = $this->statusService->findByUserIds($uids); /** @var array<string, UserStatus> $indexed */ $indexed = array_combine( - array_map(fn(UserStatus $status) => $status->getUserId(), $statuses), + array_map(fn (UserStatus $status) => $status->getUserId(), $statuses), $statuses ); diff --git a/apps/user_status/lib/Controller/HeartbeatController.php b/apps/user_status/lib/Controller/HeartbeatController.php index c2b1ed57f01..79e12902495 100644 --- a/apps/user_status/lib/Controller/HeartbeatController.php +++ b/apps/user_status/lib/Controller/HeartbeatController.php @@ -29,8 +29,6 @@ namespace OCA\UserStatus\Controller; use OCA\UserStatus\Db\UserStatus; use OCA\UserStatus\ResponseDefinitions; use OCA\UserStatus\Service\StatusService; -use OCP\AppFramework\Controller; -use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; @@ -59,11 +57,11 @@ class HeartbeatController extends OCSController { private $service; public function __construct(string $appName, - IRequest $request, - IEventDispatcher $eventDispatcher, - IUserSession $userSession, - ITimeFactory $timeFactory, - StatusService $service) { + IRequest $request, + IEventDispatcher $eventDispatcher, + IUserSession $userSession, + ITimeFactory $timeFactory, + StatusService $service) { parent::__construct($appName, $request); $this->eventDispatcher = $eventDispatcher; $this->userSession = $userSession; diff --git a/apps/user_status/lib/Controller/PredefinedStatusController.php b/apps/user_status/lib/Controller/PredefinedStatusController.php index ec78fedbc0b..99acdca9f79 100644 --- a/apps/user_status/lib/Controller/PredefinedStatusController.php +++ b/apps/user_status/lib/Controller/PredefinedStatusController.php @@ -51,8 +51,8 @@ class PredefinedStatusController extends OCSController { * @param PredefinedStatusService $predefinedStatusService */ public function __construct(string $appName, - IRequest $request, - PredefinedStatusService $predefinedStatusService) { + IRequest $request, + PredefinedStatusService $predefinedStatusService) { parent::__construct($appName, $request); $this->predefinedStatusService = $predefinedStatusService; } diff --git a/apps/user_status/lib/Controller/StatusesController.php b/apps/user_status/lib/Controller/StatusesController.php index 9e2bea8ff2f..ff9008d1b70 100644 --- a/apps/user_status/lib/Controller/StatusesController.php +++ b/apps/user_status/lib/Controller/StatusesController.php @@ -54,8 +54,8 @@ class StatusesController extends OCSController { * @param StatusService $service */ public function __construct(string $appName, - IRequest $request, - StatusService $service) { + IRequest $request, + StatusService $service) { parent::__construct($appName, $request); $this->service = $service; } diff --git a/apps/user_status/lib/Controller/UserStatusController.php b/apps/user_status/lib/Controller/UserStatusController.php index 5f0647563ca..f2b1537e4f7 100644 --- a/apps/user_status/lib/Controller/UserStatusController.php +++ b/apps/user_status/lib/Controller/UserStatusController.php @@ -115,7 +115,7 @@ class UserStatusController extends OCSController { * 200: The message was updated successfully */ public function setPredefinedMessage(string $messageId, - ?int $clearAt): DataResponse { + ?int $clearAt): DataResponse { try { $status = $this->service->setPredefinedMessage($this->userId, $messageId, $clearAt); $this->service->removeBackupUserStatus($this->userId); @@ -143,8 +143,8 @@ class UserStatusController extends OCSController { * 200: The message was updated successfully */ public function setCustomMessage(?string $statusIcon, - ?string $message, - ?int $clearAt): DataResponse { + ?string $message, + ?int $clearAt): DataResponse { try { if (($message !== null && $message !== '') || ($clearAt !== null && $clearAt !== 0)) { $status = $this->service->setCustomMessage($this->userId, $statusIcon, $message, $clearAt); diff --git a/apps/user_status/lib/Dashboard/UserStatusWidget.php b/apps/user_status/lib/Dashboard/UserStatusWidget.php index 6c0dd356730..127f95d0a0e 100644 --- a/apps/user_status/lib/Dashboard/UserStatusWidget.php +++ b/apps/user_status/lib/Dashboard/UserStatusWidget.php @@ -31,7 +31,6 @@ use OCA\UserStatus\Db\UserStatus; use OCA\UserStatus\Service\StatusService; use OCP\AppFramework\Services\IInitialState; use OCP\Dashboard\IAPIWidget; -use OCP\Dashboard\IButtonWidget; use OCP\Dashboard\IAPIWidgetV2; use OCP\Dashboard\IIconWidget; use OCP\Dashboard\IOptionWidget; @@ -44,7 +43,6 @@ use OCP\IURLGenerator; use OCP\IUserManager; use OCP\IUserSession; use OCP\UserStatus\IUserStatus; -use OCP\Util; /** * Class UserStatusWidget @@ -72,12 +70,12 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption * @param StatusService $service */ public function __construct(IL10N $l10n, - IDateTimeFormatter $dateTimeFormatter, - IURLGenerator $urlGenerator, - IInitialState $initialStateService, - IUserManager $userManager, - IUserSession $userSession, - StatusService $service) { + IDateTimeFormatter $dateTimeFormatter, + IURLGenerator $urlGenerator, + IInitialState $initialStateService, + IUserManager $userManager, + IUserSession $userSession, + StatusService $service) { $this->l10n = $l10n; $this->dateTimeFormatter = $dateTimeFormatter; $this->urlGenerator = $urlGenerator; @@ -176,7 +174,7 @@ class UserStatusWidget implements IAPIWidget, IAPIWidgetV2, IIconWidget, IOption public function getItems(string $userId, ?string $since = null, int $limit = 7): array { $widgetItemsData = $this->getWidgetData($userId, $since, $limit); - return array_map(function(array $widgetData) { + return array_map(function (array $widgetData) { $formattedDate = $this->dateTimeFormatter->formatTimeSpan($widgetData['timestamp']); return new WidgetItem( $widgetData['displayName'], diff --git a/apps/user_status/lib/Db/UserStatusMapper.php b/apps/user_status/lib/Db/UserStatusMapper.php index c8ffcca5ad9..febee32c821 100644 --- a/apps/user_status/lib/Db/UserStatusMapper.php +++ b/apps/user_status/lib/Db/UserStatusMapper.php @@ -26,11 +26,11 @@ declare(strict_types=1); namespace OCA\UserStatus\Db; -use Sabre\CalDAV\Schedule\Plugin; use OCP\AppFramework\Db\QBMapper; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\UserStatus\IUserStatus; +use Sabre\CalDAV\Schedule\Plugin; /** * @template-extends QBMapper<UserStatus> diff --git a/apps/user_status/lib/Listener/UserDeletedListener.php b/apps/user_status/lib/Listener/UserDeletedListener.php index 0cacc89971a..2840ab0ef39 100644 --- a/apps/user_status/lib/Listener/UserDeletedListener.php +++ b/apps/user_status/lib/Listener/UserDeletedListener.php @@ -26,8 +26,8 @@ declare(strict_types=1); namespace OCA\UserStatus\Listener; use OCA\UserStatus\Service\StatusService; -use OCP\EventDispatcher\IEventListener; use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; use OCP\User\Events\UserDeletedEvent; /** diff --git a/apps/user_status/lib/Listener/UserLiveStatusListener.php b/apps/user_status/lib/Listener/UserLiveStatusListener.php index 687e01fc3a7..0d0e6e3ebf0 100644 --- a/apps/user_status/lib/Listener/UserLiveStatusListener.php +++ b/apps/user_status/lib/Listener/UserLiveStatusListener.php @@ -25,14 +25,14 @@ declare(strict_types=1); */ namespace OCA\UserStatus\Listener; -use OCA\UserStatus\Db\UserStatus; use OCA\UserStatus\Connector\UserStatus as ConnectorUserStatus; +use OCA\UserStatus\Db\UserStatus; use OCA\UserStatus\Db\UserStatusMapper; use OCA\UserStatus\Service\StatusService; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\EventDispatcher\IEventListener; use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; use OCP\User\Events\UserLiveStatusEvent; use OCP\UserStatus\IUserStatus; @@ -47,8 +47,8 @@ class UserLiveStatusListener implements IEventListener { private ITimeFactory $timeFactory; public function __construct(UserStatusMapper $mapper, - StatusService $statusService, - ITimeFactory $timeFactory) { + StatusService $statusService, + ITimeFactory $timeFactory) { $this->mapper = $mapper; $this->statusService = $statusService; $this->timeFactory = $timeFactory; diff --git a/apps/user_status/lib/Migration/Version0001Date20200602134824.php b/apps/user_status/lib/Migration/Version0001Date20200602134824.php index 64490cc4207..11e9f8261a4 100644 --- a/apps/user_status/lib/Migration/Version0001Date20200602134824.php +++ b/apps/user_status/lib/Migration/Version0001Date20200602134824.php @@ -27,8 +27,8 @@ declare(strict_types=1); */ namespace OCA\UserStatus\Migration; -use OCP\DB\Types; use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; diff --git a/apps/user_status/lib/ResponseDefinitions.php b/apps/user_status/lib/ResponseDefinitions.php index 2c20bd9f126..f73e5f3b0d9 100644 --- a/apps/user_status/lib/ResponseDefinitions.php +++ b/apps/user_status/lib/ResponseDefinitions.php @@ -1,4 +1,5 @@ <?php + declare(strict_types=1); /** diff --git a/apps/user_status/lib/Service/JSDataService.php b/apps/user_status/lib/Service/JSDataService.php index c08643ec64f..443389b7192 100644 --- a/apps/user_status/lib/Service/JSDataService.php +++ b/apps/user_status/lib/Service/JSDataService.php @@ -44,7 +44,7 @@ class JSDataService implements \JsonSerializable { * @param StatusService $statusService */ public function __construct(IUserSession $userSession, - StatusService $statusService) { + StatusService $statusService) { $this->userSession = $userSession; $this->statusService = $statusService; } diff --git a/apps/user_status/lib/Service/StatusService.php b/apps/user_status/lib/Service/StatusService.php index 99fafaa6426..829c6c58570 100644 --- a/apps/user_status/lib/Service/StatusService.php +++ b/apps/user_status/lib/Service/StatusService.php @@ -38,7 +38,6 @@ use OCA\UserStatus\Exception\InvalidStatusTypeException; use OCA\UserStatus\Exception\StatusMessageTooLongException; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\Calendar\ISchedulingInformation; use OCP\DB\Exception; use OCP\IConfig; use OCP\IEmojiHelper; @@ -86,12 +85,12 @@ class StatusService { public const MAXIMUM_MESSAGE_LENGTH = 80; public function __construct(private UserStatusMapper $mapper, - private ITimeFactory $timeFactory, - private PredefinedStatusService $predefinedStatusService, - private IEmojiHelper $emojiHelper, - private IConfig $config, - private IUserManager $userManager, - private CalendarStatusService $calendarStatusService) { + private ITimeFactory $timeFactory, + private PredefinedStatusService $predefinedStatusService, + private IEmojiHelper $emojiHelper, + private IConfig $config, + private IUserManager $userManager, + private CalendarStatusService $calendarStatusService) { $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; $this->shareeEnumerationInGroupOnly = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes'; $this->shareeEnumerationPhone = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_phone', 'no') === 'yes'; @@ -190,9 +189,9 @@ class StatusService { * @throws InvalidStatusTypeException */ public function setStatus(string $userId, - string $status, - ?int $statusTimestamp, - bool $isUserDefined): UserStatus { + string $status, + ?int $statusTimestamp, + bool $isUserDefined): UserStatus { try { $userStatus = $this->mapper->findByUserId($userId); } catch (DoesNotExistException $ex) { @@ -232,8 +231,8 @@ class StatusService { * @throws InvalidClearAtException */ public function setPredefinedMessage(string $userId, - string $messageId, - ?int $clearAt): UserStatus { + string $messageId, + ?int $clearAt): UserStatus { try { $userStatus = $this->mapper->findByUserId($userId); } catch (DoesNotExistException $ex) { @@ -276,10 +275,10 @@ class StatusService { * @throws InvalidMessageIdException */ public function setUserStatus(string $userId, - string $status, - string $messageId, - bool $createBackup, - string $customMessage = null): ?UserStatus { + string $status, + string $messageId, + bool $createBackup, + string $customMessage = null): ?UserStatus { // Check if status-type is valid if (!in_array($status, self::PRIORITY_ORDERED_STATUSES, true)) { throw new InvalidStatusTypeException('Status-type "' . $status . '" is not supported'); @@ -339,9 +338,9 @@ class StatusService { * @throws StatusMessageTooLongException */ public function setCustomMessage(string $userId, - ?string $statusIcon, - ?string $message, - ?int $clearAt): UserStatus { + ?string $statusIcon, + ?string $message, + ?int $clearAt): UserStatus { try { $userStatus = $this->mapper->findByUserId($userId); } catch (DoesNotExistException $ex) { @@ -569,7 +568,7 @@ class StatusService { if (!$userStatus->getIsBackup() && $userStatus->getMessageId() === $messageId) { $statuesToDelete[$userStatus->getUserId()] = $userStatus->getId(); - } else if ($userStatus->getIsBackup()) { + } elseif ($userStatus->getIsBackup()) { $backups[$userStatus->getUserId()] = $userStatus->getId(); } } |