From 84d42604e60aa1c31ecf698dcc069f36c494148a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 12 May 2020 15:04:42 +0200 Subject: Run cs:fix Signed-off-by: Joas Schilling --- lib/Activity/Listener.php | 7 +-- lib/Activity/Provider/Base.php | 1 + lib/Activity/Provider/Call.php | 2 +- lib/Activity/Provider/Invitation.php | 2 +- lib/Activity/Setting.php | 3 +- lib/AppInfo/Application.php | 11 ++-- lib/BackgroundJob/ExpireSignalingMessage.php | 1 + lib/BackgroundJob/RemoveEmptyRooms.php | 1 + lib/BackgroundJob/ResetAssignedSignalingServer.php | 1 + lib/Capabilities.php | 1 + lib/Chat/AutoComplete/SearchPlugin.php | 2 +- lib/Chat/AutoComplete/Sorter.php | 8 +-- lib/Chat/Changelog/Listener.php | 4 +- lib/Chat/Changelog/Manager.php | 2 +- lib/Chat/ChatManager.php | 2 +- lib/Chat/Command/Executor.php | 7 ++- lib/Chat/Command/Listener.php | 4 +- lib/Chat/Command/ShellExecutor.php | 3 +- lib/Chat/CommentsManager.php | 2 +- lib/Chat/MessageParser.php | 7 ++- lib/Chat/Notifier.php | 2 +- lib/Chat/Parser/Changelog.php | 2 +- lib/Chat/Parser/Command.php | 1 + lib/Chat/Parser/Listener.php | 10 ++-- lib/Chat/Parser/SystemMessage.php | 60 +++++++++++----------- lib/Chat/Parser/UserMention.php | 3 +- lib/Chat/SystemMessage/Listener.php | 40 +++++++-------- lib/Collaboration/Collaborators/Listener.php | 4 +- lib/Collaboration/Collaborators/RoomPlugin.php | 2 +- .../Resources/ConversationProvider.php | 7 +-- lib/Collaboration/Resources/Listener.php | 12 ++--- lib/Command/Command/Add.php | 3 +- lib/Command/Command/AddSamples.php | 4 +- lib/Command/Command/Delete.php | 1 + lib/Command/Command/ListCommand.php | 2 +- lib/Command/Command/TRenderCommand.php | 5 +- lib/Command/Command/Update.php | 2 +- lib/Command/Room/Add.php | 1 + lib/Command/Room/Create.php | 1 + lib/Command/Room/Delete.php | 1 + lib/Command/Room/Demote.php | 1 + lib/Command/Room/Promote.php | 1 + lib/Command/Room/Remove.php | 1 + lib/Command/Room/TRoomCommand.php | 4 +- lib/Command/Room/Update.php | 1 + lib/Command/Signaling/Add.php | 1 + lib/Command/Signaling/Delete.php | 3 +- lib/Command/Signaling/ListCommand.php | 2 +- lib/Command/Stun/Add.php | 1 + lib/Command/Stun/Delete.php | 3 +- lib/Command/Stun/ListCommand.php | 2 +- lib/Command/Turn/Add.php | 1 + lib/Command/Turn/Delete.php | 3 +- lib/Command/Turn/ListCommand.php | 2 +- lib/Config.php | 9 ++-- lib/ContactsMenu/Providers/CallProvider.php | 4 +- lib/Controller/AEnvironmentAwareController.php | 2 +- lib/Controller/CallController.php | 2 +- lib/Controller/ChatController.php | 10 ++-- lib/Controller/CommandController.php | 2 +- lib/Controller/FilesIntegrationController.php | 2 +- lib/Controller/GuestController.php | 2 +- lib/Controller/PageController.php | 4 +- lib/Controller/PublicShareAuthController.php | 1 + lib/Controller/RoomController.php | 18 +++---- lib/Controller/SettingsController.php | 1 + lib/Controller/SignalingController.php | 13 ++--- lib/Controller/WebinarController.php | 1 + lib/Events/AddEmailEvent.php | 2 +- lib/Events/AddParticipantsEvent.php | 2 +- lib/Events/ChatEvent.php | 2 +- lib/Events/ChatMessageEvent.php | 2 +- lib/Events/ChatParticipantEvent.php | 2 +- lib/Events/CommandEvent.php | 2 +- lib/Events/CreateRoomTokenEvent.php | 3 +- lib/Events/JoinRoomGuestEvent.php | 3 +- lib/Events/JoinRoomUserEvent.php | 3 +- lib/Events/ModifyLobbyEvent.php | 3 +- lib/Events/ModifyParticipantEvent.php | 2 +- lib/Events/ModifyRoomEvent.php | 2 +- lib/Events/ParticipantEvent.php | 2 +- lib/Events/RemoveParticipantEvent.php | 2 +- lib/Events/RemoveUserEvent.php | 2 +- lib/Events/RoomEvent.php | 2 +- lib/Events/SignalingEvent.php | 2 +- lib/Events/SignalingRoomPropertiesEvent.php | 2 +- lib/Events/UserEvent.php | 2 +- lib/Events/VerifyRoomPasswordEvent.php | 2 +- lib/Exceptions/ForbiddenException.php | 2 +- lib/Exceptions/InvalidPasswordException.php | 2 +- lib/Exceptions/ParticipantNotFoundException.php | 2 +- lib/Exceptions/RoomNotFoundException.php | 2 +- lib/Exceptions/UnauthorizedException.php | 2 +- lib/Files/Listener.php | 8 +-- lib/Files/TemplateLoader.php | 3 +- lib/Files/Util.php | 6 +-- lib/Flow/Operation.php | 17 +++--- lib/GuestManager.php | 3 +- lib/Listener.php | 3 +- lib/Listener/CSPListener.php | 2 +- lib/Listener/FeaturePolicyListener.php | 3 +- lib/Listener/RestrictStartingCalls.php | 4 +- lib/Manager.php | 4 +- lib/Middleware/CanUseTalkMiddleware.php | 1 + .../Exceptions/CanNotUseTalkException.php | 1 + lib/Middleware/Exceptions/LobbyException.php | 1 + .../Exceptions/NotAModeratorException.php | 1 + lib/Middleware/Exceptions/ReadOnlyException.php | 1 + lib/Middleware/InjectionMiddleware.php | 1 + lib/Migration/ClearResourceAccessCache.php | 2 +- lib/Migration/FixNamespaceInDatabaseTables.php | 2 +- lib/Migration/Version2000Date20170707093535.php | 2 +- lib/Migration/Version2000Date20171026140256.php | 3 +- lib/Migration/Version2000Date20171026140257.php | 3 +- lib/Migration/Version2001Date20170707115443.php | 2 +- lib/Migration/Version2001Date20170913104501.php | 2 +- lib/Migration/Version2001Date20170921145301.php | 2 +- lib/Migration/Version2001Date20170929092606.php | 1 + lib/Migration/Version2001Date20171009132424.php | 2 +- lib/Migration/Version2001Date20171026134605.php | 9 +--- lib/Migration/Version2001Date20171026141336.php | 1 + lib/Migration/Version2001Date20171031102049.php | 2 +- lib/Migration/Version2001Date20180103144447.php | 3 +- lib/Migration/Version2001Date20180103150836.php | 1 + lib/Migration/Version3002Date20180319104030.php | 1 + lib/Migration/Version3003Date20180707222130.php | 1 + lib/Migration/Version3003Date20180718112436.php | 3 +- lib/Migration/Version3003Date20180718133519.php | 1 + lib/Migration/Version3003Date20180720162342.php | 1 + lib/Migration/Version3003Date20180722152733.php | 2 +- lib/Migration/Version3003Date20180722152849.php | 1 + lib/Migration/Version3003Date20180730080327.php | 1 + lib/Migration/Version4099Date20181001123058.php | 1 + lib/Migration/Version5099Date20190121102337.php | 1 + lib/Migration/Version5099Date20190319134820.php | 2 +- lib/Migration/Version7000Date20190717141457.php | 1 + lib/Migration/Version7000Date20190724121136.php | 1 + lib/Migration/Version8000Date20200331144101.php | 2 +- lib/Migration/Version8000Date20200402124456.php | 2 +- lib/Migration/Version8000Date20200407073807.php | 2 +- lib/Migration/Version8000Date20200407115318.php | 1 + lib/Model/Command.php | 2 +- lib/Model/CommandMapper.php | 1 + lib/Model/Message.php | 3 +- lib/Notification/Listener.php | 15 +++--- lib/Notification/Notifier.php | 39 +++++++------- lib/Participant.php | 1 + lib/PublicShare/TemplateLoader.php | 5 +- lib/PublicShareAuth/Listener.php | 9 ++-- lib/PublicShareAuth/TemplateLoader.php | 5 +- lib/Room.php | 3 +- lib/Service/CommandService.php | 2 +- lib/Settings/Admin/AdminSettings.php | 5 +- lib/Settings/Admin/Section.php | 2 +- lib/Settings/Personal.php | 2 +- lib/Share/Helper/DeletedShareAPIController.php | 4 +- lib/Share/Helper/ShareAPIController.php | 3 +- lib/Share/Listener.php | 2 +- lib/Share/RoomShareProvider.php | 25 +++++---- lib/Signaling/BackendNotifier.php | 4 +- lib/Signaling/Listener.php | 32 ++++++------ lib/Signaling/Manager.php | 2 +- lib/Signaling/Messages.php | 2 +- lib/TInitialState.php | 4 +- lib/TalkSession.php | 3 +- lib/Webinary.php | 4 +- 166 files changed, 341 insertions(+), 343 deletions(-) (limited to 'lib') diff --git a/lib/Activity/Listener.php b/lib/Activity/Listener.php index 53c4c13c9..6a17d78f6 100644 --- a/lib/Activity/Listener.php +++ b/lib/Activity/Listener.php @@ -1,4 +1,5 @@ @@ -64,14 +65,14 @@ class Listener { } public static function register(IEventDispatcher $dispatcher): void { - $listener = static function(ModifyParticipantEvent $event) { + $listener = static function (ModifyParticipantEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->setActive($event->getRoom()); }; $dispatcher->addListener(Room::EVENT_AFTER_SESSION_JOIN_CALL, $listener); - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->generateCallActivity($event->getRoom()); @@ -81,7 +82,7 @@ class Listener { $dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $listener, -100); $dispatcher->addListener(Room::EVENT_AFTER_ROOM_DISCONNECT, $listener, -100); - $listener = static function(AddParticipantsEvent $event) { + $listener = static function (AddParticipantsEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->generateInvitationActivity($event->getRoom(), $event->getParticipants()); diff --git a/lib/Activity/Provider/Base.php b/lib/Activity/Provider/Base.php index 857cc9a54..1aa7c7b03 100644 --- a/lib/Activity/Provider/Base.php +++ b/lib/Activity/Provider/Base.php @@ -1,4 +1,5 @@ diff --git a/lib/Activity/Provider/Call.php b/lib/Activity/Provider/Call.php index b67f694d4..3a134ccd0 100644 --- a/lib/Activity/Provider/Call.php +++ b/lib/Activity/Provider/Call.php @@ -1,4 +1,5 @@ @@ -146,5 +147,4 @@ class Call extends Base { 'params' => $params, ]; } - } diff --git a/lib/Activity/Provider/Invitation.php b/lib/Activity/Provider/Invitation.php index 251f21ef6..33ff9becf 100644 --- a/lib/Activity/Provider/Invitation.php +++ b/lib/Activity/Provider/Invitation.php @@ -1,4 +1,5 @@ @@ -59,5 +60,4 @@ class Invitation extends Base { return $event; } - } diff --git a/lib/Activity/Setting.php b/lib/Activity/Setting.php index df20ba047..e913f4e15 100644 --- a/lib/Activity/Setting.php +++ b/lib/Activity/Setting.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Activity; - use OCP\Activity\ISetting; use OCP\IL10N; @@ -93,4 +93,3 @@ class Setting implements ISetting { return false; } } - diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index fcdff6582..3b2e7e856 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -1,4 +1,5 @@ @@ -62,10 +63,8 @@ use OCP\Security\CSP\AddContentSecurityPolicyEvent; use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent; use OCP\Settings\IManager; - class Application extends App { - - const APP_ID = 'spreed'; + public const APP_ID = 'spreed'; public function __construct(array $urlParams = []) { parent::__construct(self::APP_ID, $urlParams); @@ -139,7 +138,7 @@ class Application extends App { } protected function registerNavigationLink(IServerContainer $server): void { - $server->getNavigationManager()->add(function() use ($server) { + $server->getNavigationManager()->add(function () use ($server) { /** @var Config $config */ $config = $server->query(Config::class); $user = $server->getUserSession()->getUser(); @@ -155,7 +154,7 @@ class Application extends App { } protected function registerRoomActivityHooks(IEventDispatcher $dispatcher): void { - $listener = function(ChatEvent $event) { + $listener = function (ChatEvent $event) { $room = $event->getRoom(); /** @var ITimeFactory $timeFactory */ $timeFactory = $this->getContainer()->query(ITimeFactory::class); @@ -167,7 +166,7 @@ class Application extends App { } protected function registerChatHooks(IEventDispatcher $dispatcher): void { - $listener = function(RoomEvent $event) { + $listener = function (RoomEvent $event) { /** @var ChatManager $chatManager */ $chatManager = $this->getContainer()->query(ChatManager::class); $chatManager->deleteMessages($event->getRoom()); diff --git a/lib/BackgroundJob/ExpireSignalingMessage.php b/lib/BackgroundJob/ExpireSignalingMessage.php index f5661d690..656875d08 100644 --- a/lib/BackgroundJob/ExpireSignalingMessage.php +++ b/lib/BackgroundJob/ExpireSignalingMessage.php @@ -1,4 +1,5 @@ diff --git a/lib/BackgroundJob/RemoveEmptyRooms.php b/lib/BackgroundJob/RemoveEmptyRooms.php index 592a59a8e..3802a12af 100644 --- a/lib/BackgroundJob/RemoveEmptyRooms.php +++ b/lib/BackgroundJob/RemoveEmptyRooms.php @@ -1,4 +1,5 @@ diff --git a/lib/BackgroundJob/ResetAssignedSignalingServer.php b/lib/BackgroundJob/ResetAssignedSignalingServer.php index f62882c63..2f657a748 100644 --- a/lib/BackgroundJob/ResetAssignedSignalingServer.php +++ b/lib/BackgroundJob/ResetAssignedSignalingServer.php @@ -1,4 +1,5 @@ diff --git a/lib/Capabilities.php b/lib/Capabilities.php index caa5f86c3..5e2f15f6d 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -1,4 +1,5 @@ diff --git a/lib/Chat/AutoComplete/SearchPlugin.php b/lib/Chat/AutoComplete/SearchPlugin.php index 64d74172a..c429fee4f 100644 --- a/lib/Chat/AutoComplete/SearchPlugin.php +++ b/lib/Chat/AutoComplete/SearchPlugin.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Chat\AutoComplete; - use OCA\Talk\Files\Util; use OCA\Talk\GuestManager; use OCA\Talk\Room; diff --git a/lib/Chat/AutoComplete/Sorter.php b/lib/Chat/AutoComplete/Sorter.php index 2d35d5f49..e9994e19c 100644 --- a/lib/Chat/AutoComplete/Sorter.php +++ b/lib/Chat/AutoComplete/Sorter.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Chat\AutoComplete; - use OCA\Talk\Chat\CommentsManager; use OCP\Collaboration\AutoComplete\ISorter; @@ -62,9 +62,9 @@ class Sorter implements ISorter { $context['itemId'], 'comment', $type, - array_map(function($suggestion) { + array_map(function ($suggestion) { return $suggestion['value']['shareWith']; - }, $byType)); + }, $byType)); $search = $context['search']; @@ -75,7 +75,7 @@ class Sorter implements ISorter { if (stripos($b['label'], $search) !== 0) { return -1; } - } else if (stripos($b['label'], $search) === 0) { + } elseif (stripos($b['label'], $search) === 0) { return 1; } } diff --git a/lib/Chat/Changelog/Listener.php b/lib/Chat/Changelog/Listener.php index 8ce066b27..c89e9fda0 100644 --- a/lib/Chat/Changelog/Listener.php +++ b/lib/Chat/Changelog/Listener.php @@ -1,4 +1,5 @@ @@ -27,9 +28,8 @@ use OCA\Talk\Events\UserEvent; use OCP\EventDispatcher\IEventDispatcher; class Listener { - public static function register(IEventDispatcher $dispatcher): void { - $dispatcher->addListener(RoomController::EVENT_BEFORE_ROOMS_GET, static function(UserEvent $event) { + $dispatcher->addListener(RoomController::EVENT_BEFORE_ROOMS_GET, static function (UserEvent $event) { $userId = $event->getUserId(); /** @var Listener $listener */ diff --git a/lib/Chat/Changelog/Manager.php b/lib/Chat/Changelog/Manager.php index 6b3371289..04b45fbcf 100644 --- a/lib/Chat/Changelog/Manager.php +++ b/lib/Chat/Changelog/Manager.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Chat\Changelog; - use OCA\Talk\Chat\ChatManager; use OCA\Talk\Manager as RoomManager; use OCP\AppFramework\Utility\ITimeFactory; diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php index aa704f5ef..56568af6f 100644 --- a/lib/Chat/ChatManager.php +++ b/lib/Chat/ChatManager.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Chat\Command; - use OCA\Talk\Chat\ChatManager; use OCA\Talk\Events\CommandEvent; use OCA\Talk\Model\Command; @@ -35,7 +35,6 @@ use OCP\IL10N; use OCP\ILogger; class Executor { - public const EVENT_APP_EXECUTE = self::class . '::execApp'; public const PLACEHOLDER_ROOM = '{ROOM}'; @@ -87,9 +86,9 @@ class Executor { if ($command->getApp() === '' && $command->getCommand() === 'help') { $output = $this->execHelp($room, $message, $arguments); - } else if ($command->getApp() !== '') { + } elseif ($command->getApp() !== '') { $output = $this->execApp($room, $message, $command, $arguments); - } else { + } else { $output = $this->execShell($room, $message, $command, $arguments); } diff --git a/lib/Chat/Command/Listener.php b/lib/Chat/Command/Listener.php index cb370dbf6..165141e16 100644 --- a/lib/Chat/Command/Listener.php +++ b/lib/Chat/Command/Listener.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Chat\Command; - use OCA\Talk\Chat\ChatManager; use OCA\Talk\Events\ChatParticipantEvent; use OCA\Talk\Model\Command; @@ -44,7 +44,7 @@ class Listener { } public static function register(IEventDispatcher $dispatcher): void { - $dispatcher->addListener(ChatManager::EVENT_BEFORE_MESSAGE_SEND, static function(ChatParticipantEvent $event) { + $dispatcher->addListener(ChatManager::EVENT_BEFORE_MESSAGE_SEND, static function (ChatParticipantEvent $event) { $message = $event->getComment(); $participant = $event->getParticipant(); diff --git a/lib/Chat/Command/ShellExecutor.php b/lib/Chat/Command/ShellExecutor.php index 40515c708..605732384 100644 --- a/lib/Chat/Command/ShellExecutor.php +++ b/lib/Chat/Command/ShellExecutor.php @@ -1,4 +1,5 @@ @@ -22,9 +23,7 @@ declare(strict_types=1); namespace OCA\Talk\Chat\Command; - class ShellExecutor { - public const PLACEHOLDER_ROOM = '{ROOM}'; public const PLACEHOLDER_USER = '{USER}'; public const PLACEHOLDER_ARGUMENTS = '{ARGUMENTS}'; diff --git a/lib/Chat/CommentsManager.php b/lib/Chat/CommentsManager.php index ee6df07f2..287299d29 100644 --- a/lib/Chat/CommentsManager.php +++ b/lib/Chat/CommentsManager.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Chat; - use OC\Comments\Comment; use OC\Comments\Manager; use OCP\AppFramework\Utility\ITimeFactory; diff --git a/lib/Chat/MessageParser.php b/lib/Chat/MessageParser.php index ba46c718b..176be751e 100644 --- a/lib/Chat/MessageParser.php +++ b/lib/Chat/MessageParser.php @@ -1,4 +1,5 @@ getActorType() === 'users') { $user = $this->userManager->get($comment->getActorId()); $displayName = $user instanceof IUser ? $user->getDisplayName() : $comment->getActorId(); - } else if ($comment->getActorType() === 'guests') { + } elseif ($comment->getActorType() === 'guests') { if (isset($guestNames[$comment->getActorId()])) { $displayName = $this->guestNames[$comment->getActorId()]; } else { @@ -93,7 +92,7 @@ class MessageParser { } $this->guestNames[$comment->getActorId()] = $displayName; } - } else if ($comment->getActorType() === 'bots') { + } elseif ($comment->getActorType() === 'bots') { $displayName = $comment->getActorId() . '-bot'; } diff --git a/lib/Chat/Notifier.php b/lib/Chat/Notifier.php index 467e5e2f7..f381a55bb 100644 --- a/lib/Chat/Notifier.php +++ b/lib/Chat/Notifier.php @@ -1,4 +1,5 @@ @@ -31,7 +32,6 @@ class Changelog { * @throws \OutOfBoundsException */ public function parseMessage(Message $chatMessage): void { - if ($chatMessage->getActorType() !== 'guests' || $chatMessage->getActorId() !== 'changelog') { throw new \OutOfBoundsException('Not a changelog'); diff --git a/lib/Chat/Parser/Command.php b/lib/Chat/Parser/Command.php index f680469aa..4e093c269 100644 --- a/lib/Chat/Parser/Command.php +++ b/lib/Chat/Parser/Command.php @@ -1,4 +1,5 @@ diff --git a/lib/Chat/Parser/Listener.php b/lib/Chat/Parser/Listener.php index fbda032e6..2cb2fac3a 100644 --- a/lib/Chat/Parser/Listener.php +++ b/lib/Chat/Parser/Listener.php @@ -1,4 +1,5 @@ @@ -28,9 +29,8 @@ use OCA\Talk\Events\ChatMessageEvent; use OCP\EventDispatcher\IEventDispatcher; class Listener { - public static function register(IEventDispatcher $dispatcher): void { - $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function(ChatMessageEvent $event) { + $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function (ChatMessageEvent $event) { $message = $event->getMessage(); if ($message->getMessageType() !== 'comment') { @@ -42,7 +42,7 @@ class Listener { $parser->parseMessage($message); }, -100); - $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function(ChatMessageEvent $event) { + $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function (ChatMessageEvent $event) { $message = $event->getMessage(); if ($message->getMessageType() !== 'comment') { @@ -59,7 +59,7 @@ class Listener { } }, -75); - $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function(ChatMessageEvent $event) { + $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function (ChatMessageEvent $event) { $message = $event->getMessage(); if ($message->getMessageType() !== 'system') { @@ -77,7 +77,7 @@ class Listener { } }); - $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function(ChatMessageEvent $event) { + $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function (ChatMessageEvent $event) { $chatMessage = $event->getMessage(); if ($chatMessage->getMessageType() !== 'command') { diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index be3972ff5..222ac8d9c 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -1,4 +1,5 @@ @@ -22,13 +23,10 @@ declare(strict_types=1); namespace OCA\Talk\Chat\Parser; - -use OCA\Talk\Chat\ChatManager; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\GuestManager; use OCA\Talk\Model\Message; use OCA\Talk\Participant; -use OCA\Talk\Room; use OCA\Talk\Share\RoomShareProvider; use OCP\Comments\IComment; use OCP\Files\IRootFolder; @@ -106,71 +104,71 @@ class SystemMessage { if ($currentUserIsActor) { $parsedMessage = $this->l->t('You created the conversation'); } - } else if ($message === 'conversation_renamed') { + } elseif ($message === 'conversation_renamed') { $parsedMessage = $this->l->t('{actor} renamed the conversation from "%1$s" to "%2$s"', [$parameters['oldName'], $parameters['newName']]); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You renamed the conversation from "%1$s" to "%2$s"', [$parameters['oldName'], $parameters['newName']]); } - } else if ($message === 'call_started') { + } elseif ($message === 'call_started') { $parsedMessage = $this->l->t('{actor} started a call'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You started a call'); } - } else if ($message === 'call_joined') { + } elseif ($message === 'call_joined') { $parsedMessage = $this->l->t('{actor} joined the call'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You joined the call'); } - } else if ($message === 'call_left') { + } elseif ($message === 'call_left') { $parsedMessage = $this->l->t('{actor} left the call'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You left the call'); } - } else if ($message === 'call_ended') { + } elseif ($message === 'call_ended') { [$parsedMessage, $parsedParameters] = $this->parseCall($parameters); - } else if ($message === 'read_only_off') { + } elseif ($message === 'read_only_off') { $parsedMessage = $this->l->t('{actor} unlocked the conversation'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You unlocked the conversation'); } - } else if ($message === 'read_only') { + } elseif ($message === 'read_only') { $parsedMessage = $this->l->t('{actor} locked the conversation'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You locked the conversation'); } - } else if ($message === 'lobby_timer_reached') { + } elseif ($message === 'lobby_timer_reached') { $parsedMessage = $this->l->t('The conversation is now open to everyone'); - } else if ($message === 'lobby_none') { + } elseif ($message === 'lobby_none') { $parsedMessage = $this->l->t('{actor} opened the conversation to everyone'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You opened the conversation to everyone'); } - } else if ($message === 'lobby_non_moderators') { + } elseif ($message === 'lobby_non_moderators') { $parsedMessage = $this->l->t('{actor} restricted the conversation to moderators'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You restricted the conversation to moderators'); } - } else if ($message === 'guests_allowed') { + } elseif ($message === 'guests_allowed') { $parsedMessage = $this->l->t('{actor} allowed guests'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You allowed guests'); } - } else if ($message === 'guests_disallowed') { + } elseif ($message === 'guests_disallowed') { $parsedMessage = $this->l->t('{actor} disallowed guests'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You disallowed guests'); } - } else if ($message === 'password_set') { + } elseif ($message === 'password_set') { $parsedMessage = $this->l->t('{actor} set a password'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You set a password'); } - } else if ($message === 'password_removed') { + } elseif ($message === 'password_removed') { $parsedMessage = $this->l->t('{actor} removed the password'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You removed the password'); } - } else if ($message === 'user_added') { + } elseif ($message === 'user_added') { $parsedParameters['user'] = $this->getUser($parameters['user']); $parsedMessage = $this->l->t('{actor} added {user}'); if ($parsedParameters['user']['id'] === $parsedParameters['actor']['id']) { @@ -179,12 +177,12 @@ class SystemMessage { } else { $parsedMessage = $this->l->t('{actor} joined the conversation'); } - } else if ($currentUserIsActor) { + } elseif ($currentUserIsActor) { $parsedMessage = $this->l->t('You added {user}'); - } else if (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) { + } elseif (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) { $parsedMessage = $this->l->t('{actor} added you'); } - } else if ($message === 'user_removed') { + } elseif ($message === 'user_removed') { $parsedParameters['user'] = $this->getUser($parameters['user']); if ($parsedParameters['user']['id'] === $parsedParameters['actor']['id']) { if ($currentUserIsActor) { @@ -196,43 +194,43 @@ class SystemMessage { $parsedMessage = $this->l->t('{actor} removed {user}'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You removed {user}'); - } else if (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) { + } elseif (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) { $parsedMessage = $this->l->t('{actor} removed you'); } } - } else if ($message === 'moderator_promoted') { + } elseif ($message === 'moderator_promoted') { $parsedParameters['user'] = $this->getUser($parameters['user']); $parsedMessage = $this->l->t('{actor} promoted {user} to moderator'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You promoted {user} to moderator'); - } else if (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) { + } elseif (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) { $parsedMessage = $this->l->t('{actor} promoted you to moderator'); } - } else if ($message === 'moderator_demoted') { + } elseif ($message === 'moderator_demoted') { $parsedParameters['user'] = $this->getUser($parameters['user']); $parsedMessage = $this->l->t('{actor} demoted {user} from moderator'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You demoted {user} from moderator'); - } else if (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) { + } elseif (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) { $parsedMessage = $this->l->t('{actor} demoted you from moderator'); } - } else if ($message === 'guest_moderator_promoted') { + } elseif ($message === 'guest_moderator_promoted') { $parsedParameters['user'] = $this->getGuest($parameters['session']); $parsedMessage = $this->l->t('{actor} promoted {user} to moderator'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You promoted {user} to moderator'); - } else if ($participant->isGuest() && $participant->getSessionId() === $parsedParameters['user']['id']) { + } elseif ($participant->isGuest() && $participant->getSessionId() === $parsedParameters['user']['id']) { $parsedMessage = $this->l->t('{actor} promoted you to moderator'); } - } else if ($message === 'guest_moderator_demoted') { + } elseif ($message === 'guest_moderator_demoted') { $parsedParameters['user'] = $this->getGuest($parameters['session']); $parsedMessage = $this->l->t('{actor} demoted {user} from moderator'); if ($currentUserIsActor) { $parsedMessage = $this->l->t('You demoted {user} from moderator'); - } else if ($participant->isGuest() && $participant->getSessionId() === $parsedParameters['user']['id']) { + } elseif ($participant->isGuest() && $participant->getSessionId() === $parsedParameters['user']['id']) { $parsedMessage = $this->l->t('{actor} demoted you from moderator'); } - } else if ($message === 'file_shared') { + } elseif ($message === 'file_shared') { try { $parsedParameters['file'] = $this->getFileFromShare($participant, $parameters['share']); $parsedMessage = '{file}'; diff --git a/lib/Chat/Parser/UserMention.php b/lib/Chat/Parser/UserMention.php index a4a1d5901..38a20a2de 100644 --- a/lib/Chat/Parser/UserMention.php +++ b/lib/Chat/Parser/UserMention.php @@ -1,4 +1,5 @@ $chatMessage->getRoom()->getDisplayName($chatMessage->getParticipant()->getUser()), 'call-type' => $this->getRoomType($chatMessage->getRoom()), ]; - } else if ($mention['type'] === 'guest') { + } elseif ($mention['type'] === 'guest') { try { $displayName = $this->guestManager->getNameBySessionHash(substr($mention['id'], strlen('guest/'))); } catch (ParticipantNotFoundException $e) { diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php index 2fa0ce69f..de0ecc480 100644 --- a/lib/Chat/SystemMessage/Listener.php +++ b/lib/Chat/SystemMessage/Listener.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Chat\SystemMessage; - use OCA\Talk\Chat\ChatManager; use OCA\Talk\Events\AddParticipantsEvent; use OCA\Talk\Events\ModifyLobbyEvent; @@ -65,7 +65,7 @@ class Listener { } public static function register(IEventDispatcher $dispatcher): void { - $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function(ModifyParticipantEvent $event) { + $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function (ModifyParticipantEvent $event) { $room = $event->getRoom(); /** @var self $listener */ $listener = \OC::$server->query(self::class); @@ -76,7 +76,7 @@ class Listener { $listener->sendSystemMessage($room, 'call_started'); } }); - $dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, static function(ModifyParticipantEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, static function (ModifyParticipantEvent $event) { $room = $event->getRoom(); if ($event->getParticipant()->getInCallFlags() === Participant::FLAG_DISCONNECTED) { @@ -90,14 +90,14 @@ class Listener { $listener->sendSystemMessage($room, 'call_left', [], $event->getParticipant()); }); - $dispatcher->addListener(Room::EVENT_AFTER_ROOM_CREATE, static function(RoomEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_ROOM_CREATE, static function (RoomEvent $event) { $room = $event->getRoom(); /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->sendSystemMessage($room, 'conversation_created'); }); - $dispatcher->addListener(Room::EVENT_AFTER_NAME_SET, static function(ModifyRoomEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_NAME_SET, static function (ModifyRoomEvent $event) { if ($event->getOldValue() === '' || $event->getNewValue() === '') { return; @@ -112,7 +112,7 @@ class Listener { 'oldName' => $event->getOldValue(), ]); }); - $dispatcher->addListener(Room::EVENT_AFTER_PASSWORD_SET, static function(ModifyRoomEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_PASSWORD_SET, static function (ModifyRoomEvent $event) { $room = $event->getRoom(); /** @var self $listener */ $listener = \OC::$server->query(self::class); @@ -123,20 +123,20 @@ class Listener { $listener->sendSystemMessage($room, 'password_removed'); } }); - $dispatcher->addListener(Room::EVENT_AFTER_TYPE_SET, static function(ModifyRoomEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_TYPE_SET, static function (ModifyRoomEvent $event) { $room = $event->getRoom(); if ($event->getNewValue() === Room::PUBLIC_CALL) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->sendSystemMessage($room, 'guests_allowed'); - } else if ($event->getNewValue() === Room::GROUP_CALL) { + } elseif ($event->getNewValue() === Room::GROUP_CALL) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->sendSystemMessage($room, 'guests_disallowed'); } }); - $dispatcher->addListener(Room::EVENT_AFTER_READONLY_SET, static function(ModifyRoomEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_READONLY_SET, static function (ModifyRoomEvent $event) { $room = $event->getRoom(); if ($room->getType() === Room::CHANGELOG_CONVERSATION) { @@ -148,11 +148,11 @@ class Listener { if ($event->getNewValue() === Room::READ_ONLY) { $listener->sendSystemMessage($room, 'read_only'); - } else if ($event->getNewValue() === Room::READ_WRITE) { + } elseif ($event->getNewValue() === Room::READ_WRITE) { $listener->sendSystemMessage($room, 'read_only_off'); } }); - $dispatcher->addListener(Room::EVENT_AFTER_LOBBY_STATE_SET, static function(ModifyLobbyEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_LOBBY_STATE_SET, static function (ModifyLobbyEvent $event) { if ($event->getNewValue() === $event->getOldValue()) { return; } @@ -164,14 +164,14 @@ class Listener { if ($event->isTimerReached()) { $listener->sendSystemMessage($room, 'lobby_timer_reached'); - } else if ($event->getNewValue() === Webinary::LOBBY_NONE) { + } elseif ($event->getNewValue() === Webinary::LOBBY_NONE) { $listener->sendSystemMessage($room, 'lobby_none'); - } else if ($event->getNewValue() === Webinary::LOBBY_NON_MODERATORS) { + } elseif ($event->getNewValue() === Webinary::LOBBY_NON_MODERATORS) { $listener->sendSystemMessage($room, 'lobby_non_moderators'); } }); - $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, static function(AddParticipantsEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, static function (AddParticipantsEvent $event) { $participants = $event->getParticipants(); $user = \OC::$server->getUserSession()->getUser(); $userId = $user instanceof IUser ? $user->getUID() : null; @@ -192,7 +192,7 @@ class Listener { } } }); - $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, static function(RemoveUserEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, static function (RemoveUserEvent $event) { $room = $event->getRoom(); if ($room->getType() === Room::ONE_TO_ONE_CALL) { @@ -203,28 +203,28 @@ class Listener { $listener = \OC::$server->query(self::class); $listener->sendSystemMessage($room, 'user_removed', ['user' => $event->getUser()->getUID()]); }); - $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, static function(ModifyParticipantEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, static function (ModifyParticipantEvent $event) { $room = $event->getRoom(); if ($event->getNewValue() === Participant::MODERATOR) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->sendSystemMessage($room, 'moderator_promoted', ['user' => $event->getParticipant()->getUser()]); - } else if ($event->getNewValue() === Participant::USER) { + } elseif ($event->getNewValue() === Participant::USER) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->sendSystemMessage($room, 'moderator_demoted', ['user' => $event->getParticipant()->getUser()]); - } else if ($event->getNewValue() === Participant::GUEST_MODERATOR) { + } elseif ($event->getNewValue() === Participant::GUEST_MODERATOR) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->sendSystemMessage($room, 'guest_moderator_promoted', ['session' => sha1($event->getParticipant()->getSessionId())]); - } else if ($event->getNewValue() === Participant::GUEST) { + } elseif ($event->getNewValue() === Participant::GUEST) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->sendSystemMessage($room, 'guest_moderator_demoted', ['session' => sha1($event->getParticipant()->getSessionId())]); } }); - $listener = function(GenericEvent $event) { + $listener = function (GenericEvent $event) { /** @var IShare $share */ $share = $event->getSubject(); diff --git a/lib/Collaboration/Collaborators/Listener.php b/lib/Collaboration/Collaborators/Listener.php index 57bd52952..b5b2136ef 100644 --- a/lib/Collaboration/Collaborators/Listener.php +++ b/lib/Collaboration/Collaborators/Listener.php @@ -1,4 +1,5 @@ @@ -57,8 +58,7 @@ class Listener { } public static function register(IEventDispatcher $dispatcher): void { - - $dispatcher->addListener(IManager::class . '::filterResults', static function(AutoCompleteEvent $event) { + $dispatcher->addListener(IManager::class . '::filterResults', static function (AutoCompleteEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); diff --git a/lib/Collaboration/Collaborators/RoomPlugin.php b/lib/Collaboration/Collaborators/RoomPlugin.php index 3a55f7dfd..6d33922f0 100644 --- a/lib/Collaboration/Collaborators/RoomPlugin.php +++ b/lib/Collaboration/Collaborators/RoomPlugin.php @@ -1,4 +1,5 @@ @@ -59,9 +60,9 @@ class ConversationProvider implements IProvider { $iconURL = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('spreed', 'app-dark.svg')); /** * Disabled for now, because it would show a square avatar - if ($room->getType() === Room::ONE_TO_ONE_CALL) { - $iconURL = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => 'admin', 'size' => 32]); - } + * if ($room->getType() === Room::ONE_TO_ONE_CALL) { + * $iconURL = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => 'admin', 'size' => 32]); + * } */ return [ diff --git a/lib/Collaboration/Resources/Listener.php b/lib/Collaboration/Resources/Listener.php index 55f600c12..6005aa413 100644 --- a/lib/Collaboration/Resources/Listener.php +++ b/lib/Collaboration/Resources/Listener.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Collaboration\Resources; -use OCA\Talk\Events\AddEmailEvent; use OCA\Talk\Events\AddParticipantsEvent; use OCA\Talk\Events\RemoveParticipantEvent; use OCA\Talk\Events\RemoveUserEvent; @@ -36,7 +36,7 @@ use OCP\IUserManager; class Listener { public static function register(IEventDispatcher $dispatcher): void { - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { $room = $event->getRoom(); /** @var IManager $manager */ $resourceManager = \OC::$server->query(IManager::class); @@ -50,7 +50,7 @@ class Listener { }; $dispatcher->addListener(Room::EVENT_AFTER_ROOM_DELETE, $listener); - $listener = static function(AddParticipantsEvent $event) { + $listener = static function (AddParticipantsEvent $event) { $room = $event->getRoom(); /** @var IManager $manager */ $resourceManager = \OC::$server->query(IManager::class); @@ -74,7 +74,7 @@ class Listener { }; $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, $listener); - $listener = static function(RemoveUserEvent $event) { + $listener = static function (RemoveUserEvent $event) { $room = $event->getRoom(); /** @var IManager $manager */ $resourceManager = \OC::$server->query(IManager::class); @@ -88,7 +88,7 @@ class Listener { }; $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, $listener); - $listener = static function(RemoveParticipantEvent $event) { + $listener = static function (RemoveParticipantEvent $event) { $room = $event->getRoom(); /** @var IManager $manager */ $resourceManager = \OC::$server->query(IManager::class); @@ -106,7 +106,7 @@ class Listener { }; $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_REMOVE, $listener); - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { $room = $event->getRoom(); /** @var IManager $manager */ $resourceManager = \OC::$server->query(IManager::class); diff --git a/lib/Command/Command/Add.php b/lib/Command/Command/Add.php index cd2d24642..e7060106e 100644 --- a/lib/Command/Command/Add.php +++ b/lib/Command/Command/Add.php @@ -1,4 +1,5 @@ @@ -29,7 +30,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Add extends Base { - use TRenderCommand; /** @var CommandService */ @@ -115,6 +115,5 @@ class Add extends Base { $output->writeln(''); $output->writeln("If you think your command makes sense for other users as well, feel free to share it in the following github issue:\n https://github.com/nextcloud/spreed/issues/1566"); - } } diff --git a/lib/Command/Command/AddSamples.php b/lib/Command/Command/AddSamples.php index 6e601ac37..bbbd06b7e 100644 --- a/lib/Command/Command/AddSamples.php +++ b/lib/Command/Command/AddSamples.php @@ -1,4 +1,5 @@ @@ -32,7 +33,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class AddSamples extends Base { - use TRenderCommand; /** @var CommandService */ @@ -73,7 +73,7 @@ class AddSamples extends Base { $chmod = fileperms($appPath . '/sample-commands/calc.sh'); if (!($chmod & 0x0040 || $chmod & 0x0008 || $chmod & 0x0001)) { $output->writeln('sample-commands/calc.sh is not executable'); - } else if (!shell_exec('which bc')) { + } elseif (!shell_exec('which bc')) { $output->writeln('Can not add calculator command, because Basic calculator package (bc - https://www.gnu.org/software/bc/) is missing'); } else { $this->installCommand( diff --git a/lib/Command/Command/Delete.php b/lib/Command/Command/Delete.php index ecf549d65..d1ec44730 100644 --- a/lib/Command/Command/Delete.php +++ b/lib/Command/Command/Delete.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Command/ListCommand.php b/lib/Command/Command/ListCommand.php index af45de3ac..4fe019538 100644 --- a/lib/Command/Command/ListCommand.php +++ b/lib/Command/Command/ListCommand.php @@ -1,4 +1,5 @@ @@ -29,7 +30,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ListCommand extends Base { - use TRenderCommand; /** @var CommandService */ diff --git a/lib/Command/Command/TRenderCommand.php b/lib/Command/Command/TRenderCommand.php index b70c34ec3..99fa57be5 100644 --- a/lib/Command/Command/TRenderCommand.php +++ b/lib/Command/Command/TRenderCommand.php @@ -1,4 +1,5 @@ @@ -25,13 +26,11 @@ namespace OCA\Talk\Command\Command; use OCA\Talk\Model\Command; use OC\Core\Command\Base; use Symfony\Component\Console\Helper\Table; -use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; trait TRenderCommand { - protected function renderCommands(string $outputFormat, OutputInterface $output, array $commands, bool $showHelp = false): void { - $result = array_map(function(Command $command) { + $result = array_map(function (Command $command) { return $command->asArray(); }, $commands); diff --git a/lib/Command/Command/Update.php b/lib/Command/Command/Update.php index f0f807319..6dc12aaf4 100644 --- a/lib/Command/Command/Update.php +++ b/lib/Command/Command/Update.php @@ -1,4 +1,5 @@ @@ -30,7 +31,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class Update extends Base { - use TRenderCommand; /** @var CommandService */ diff --git a/lib/Command/Room/Add.php b/lib/Command/Room/Add.php index d213beb1e..c48755aa4 100644 --- a/lib/Command/Room/Add.php +++ b/lib/Command/Room/Add.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Room/Create.php b/lib/Command/Room/Create.php index f2003e45d..bc708d838 100644 --- a/lib/Command/Room/Create.php +++ b/lib/Command/Room/Create.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Room/Delete.php b/lib/Command/Room/Delete.php index d065cc469..986ca67a4 100644 --- a/lib/Command/Room/Delete.php +++ b/lib/Command/Room/Delete.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Room/Demote.php b/lib/Command/Room/Demote.php index 008030811..9bdb607db 100644 --- a/lib/Command/Room/Demote.php +++ b/lib/Command/Room/Demote.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Room/Promote.php b/lib/Command/Room/Promote.php index c55315343..44b378c74 100644 --- a/lib/Command/Room/Promote.php +++ b/lib/Command/Room/Promote.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Room/Remove.php b/lib/Command/Room/Remove.php index 0c0f77012..aeb7313a6 100644 --- a/lib/Command/Room/Remove.php +++ b/lib/Command/Room/Remove.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Room/TRoomCommand.php b/lib/Command/Room/TRoomCommand.php index 1b65d8d0d..1baf70793 100644 --- a/lib/Command/Room/TRoomCommand.php +++ b/lib/Command/Room/TRoomCommand.php @@ -1,4 +1,5 @@ @@ -32,8 +33,7 @@ use OCA\Talk\Participant; use OCA\Talk\Room; use OCP\IUser; -trait TRoomCommand -{ +trait TRoomCommand { /** * @param Room $room * @param string $name diff --git a/lib/Command/Room/Update.php b/lib/Command/Room/Update.php index 500e898a8..a75dd6a7f 100644 --- a/lib/Command/Room/Update.php +++ b/lib/Command/Room/Update.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Signaling/Add.php b/lib/Command/Signaling/Add.php index 2b421d030..735d45f13 100644 --- a/lib/Command/Signaling/Add.php +++ b/lib/Command/Signaling/Add.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Signaling/Delete.php b/lib/Command/Signaling/Delete.php index 4404c5df9..4dc6aaa87 100644 --- a/lib/Command/Signaling/Delete.php +++ b/lib/Command/Signaling/Delete.php @@ -1,4 +1,5 @@ @@ -64,7 +65,7 @@ class Delete extends Base { } $count = count($signaling['servers']); // remove all occurrences of $server - $servers = array_filter($signaling['servers'], function($s) use ($server) { + $servers = array_filter($signaling['servers'], function ($s) use ($server) { return $s['server'] !== $server; }); $signaling['servers'] = array_values($servers); // reindex diff --git a/lib/Command/Signaling/ListCommand.php b/lib/Command/Signaling/ListCommand.php index 4ea7bd599..d0f3382f8 100644 --- a/lib/Command/Signaling/ListCommand.php +++ b/lib/Command/Signaling/ListCommand.php @@ -1,4 +1,5 @@ @@ -27,7 +28,6 @@ namespace OCA\Talk\Command\Signaling; use OCP\IConfig; use OC\Core\Command\Base; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ListCommand extends Base { diff --git a/lib/Command/Stun/Add.php b/lib/Command/Stun/Add.php index c12439fff..be6d9993a 100644 --- a/lib/Command/Stun/Add.php +++ b/lib/Command/Stun/Add.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Stun/Delete.php b/lib/Command/Stun/Delete.php index 46f7aaf0a..2128dffba 100644 --- a/lib/Command/Stun/Delete.php +++ b/lib/Command/Stun/Delete.php @@ -1,4 +1,5 @@ @@ -61,7 +62,7 @@ class Delete extends Base { } $count = count($servers); // remove all occurrences of $server - $servers = array_filter($servers, function($s) use ($server) { + $servers = array_filter($servers, function ($s) use ($server) { return $s !== $server; }); $servers = array_values($servers); // reindex diff --git a/lib/Command/Stun/ListCommand.php b/lib/Command/Stun/ListCommand.php index ecd4e5b81..f5a8a2438 100644 --- a/lib/Command/Stun/ListCommand.php +++ b/lib/Command/Stun/ListCommand.php @@ -1,4 +1,5 @@ @@ -27,7 +28,6 @@ namespace OCA\Talk\Command\Stun; use OCP\IConfig; use OC\Core\Command\Base; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ListCommand extends Base { diff --git a/lib/Command/Turn/Add.php b/lib/Command/Turn/Add.php index fb993f900..83326fc0b 100644 --- a/lib/Command/Turn/Add.php +++ b/lib/Command/Turn/Add.php @@ -1,4 +1,5 @@ diff --git a/lib/Command/Turn/Delete.php b/lib/Command/Turn/Delete.php index cb6d5bec4..2f09a2940 100644 --- a/lib/Command/Turn/Delete.php +++ b/lib/Command/Turn/Delete.php @@ -1,4 +1,5 @@ @@ -68,7 +69,7 @@ class Delete extends Base { $count = count($servers); // remove all occurrences which math $server and $protocols - $servers = array_filter($servers, function($s) use ($server, $protocols) { + $servers = array_filter($servers, function ($s) use ($server, $protocols) { return $s['server'] !== $server || $s['protocols'] !== $protocols; }); $servers = array_values($servers); // reindex diff --git a/lib/Command/Turn/ListCommand.php b/lib/Command/Turn/ListCommand.php index fd26595d5..a9bf3633c 100644 --- a/lib/Command/Turn/ListCommand.php +++ b/lib/Command/Turn/ListCommand.php @@ -1,4 +1,5 @@ @@ -27,7 +28,6 @@ namespace OCA\Talk\Command\Turn; use OCP\IConfig; use OC\Core\Command\Base; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class ListCommand extends Base { diff --git a/lib/Config.php b/lib/Config.php index 0b68998f3..3bef58717 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -1,4 +1,5 @@ @@ -29,7 +30,6 @@ use OCP\IUser; use OCP\Security\ISecureRandom; class Config { - public const SIGNALING_INTERNAL = 'internal'; public const SIGNALING_EXTERNAL = 'external'; public const SIGNALING_CLUSTER_CONVERSATION = 'conversation_cluster'; @@ -154,7 +154,7 @@ class Config { } if (!$this->config->getSystemValueBool('has_internet_connection', true)) { - $servers = array_filter($servers, static function($server) { + $servers = array_filter($servers, static function ($server) { return $server !== 'stun.nextcloud.com:443'; }); } @@ -227,12 +227,12 @@ class Config { $username = $timestamp . ':' . $rnd; $password = base64_encode(hash_hmac('sha1', $username, $server['secret'], true)); - return array( + return [ 'server' => $server['server'], 'username' => $username, 'password' => $password, 'protocols' => $server['protocols'], - ); + ]; } public function getSignalingMode(): string { @@ -349,5 +349,4 @@ class Config { $hash = hash_hmac('sha256', $data, $secret); return hash_equals($hash, substr($ticket, $lastColon + 1)); } - } diff --git a/lib/ContactsMenu/Providers/CallProvider.php b/lib/ContactsMenu/Providers/CallProvider.php index 569fa2bec..307923db2 100644 --- a/lib/ContactsMenu/Providers/CallProvider.php +++ b/lib/ContactsMenu/Providers/CallProvider.php @@ -1,4 +1,5 @@ @@ -72,7 +73,7 @@ class CallProvider implements IProvider { } $user = $this->userManager->get($uid); - if(!$user instanceof IUser) { + if (!$user instanceof IUser) { // No valid user object return; } @@ -88,5 +89,4 @@ class CallProvider implements IProvider { $action = $this->actionFactory->newLinkAction($iconUrl, $talkAction, $callUrl); $entry->addAction($action); } - } diff --git a/lib/Controller/AEnvironmentAwareController.php b/lib/Controller/AEnvironmentAwareController.php index 7b03d32e7..ecb71b0ea 100644 --- a/lib/Controller/AEnvironmentAwareController.php +++ b/lib/Controller/AEnvironmentAwareController.php @@ -1,4 +1,5 @@ @@ -62,5 +63,4 @@ abstract class AEnvironmentAwareController extends OCSController { public function getParticipant(): ?Participant { return $this->participant; } - } diff --git a/lib/Controller/CallController.php b/lib/Controller/CallController.php index 9a08f3cd1..2603922e5 100644 --- a/lib/Controller/CallController.php +++ b/lib/Controller/CallController.php @@ -1,4 +1,5 @@ @@ -116,5 +117,4 @@ class CallController extends AEnvironmentAwareController { return new DataResponse(); } - } diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index d0bf74ee5..1f4afbe2b 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -1,4 +1,5 @@ userId === null) { $actorType = 'guests'; $sessionId = $this->session->getSessionForRoom($this->room->getToken()); @@ -360,10 +360,10 @@ class ChatController extends AEnvironmentAwareController { * So when you are still there, it will just have a wrong read * marker for the time until your next request starts, while it will * not update the value, when you actually left the chat already. - if ($setReadMarker === 1 && $lookIntoFuture) { - $this->participant->setLastReadMessage((int) $newLastKnown->getId()); - } - */ + * if ($setReadMarker === 1 && $lookIntoFuture) { + * $this->participant->setLastReadMessage((int) $newLastKnown->getId()); + * } + */ } return $response; diff --git a/lib/Controller/CommandController.php b/lib/Controller/CommandController.php index a64e2bc52..ab6696c59 100644 --- a/lib/Controller/CommandController.php +++ b/lib/Controller/CommandController.php @@ -52,7 +52,7 @@ class CommandController extends OCSController { public function index(): DataResponse { $commands = $this->commandService->findAll(); - $result = array_map(function(Command $command) { + $result = array_map(function (Command $command) { return $command->asArray(); }, $commands); diff --git a/lib/Controller/FilesIntegrationController.php b/lib/Controller/FilesIntegrationController.php index acfbda5e5..1bd20f6de 100644 --- a/lib/Controller/FilesIntegrationController.php +++ b/lib/Controller/FilesIntegrationController.php @@ -1,4 +1,5 @@ getName(); } - } diff --git a/lib/Controller/GuestController.php b/lib/Controller/GuestController.php index d98e4a7ef..468fb28b1 100644 --- a/lib/Controller/GuestController.php +++ b/lib/Controller/GuestController.php @@ -1,4 +1,5 @@ @@ -44,7 +45,6 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\Template\PublicTemplateResponse; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\IRootFolder; -use OCP\Files\NotPermittedException; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IInitialStateService; @@ -54,10 +54,8 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserSession; use OCP\Notification\IManager as INotificationManager; -use OCP\Util; class PageController extends Controller { - use TInitialState; /** @var string|null */ diff --git a/lib/Controller/PublicShareAuthController.php b/lib/Controller/PublicShareAuthController.php index 9221c860a..ac89f226d 100644 --- a/lib/Controller/PublicShareAuthController.php +++ b/lib/Controller/PublicShareAuthController.php @@ -1,4 +1,5 @@ @@ -57,7 +58,6 @@ use OCP\IGroupManager; use OCP\IConfig; class RoomController extends AEnvironmentAwareController { - public const EVENT_BEFORE_ROOMS_GET = self::class . '::preGetRooms'; /** @var string|null */ @@ -277,7 +277,7 @@ class RoomController extends AEnvironmentAwareController { if ($roomData['notificationLevel'] === Participant::NOTIFY_DEFAULT) { if ($currentParticipant->isGuest()) { $roomData['notificationLevel'] = Participant::NOTIFY_NEVER; - } else if ($room->getType() === Room::ONE_TO_ONE_CALL) { + } elseif ($room->getType() === Room::ONE_TO_ONE_CALL) { $roomData['notificationLevel'] = Participant::NOTIFY_ALWAYS; } else { $adminSetting = (int) $this->config->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_DEFAULT); @@ -320,7 +320,7 @@ class RoomController extends AEnvironmentAwareController { $cleanGuests = false; $participantList = []; $participants = $room->getParticipants(); - uasort($participants, function(Participant $participant1, Participant $participant2) { + uasort($participants, function (Participant $participant1, Participant $participant2) { return $participant2->getLastPing() - $participant1->getLastPing(); }); @@ -448,7 +448,7 @@ class RoomController extends AEnvironmentAwareController { if ($roomData['notificationLevel'] === Participant::NOTIFY_DEFAULT) { if ($currentParticipant->isGuest()) { $roomData['notificationLevel'] = Participant::NOTIFY_NEVER; - } else if ($room->getType() === Room::ONE_TO_ONE_CALL) { + } elseif ($room->getType() === Room::ONE_TO_ONE_CALL) { $roomData['notificationLevel'] = Participant::NOTIFY_ALWAYS; } else { $adminSetting = (int) $this->config->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_DEFAULT); @@ -542,7 +542,6 @@ class RoomController extends AEnvironmentAwareController { * @return DataResponse */ public function createRoom(int $roomType, string $invite = '', string $roomName = '', string $source = ''): DataResponse { - if ($roomType !== Room::ONE_TO_ONE_CALL) { /** @var IUser $user */ $user = $this->userManager->get($this->userId); @@ -780,7 +779,6 @@ class RoomController extends AEnvironmentAwareController { * @return DataResponse */ public function setNotificationLevel(int $level): DataResponse { - if (!$this->participant->setNotificationLevel($level)) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -899,7 +897,7 @@ class RoomController extends AEnvironmentAwareController { $this->room->addUsers([ 'userId' => $newUser->getUID(), ]); - } else if ($source === 'groups') { + } elseif ($source === 'groups') { $group = $this->groupManager->get($newParticipant); if (!$group instanceof IGroup) { return new DataResponse([], Http::STATUS_NOT_FOUND); @@ -921,7 +919,7 @@ class RoomController extends AEnvironmentAwareController { } \call_user_func_array([$this->room, 'addUsers'], $participantsToAdd); - } else if ($source === 'circles') { + } elseif ($source === 'circles') { if (!$this->appManager->isEnabledForUser('circles')) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -959,7 +957,7 @@ class RoomController extends AEnvironmentAwareController { } \call_user_func_array([$this->room, 'addUsers'], $participantsToAdd); - } else if ($source === 'emails') { + } elseif ($source === 'emails') { $data = []; if ($this->room->setType(Room::PUBLIC_CALL)) { $data = ['type' => $this->room->getType()]; @@ -1032,7 +1030,7 @@ class RoomController extends AEnvironmentAwareController { && $room->getNumberOfModerators() === 1) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } - } else if ($room->getType() !== Room::CHANGELOG_CONVERSATION && + } elseif ($room->getType() !== Room::CHANGELOG_CONVERSATION && $room->getNumberOfParticipants() === 1) { $room->deleteRoom(); return new DataResponse(); diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 8b96818dc..0b8a5d349 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -1,4 +1,5 @@ diff --git a/lib/Controller/SignalingController.php b/lib/Controller/SignalingController.php index 27b8d077e..4070f7297 100644 --- a/lib/Controller/SignalingController.php +++ b/lib/Controller/SignalingController.php @@ -1,4 +1,5 @@ @@ -39,9 +40,6 @@ use OCP\AppFramework\OCSController; use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; use OCP\Http\Client\IClientService; -use OCP\ICache; -use OCP\ICacheFactory; -use OCP\IConfig; use OCP\IDBConnection; use OCP\IRequest; use OCP\IUser; @@ -216,7 +214,7 @@ class SignalingController extends OCSController { $response = []; $messages = json_decode($messages, true); - foreach($messages as $message) { + foreach ($messages as $message) { $ev = $message['ev']; switch ($ev) { case 'message': @@ -281,7 +279,7 @@ class SignalingController extends OCSController { // Query all messages and send them to the user $data = $this->messages->getAndDeleteMessages($sessionId); $messageCount = count($data); - $data = array_filter($data, function($message) { + $data = array_filter($data, function ($message) { return $message['data'] !== 'refresh-participant-list'; }); @@ -525,10 +523,10 @@ class SignalingController extends OCSController { if ($action === 'join') { $room->ping($userId, $sessionId, $this->timeFactory->getTime()); - } else if ($action === 'leave') { + } elseif ($action === 'leave') { if (!empty($userId)) { $room->leaveRoom($userId, $sessionId); - } else if ($participant instanceof Participant) { + } elseif ($participant instanceof Participant) { $room->removeParticipantBySession($participant, Room::PARTICIPANT_LEFT); } } @@ -589,5 +587,4 @@ class SignalingController extends OCSController { ]; return new DataResponse($response); } - } diff --git a/lib/Controller/WebinarController.php b/lib/Controller/WebinarController.php index 75456da6c..c3ac6e5d5 100644 --- a/lib/Controller/WebinarController.php +++ b/lib/Controller/WebinarController.php @@ -1,4 +1,5 @@ diff --git a/lib/Events/AddEmailEvent.php b/lib/Events/AddEmailEvent.php index 2e9f5d94b..88bcd0df4 100644 --- a/lib/Events/AddEmailEvent.php +++ b/lib/Events/AddEmailEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; class AddEmailEvent extends RoomEvent { diff --git a/lib/Events/AddParticipantsEvent.php b/lib/Events/AddParticipantsEvent.php index 7c5b3cdcd..5d214bfb2 100644 --- a/lib/Events/AddParticipantsEvent.php +++ b/lib/Events/AddParticipantsEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; class AddParticipantsEvent extends RoomEvent { diff --git a/lib/Events/ChatEvent.php b/lib/Events/ChatEvent.php index 44fc6615e..2a9e548e2 100644 --- a/lib/Events/ChatEvent.php +++ b/lib/Events/ChatEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; use OCP\Comments\IComment; diff --git a/lib/Events/ChatMessageEvent.php b/lib/Events/ChatMessageEvent.php index 24fa9c518..aad88b4f0 100644 --- a/lib/Events/ChatMessageEvent.php +++ b/lib/Events/ChatMessageEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Model\Message; class ChatMessageEvent extends ChatEvent { diff --git a/lib/Events/ChatParticipantEvent.php b/lib/Events/ChatParticipantEvent.php index dded42027..b18c38410 100644 --- a/lib/Events/ChatParticipantEvent.php +++ b/lib/Events/ChatParticipantEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Participant; use OCA\Talk\Room; use OCP\Comments\IComment; diff --git a/lib/Events/CommandEvent.php b/lib/Events/CommandEvent.php index 738362d47..7683dbd75 100644 --- a/lib/Events/CommandEvent.php +++ b/lib/Events/CommandEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Model\Command; use OCA\Talk\Room; use OCP\Comments\IComment; diff --git a/lib/Events/CreateRoomTokenEvent.php b/lib/Events/CreateRoomTokenEvent.php index 16ec78fba..b218789ae 100644 --- a/lib/Events/CreateRoomTokenEvent.php +++ b/lib/Events/CreateRoomTokenEvent.php @@ -1,4 +1,5 @@ @@ -22,8 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - -use OCA\Talk\Room; use OCP\EventDispatcher\Event; class CreateRoomTokenEvent extends Event { diff --git a/lib/Events/JoinRoomGuestEvent.php b/lib/Events/JoinRoomGuestEvent.php index 12fe728ff..f0fa8e0b0 100644 --- a/lib/Events/JoinRoomGuestEvent.php +++ b/lib/Events/JoinRoomGuestEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; class JoinRoomGuestEvent extends RoomEvent { @@ -63,5 +63,4 @@ class JoinRoomGuestEvent extends RoomEvent { public function getPassedPasswordProtection(): bool { return $this->passedPasswordProtection; } - } diff --git a/lib/Events/JoinRoomUserEvent.php b/lib/Events/JoinRoomUserEvent.php index ea50d3f91..32995d19c 100644 --- a/lib/Events/JoinRoomUserEvent.php +++ b/lib/Events/JoinRoomUserEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; use OCP\IUser; @@ -72,5 +72,4 @@ class JoinRoomUserEvent extends RoomEvent { public function getPassedPasswordProtection(): bool { return $this->passedPasswordProtection; } - } diff --git a/lib/Events/ModifyLobbyEvent.php b/lib/Events/ModifyLobbyEvent.php index 810109c3e..e4c3ef19d 100644 --- a/lib/Events/ModifyLobbyEvent.php +++ b/lib/Events/ModifyLobbyEvent.php @@ -1,4 +1,5 @@ @@ -22,9 +23,7 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; -use OCP\EventDispatcher\Event; class ModifyLobbyEvent extends ModifyRoomEvent { diff --git a/lib/Events/ModifyParticipantEvent.php b/lib/Events/ModifyParticipantEvent.php index 73717866b..777e78ffe 100644 --- a/lib/Events/ModifyParticipantEvent.php +++ b/lib/Events/ModifyParticipantEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Participant; use OCA\Talk\Room; diff --git a/lib/Events/ModifyRoomEvent.php b/lib/Events/ModifyRoomEvent.php index b3de5c41b..7925fdb56 100644 --- a/lib/Events/ModifyRoomEvent.php +++ b/lib/Events/ModifyRoomEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; class ModifyRoomEvent extends RoomEvent { diff --git a/lib/Events/ParticipantEvent.php b/lib/Events/ParticipantEvent.php index 897199a88..e72c8fdb5 100644 --- a/lib/Events/ParticipantEvent.php +++ b/lib/Events/ParticipantEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Participant; use OCA\Talk\Room; diff --git a/lib/Events/RemoveParticipantEvent.php b/lib/Events/RemoveParticipantEvent.php index ae0b1583e..09878a699 100644 --- a/lib/Events/RemoveParticipantEvent.php +++ b/lib/Events/RemoveParticipantEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Participant; use OCA\Talk\Room; diff --git a/lib/Events/RemoveUserEvent.php b/lib/Events/RemoveUserEvent.php index e1af64133..fae652d76 100644 --- a/lib/Events/RemoveUserEvent.php +++ b/lib/Events/RemoveUserEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Participant; use OCA\Talk\Room; use OCP\IUser; diff --git a/lib/Events/RoomEvent.php b/lib/Events/RoomEvent.php index 961325bbf..4c2bec9e9 100644 --- a/lib/Events/RoomEvent.php +++ b/lib/Events/RoomEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; use OCP\EventDispatcher\Event; diff --git a/lib/Events/SignalingEvent.php b/lib/Events/SignalingEvent.php index 615169ae1..aa25a91c7 100644 --- a/lib/Events/SignalingEvent.php +++ b/lib/Events/SignalingEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Participant; use OCA\Talk\Room; diff --git a/lib/Events/SignalingRoomPropertiesEvent.php b/lib/Events/SignalingRoomPropertiesEvent.php index e689be3f5..1be058990 100644 --- a/lib/Events/SignalingRoomPropertiesEvent.php +++ b/lib/Events/SignalingRoomPropertiesEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; class SignalingRoomPropertiesEvent extends RoomEvent { diff --git a/lib/Events/UserEvent.php b/lib/Events/UserEvent.php index 3ebcedd05..6fd00144b 100644 --- a/lib/Events/UserEvent.php +++ b/lib/Events/UserEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCP\EventDispatcher\Event; class UserEvent extends Event { diff --git a/lib/Events/VerifyRoomPasswordEvent.php b/lib/Events/VerifyRoomPasswordEvent.php index d7d2b6d13..f19946048 100644 --- a/lib/Events/VerifyRoomPasswordEvent.php +++ b/lib/Events/VerifyRoomPasswordEvent.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Events; - use OCA\Talk\Room; class VerifyRoomPasswordEvent extends RoomEvent { diff --git a/lib/Exceptions/ForbiddenException.php b/lib/Exceptions/ForbiddenException.php index 2713f2354..09fd2bb99 100644 --- a/lib/Exceptions/ForbiddenException.php +++ b/lib/Exceptions/ForbiddenException.php @@ -1,4 +1,5 @@ @@ -24,5 +25,4 @@ declare(strict_types=1); namespace OCA\Talk\Exceptions; class ForbiddenException extends \Exception { - } diff --git a/lib/Exceptions/InvalidPasswordException.php b/lib/Exceptions/InvalidPasswordException.php index 8ef68d89f..008134f12 100644 --- a/lib/Exceptions/InvalidPasswordException.php +++ b/lib/Exceptions/InvalidPasswordException.php @@ -1,4 +1,5 @@ @@ -24,5 +25,4 @@ declare(strict_types=1); namespace OCA\Talk\Exceptions; class InvalidPasswordException extends \Exception { - } diff --git a/lib/Exceptions/ParticipantNotFoundException.php b/lib/Exceptions/ParticipantNotFoundException.php index 52a5eb3c1..d3a7b1988 100644 --- a/lib/Exceptions/ParticipantNotFoundException.php +++ b/lib/Exceptions/ParticipantNotFoundException.php @@ -1,4 +1,5 @@ @@ -24,5 +25,4 @@ declare(strict_types=1); namespace OCA\Talk\Exceptions; class ParticipantNotFoundException extends \OutOfBoundsException { - } diff --git a/lib/Exceptions/RoomNotFoundException.php b/lib/Exceptions/RoomNotFoundException.php index fd584a186..df4230764 100644 --- a/lib/Exceptions/RoomNotFoundException.php +++ b/lib/Exceptions/RoomNotFoundException.php @@ -1,4 +1,5 @@ @@ -24,5 +25,4 @@ declare(strict_types=1); namespace OCA\Talk\Exceptions; class RoomNotFoundException extends \OutOfBoundsException { - } diff --git a/lib/Exceptions/UnauthorizedException.php b/lib/Exceptions/UnauthorizedException.php index e1123592d..f8ca2f70b 100644 --- a/lib/Exceptions/UnauthorizedException.php +++ b/lib/Exceptions/UnauthorizedException.php @@ -1,4 +1,5 @@ @@ -24,5 +25,4 @@ declare(strict_types=1); namespace OCA\Talk\Exceptions; class UnauthorizedException extends \Exception { - } diff --git a/lib/Files/Listener.php b/lib/Files/Listener.php index d7cb4e8db..bcec71a98 100644 --- a/lib/Files/Listener.php +++ b/lib/Files/Listener.php @@ -1,4 +1,5 @@ query(self::class); @@ -74,14 +75,14 @@ class Listener { }; $dispatcher->addListener(Room::EVENT_BEFORE_ROOM_CONNECT, $listener); - $listener = static function(JoinRoomGuestEvent $event) { + $listener = static function (JoinRoomGuestEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); try { $listener->preventGuestsFromJoiningIfNotPubliclyAccessible($event->getRoom()); } catch (UnauthorizedException $e) { - $event->setCancelJoin( true); + $event->setCancelJoin(true); } }; $dispatcher->addListener(Room::EVENT_BEFORE_GUEST_CONNECT, $listener); @@ -171,5 +172,4 @@ class Listener { throw new UnauthorizedException('Guests are not allowed in this room'); } - } diff --git a/lib/Files/TemplateLoader.php b/lib/Files/TemplateLoader.php index 185e8cb13..99d63f8c4 100644 --- a/lib/Files/TemplateLoader.php +++ b/lib/Files/TemplateLoader.php @@ -1,4 +1,5 @@ publishInitialStateForGuest(); } } - } diff --git a/lib/Files/Util.php b/lib/Files/Util.php index 3789ca37e..1c3fe9a74 100644 --- a/lib/Files/Util.php +++ b/lib/Files/Util.php @@ -1,4 +1,5 @@ getType() === FileInfo::TYPE_FILE; }); @@ -244,7 +245,7 @@ class Util { return null; } - $nodes = array_filter($nodes, function(Node $node) { + $nodes = array_filter($nodes, function (Node $node) { return $node->getType() === FileInfo::TYPE_FILE; }); if (empty($nodes)) { @@ -263,5 +264,4 @@ class Util { return null; } - } diff --git a/lib/Flow/Operation.php b/lib/Flow/Operation.php index ae7ec8cd8..0c97e1669 100644 --- a/lib/Flow/Operation.php +++ b/lib/Flow/Operation.php @@ -1,4 +1,5 @@ @@ -127,7 +128,7 @@ class Operation implements IOperation { $entity = $ruleMatcher->getEntity(); $message = $this->prepareText($entity, $eventName); - if($message === '') { + if ($message === '') { continue; } @@ -154,10 +155,10 @@ class Operation implements IOperation { protected function prepareText(IEntity $entity, string $eventName) { $message = $eventName; - if($entity instanceof IDisplayText) { + if ($entity instanceof IDisplayText) { $message = trim($entity->getDisplayText(3)); } - if($entity instanceof IUrl && $message !== '') { + if ($entity instanceof IUrl && $message !== '') { $message .= ' ' . $entity->getUrl(); } return $message; @@ -190,7 +191,7 @@ class Operation implements IOperation { */ $opConfig = \json_decode($raw, true); - if(!is_array($opConfig) || empty($opConfig)) { + if (!is_array($opConfig) || empty($opConfig)) { throw new UnexpectedValueException('Cannot decode operation details'); } @@ -201,11 +202,11 @@ class Operation implements IOperation { } protected function validateOperationConfig(int $mode, string $token, string $uid): void { - if(!in_array($mode, self::MESSAGE_MODES)) { + if (!in_array($mode, self::MESSAGE_MODES)) { throw new UnexpectedValueException('Invalid mode'); } - if(empty($token)) { + if (empty($token)) { throw new UnexpectedValueException('Invalid token'); } @@ -215,7 +216,7 @@ class Operation implements IOperation { throw new UnexpectedValueException('Room not found', $e->getCode(), $e); } - if($mode === self::MESSAGE_MODES['ROOM_MENTION']) { + if ($mode === self::MESSAGE_MODES['ROOM_MENTION']) { try { $participant = $this->getParticipant($uid, $room); if (!$participant->hasModeratorPermissions(false)) { @@ -232,7 +233,7 @@ class Operation implements IOperation { */ protected function getUser(): IUser { $user = $this->session->getUser(); - if($user === null) { + if ($user === null) { throw new UnexpectedValueException('User not logged in'); } return $user; diff --git a/lib/GuestManager.php b/lib/GuestManager.php index e26ddaee8..2408ae27d 100644 --- a/lib/GuestManager.php +++ b/lib/GuestManager.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk; - use OCA\Talk\Events\AddEmailEvent; use OCA\Talk\Events\ModifyParticipantEvent; use OCA\Talk\Exceptions\ParticipantNotFoundException; @@ -38,7 +38,6 @@ use OCP\Mail\IMailer; use OCP\Util; class GuestManager { - public const EVENT_BEFORE_EMAIL_INVITE = self::class . '::preInviteByEmail'; public const EVENT_AFTER_EMAIL_INVITE = self::class . '::postInviteByEmail'; public const EVENT_AFTER_NAME_UPDATE = self::class . '::updateName'; diff --git a/lib/Listener.php b/lib/Listener.php index 047e55c99..c4235d945 100644 --- a/lib/Listener.php +++ b/lib/Listener.php @@ -1,4 +1,5 @@ @@ -22,8 +23,6 @@ declare(strict_types=1); namespace OCA\Talk; -use OCP\Collaboration\AutoComplete\AutoCompleteEvent; -use OCP\Collaboration\AutoComplete\IManager; use OCP\EventDispatcher\IEventDispatcher; use OCP\IUser; use OCP\IUserManager; diff --git a/lib/Listener/CSPListener.php b/lib/Listener/CSPListener.php index a3ce99946..491a0d6fe 100644 --- a/lib/Listener/CSPListener.php +++ b/lib/Listener/CSPListener.php @@ -1,4 +1,5 @@ @@ -51,5 +52,4 @@ class CSPListener implements IEventListener { $event->addPolicy($csp); } - } diff --git a/lib/Listener/FeaturePolicyListener.php b/lib/Listener/FeaturePolicyListener.php index f80d6f1be..efae3de96 100644 --- a/lib/Listener/FeaturePolicyListener.php +++ b/lib/Listener/FeaturePolicyListener.php @@ -1,4 +1,5 @@ @@ -30,7 +31,6 @@ use OCP\EventDispatcher\IEventListener; use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent; class FeaturePolicyListener implements IEventListener { - public function handle(Event $event): void { if (!($event instanceof AddFeaturePolicyEvent)) { return; @@ -41,5 +41,4 @@ class FeaturePolicyListener implements IEventListener { $policy->addAllowedMicrophoneDomain('\'self\''); $event->addPolicy($policy); } - } diff --git a/lib/Listener/RestrictStartingCalls.php b/lib/Listener/RestrictStartingCalls.php index f77ff3f4c..623e96538 100644 --- a/lib/Listener/RestrictStartingCalls.php +++ b/lib/Listener/RestrictStartingCalls.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Listener; - use OCA\Talk\Events\ModifyParticipantEvent; use OCA\Talk\Exceptions\ForbiddenException; use OCA\Talk\Room; @@ -39,7 +39,7 @@ class RestrictStartingCalls { } public static function register(IEventDispatcher $dispatcher): void { - $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function(ModifyParticipantEvent $event) { + $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function (ModifyParticipantEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->checkStartCallPermissions($event); diff --git a/lib/Manager.php b/lib/Manager.php index e55e3f6f4..aa539299b 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk; - use OCA\Talk\Chat\Changelog; use OCA\Talk\Chat\CommentsManager; use OCA\Talk\Events\CreateRoomTokenEvent; @@ -44,7 +44,6 @@ use OCP\Security\IHasher; use OCP\Security\ISecureRandom; class Manager { - public const EVENT_TOKEN_GENERATE = self::class . '::generateNewToken'; /** @var IDBConnection */ @@ -826,7 +825,6 @@ class Manager { * @throws \OutOfBoundsException */ protected function generateNewToken(IQueryBuilder $query, int $entropy, string $chars): string { - $event = new CreateRoomTokenEvent($entropy, $chars); $this->dispatcher->dispatch(self::EVENT_TOKEN_GENERATE, $event); try { diff --git a/lib/Middleware/CanUseTalkMiddleware.php b/lib/Middleware/CanUseTalkMiddleware.php index 791c17cbb..4f420f88b 100644 --- a/lib/Middleware/CanUseTalkMiddleware.php +++ b/lib/Middleware/CanUseTalkMiddleware.php @@ -1,4 +1,5 @@ diff --git a/lib/Middleware/Exceptions/CanNotUseTalkException.php b/lib/Middleware/Exceptions/CanNotUseTalkException.php index 9d9266c98..bc84baac3 100644 --- a/lib/Middleware/Exceptions/CanNotUseTalkException.php +++ b/lib/Middleware/Exceptions/CanNotUseTalkException.php @@ -1,4 +1,5 @@ diff --git a/lib/Middleware/Exceptions/LobbyException.php b/lib/Middleware/Exceptions/LobbyException.php index 990efbe93..5aa81b8f8 100644 --- a/lib/Middleware/Exceptions/LobbyException.php +++ b/lib/Middleware/Exceptions/LobbyException.php @@ -1,4 +1,5 @@ diff --git a/lib/Middleware/Exceptions/NotAModeratorException.php b/lib/Middleware/Exceptions/NotAModeratorException.php index 8abda311d..88c0f9bbc 100644 --- a/lib/Middleware/Exceptions/NotAModeratorException.php +++ b/lib/Middleware/Exceptions/NotAModeratorException.php @@ -1,4 +1,5 @@ diff --git a/lib/Middleware/Exceptions/ReadOnlyException.php b/lib/Middleware/Exceptions/ReadOnlyException.php index ac4f082bb..1c3627ebb 100644 --- a/lib/Middleware/Exceptions/ReadOnlyException.php +++ b/lib/Middleware/Exceptions/ReadOnlyException.php @@ -1,4 +1,5 @@ diff --git a/lib/Middleware/InjectionMiddleware.php b/lib/Middleware/InjectionMiddleware.php index 15c6f67ec..9b7e89427 100644 --- a/lib/Middleware/InjectionMiddleware.php +++ b/lib/Middleware/InjectionMiddleware.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/ClearResourceAccessCache.php b/lib/Migration/ClearResourceAccessCache.php index 792c5a53c..03ce1db2a 100644 --- a/lib/Migration/ClearResourceAccessCache.php +++ b/lib/Migration/ClearResourceAccessCache.php @@ -1,4 +1,5 @@ @@ -31,7 +32,6 @@ use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class ClearResourceAccessCache implements IRepairStep { - protected const INVALIDATIONS = 1; /** @var IConfig */ diff --git a/lib/Migration/FixNamespaceInDatabaseTables.php b/lib/Migration/FixNamespaceInDatabaseTables.php index 4d217a2af..4d098015c 100644 --- a/lib/Migration/FixNamespaceInDatabaseTables.php +++ b/lib/Migration/FixNamespaceInDatabaseTables.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Migration; - use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; diff --git a/lib/Migration/Version2000Date20170707093535.php b/lib/Migration/Version2000Date20170707093535.php index b235c5e23..cbbd0031c 100644 --- a/lib/Migration/Version2000Date20170707093535.php +++ b/lib/Migration/Version2000Date20170707093535.php @@ -1,4 +1,5 @@ @@ -123,5 +124,4 @@ class Version2000Date20170707093535 extends SimpleMigrationStep { return $schema; } - } diff --git a/lib/Migration/Version2000Date20171026140256.php b/lib/Migration/Version2000Date20171026140256.php index 3bb642da3..5f8b61efa 100644 --- a/lib/Migration/Version2000Date20171026140256.php +++ b/lib/Migration/Version2000Date20171026140256.php @@ -1,4 +1,5 @@ @@ -56,7 +57,6 @@ class Version2000Date20171026140256 extends SimpleMigrationStep { * @since 13.0.0 */ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { - if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) { // Migrations only work after 2.0.0 return; @@ -84,6 +84,5 @@ class Version2000Date20171026140256 extends SimpleMigrationStep { ->execute(); } $output->finishProgress(); - } } diff --git a/lib/Migration/Version2000Date20171026140257.php b/lib/Migration/Version2000Date20171026140257.php index fb22b242f..ff74b1d5a 100644 --- a/lib/Migration/Version2000Date20171026140257.php +++ b/lib/Migration/Version2000Date20171026140257.php @@ -1,4 +1,5 @@ @@ -60,7 +61,6 @@ class Version2000Date20171026140257 extends SimpleMigrationStep { * @since 13.0.0 */ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { - if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) { // Migrations only work after 2.0.0 return; @@ -92,7 +92,6 @@ class Version2000Date20171026140257 extends SimpleMigrationStep { ->execute(); } $output->finishProgress(); - } /** diff --git a/lib/Migration/Version2001Date20170707115443.php b/lib/Migration/Version2001Date20170707115443.php index c0875a32a..f932133be 100644 --- a/lib/Migration/Version2001Date20170707115443.php +++ b/lib/Migration/Version2001Date20170707115443.php @@ -1,4 +1,5 @@ @@ -78,7 +79,6 @@ class Version2001Date20170707115443 extends SimpleMigrationStep { * @since 13.0.0 */ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { - if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) { // Migrations only work after 2.0.0 return; diff --git a/lib/Migration/Version2001Date20170913104501.php b/lib/Migration/Version2001Date20170913104501.php index 226bcd163..dd85e30e0 100644 --- a/lib/Migration/Version2001Date20170913104501.php +++ b/lib/Migration/Version2001Date20170913104501.php @@ -1,4 +1,5 @@ @@ -69,5 +70,4 @@ class Version2001Date20170913104501 extends SimpleMigrationStep { return $schema; } - } diff --git a/lib/Migration/Version2001Date20170921145301.php b/lib/Migration/Version2001Date20170921145301.php index 718be15cb..f366a6040 100644 --- a/lib/Migration/Version2001Date20170921145301.php +++ b/lib/Migration/Version2001Date20170921145301.php @@ -1,4 +1,5 @@ @@ -50,5 +51,4 @@ class Version2001Date20170921145301 extends SimpleMigrationStep { return $schema; } - } diff --git a/lib/Migration/Version2001Date20170929092606.php b/lib/Migration/Version2001Date20170929092606.php index 048743909..0e8618299 100644 --- a/lib/Migration/Version2001Date20170929092606.php +++ b/lib/Migration/Version2001Date20170929092606.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version2001Date20171009132424.php b/lib/Migration/Version2001Date20171009132424.php index a4b5b4ade..d1f6e7257 100644 --- a/lib/Migration/Version2001Date20171009132424.php +++ b/lib/Migration/Version2001Date20171009132424.php @@ -1,4 +1,5 @@ @@ -54,5 +55,4 @@ class Version2001Date20171009132424 extends SimpleMigrationStep { return $schema; } - } diff --git a/lib/Migration/Version2001Date20171026134605.php b/lib/Migration/Version2001Date20171026134605.php index e4a7cfda0..bd40b396d 100644 --- a/lib/Migration/Version2001Date20171026134605.php +++ b/lib/Migration/Version2001Date20171026134605.php @@ -1,4 +1,5 @@ @@ -158,7 +159,6 @@ class Version2001Date20171026134605 extends SimpleMigrationStep { * @since 13.0.0 */ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { - if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) { // Migrations only work after 2.0.0 return; @@ -210,7 +210,6 @@ class Version2001Date20171026134605 extends SimpleMigrationStep { * @param int[] $roomIdMap */ protected function copyParticipants(array $roomIdMap): void { - $insert = $this->connection->getQueryBuilder(); if (!$this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { $insert->insert('talk_participants') @@ -256,14 +255,12 @@ class Version2001Date20171026134605 extends SimpleMigrationStep { $insert->execute(); } $result->closeCursor(); - } /** * @param int[] $roomIdMap */ protected function fixNotifications(array $roomIdMap): void { - $update = $this->connection->getQueryBuilder(); $update->update('notifications') ->set('object_id', $update->createParameter('newId')) @@ -301,14 +298,12 @@ class Version2001Date20171026134605 extends SimpleMigrationStep { $update->execute(); } $result->closeCursor(); - } /** * @param int[] $roomIdMap */ protected function fixActivities(array $roomIdMap): void { - $update = $this->connection->getQueryBuilder(); $update->update('activity') ->set('object_id', $update->createParameter('newId')) @@ -363,14 +358,12 @@ class Version2001Date20171026134605 extends SimpleMigrationStep { $update->execute(); } $result->closeCursor(); - } /** * @param int[] $roomIdMap */ protected function fixActivityMails(array $roomIdMap): void { - $update = $this->connection->getQueryBuilder(); $update->update('activity_mq') ->set('amq_subjectparams', $update->createParameter('subjectParams')) diff --git a/lib/Migration/Version2001Date20171026141336.php b/lib/Migration/Version2001Date20171026141336.php index edb9f2b3c..0ffebe0f9 100644 --- a/lib/Migration/Version2001Date20171026141336.php +++ b/lib/Migration/Version2001Date20171026141336.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version2001Date20171031102049.php b/lib/Migration/Version2001Date20171031102049.php index 1d06d1c2b..067ff2826 100644 --- a/lib/Migration/Version2001Date20171031102049.php +++ b/lib/Migration/Version2001Date20171031102049.php @@ -1,4 +1,5 @@ @@ -49,5 +50,4 @@ class Version2001Date20171031102049 extends SimpleMigrationStep { return $schema; } - } diff --git a/lib/Migration/Version2001Date20180103144447.php b/lib/Migration/Version2001Date20180103144447.php index 77ad48d39..0af9e898b 100644 --- a/lib/Migration/Version2001Date20180103144447.php +++ b/lib/Migration/Version2001Date20180103144447.php @@ -1,4 +1,5 @@ @@ -116,7 +117,6 @@ class Version2001Date20180103144447 extends SimpleMigrationStep { * @since 13.0.0 */ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { - if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) { // Migrations only work after 2.0.0 return; @@ -155,6 +155,5 @@ class Version2001Date20180103144447 extends SimpleMigrationStep { ->set('in_call', 'incall'); $update->execute(); } - } } diff --git a/lib/Migration/Version2001Date20180103150836.php b/lib/Migration/Version2001Date20180103150836.php index b579af9b1..852977b99 100644 --- a/lib/Migration/Version2001Date20180103150836.php +++ b/lib/Migration/Version2001Date20180103150836.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version3002Date20180319104030.php b/lib/Migration/Version3002Date20180319104030.php index ab446d193..35d1228c4 100644 --- a/lib/Migration/Version3002Date20180319104030.php +++ b/lib/Migration/Version3002Date20180319104030.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version3003Date20180707222130.php b/lib/Migration/Version3003Date20180707222130.php index c850720a9..187ffe291 100644 --- a/lib/Migration/Version3003Date20180707222130.php +++ b/lib/Migration/Version3003Date20180707222130.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version3003Date20180718112436.php b/lib/Migration/Version3003Date20180718112436.php index c4694fab7..dacb4481e 100644 --- a/lib/Migration/Version3003Date20180718112436.php +++ b/lib/Migration/Version3003Date20180718112436.php @@ -1,4 +1,5 @@ @@ -75,7 +76,7 @@ class Version3003Date20180718112436 extends SimpleMigrationStep { ->where($update->expr()->eq('id', $update->createParameter('room'))); $query = $this->connection->getQueryBuilder(); - $query->select( 'object_id') + $query->select('object_id') ->selectAlias($query->createFunction('MAX(' . $query->getColumnName('creation_timestamp') . ')'), 'last_activity') ->from('comments') ->where($query->expr()->eq('object_type', $query->createNamedParameter('chat'))) diff --git a/lib/Migration/Version3003Date20180718133519.php b/lib/Migration/Version3003Date20180718133519.php index 6ce1c2e38..3a195cc4c 100644 --- a/lib/Migration/Version3003Date20180718133519.php +++ b/lib/Migration/Version3003Date20180718133519.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version3003Date20180720162342.php b/lib/Migration/Version3003Date20180720162342.php index a1b893c73..d6706a85e 100644 --- a/lib/Migration/Version3003Date20180720162342.php +++ b/lib/Migration/Version3003Date20180720162342.php @@ -1,4 +1,5 @@ @@ -23,7 +24,6 @@ declare(strict_types=1); */ namespace OCA\Talk\Migration; -use Doctrine\DBAL\Types\Type; use OCP\DB\ISchemaWrapper; use OCP\Migration\SimpleMigrationStep; use OCP\Migration\IOutput; diff --git a/lib/Migration/Version3003Date20180722152849.php b/lib/Migration/Version3003Date20180722152849.php index faf8acfbc..3bd92746a 100644 --- a/lib/Migration/Version3003Date20180722152849.php +++ b/lib/Migration/Version3003Date20180722152849.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version3003Date20180730080327.php b/lib/Migration/Version3003Date20180730080327.php index ab1c73afa..3860d631f 100644 --- a/lib/Migration/Version3003Date20180730080327.php +++ b/lib/Migration/Version3003Date20180730080327.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version4099Date20181001123058.php b/lib/Migration/Version4099Date20181001123058.php index 90108afd7..4aaac033d 100644 --- a/lib/Migration/Version4099Date20181001123058.php +++ b/lib/Migration/Version4099Date20181001123058.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version5099Date20190121102337.php b/lib/Migration/Version5099Date20190121102337.php index dcf88c82e..50b4055ec 100644 --- a/lib/Migration/Version5099Date20190121102337.php +++ b/lib/Migration/Version5099Date20190121102337.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version5099Date20190319134820.php b/lib/Migration/Version5099Date20190319134820.php index cd7819ec9..3501d7977 100644 --- a/lib/Migration/Version5099Date20190319134820.php +++ b/lib/Migration/Version5099Date20190319134820.php @@ -1,4 +1,5 @@ @@ -54,5 +55,4 @@ class Version5099Date20190319134820 extends SimpleMigrationStep { return $schema; } - } diff --git a/lib/Migration/Version7000Date20190717141457.php b/lib/Migration/Version7000Date20190717141457.php index 9645bdbdf..2f415264f 100644 --- a/lib/Migration/Version7000Date20190717141457.php +++ b/lib/Migration/Version7000Date20190717141457.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version7000Date20190724121136.php b/lib/Migration/Version7000Date20190724121136.php index 74a268fa6..beb972b79 100644 --- a/lib/Migration/Version7000Date20190724121136.php +++ b/lib/Migration/Version7000Date20190724121136.php @@ -1,4 +1,5 @@ diff --git a/lib/Migration/Version8000Date20200331144101.php b/lib/Migration/Version8000Date20200331144101.php index b98da8824..0b3cca860 100644 --- a/lib/Migration/Version8000Date20200331144101.php +++ b/lib/Migration/Version8000Date20200331144101.php @@ -1,4 +1,5 @@ @@ -30,7 +31,6 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version8000Date20200331144101 extends SimpleMigrationStep { - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version8000Date20200402124456.php b/lib/Migration/Version8000Date20200402124456.php index adff00243..b274b716b 100644 --- a/lib/Migration/Version8000Date20200402124456.php +++ b/lib/Migration/Version8000Date20200402124456.php @@ -1,4 +1,5 @@ @@ -30,7 +31,6 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version8000Date20200402124456 extends SimpleMigrationStep { - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version8000Date20200407073807.php b/lib/Migration/Version8000Date20200407073807.php index 284e81ea6..30eb81d82 100644 --- a/lib/Migration/Version8000Date20200407073807.php +++ b/lib/Migration/Version8000Date20200407073807.php @@ -1,4 +1,5 @@ diff --git a/lib/Model/Command.php b/lib/Model/Command.php index 8734ea812..b00a51070 100644 --- a/lib/Model/Command.php +++ b/lib/Model/Command.php @@ -1,4 +1,5 @@ @@ -39,7 +40,6 @@ use OCP\AppFramework\Db\Entity; * @method int getEnabled() */ class Command extends Entity { - public const RESPONSE_NONE = 0; public const RESPONSE_USER = 1; public const RESPONSE_ALL = 2; diff --git a/lib/Model/CommandMapper.php b/lib/Model/CommandMapper.php index b10755259..877ce8203 100644 --- a/lib/Model/CommandMapper.php +++ b/lib/Model/CommandMapper.php @@ -1,4 +1,5 @@ diff --git a/lib/Model/Message.php b/lib/Model/Message.php index eadb38206..6d54f04c5 100644 --- a/lib/Model/Message.php +++ b/lib/Model/Message.php @@ -1,4 +1,5 @@ @@ -22,12 +23,10 @@ declare(strict_types=1); namespace OCA\Talk\Model; - use OCA\Talk\Participant; use OCA\Talk\Room; use OCP\Comments\IComment; use OCP\IL10N; -use OCP\IUser; class Message { diff --git a/lib/Notification/Listener.php b/lib/Notification/Listener.php index 9f1a38e29..765a35f3c 100644 --- a/lib/Notification/Listener.php +++ b/lib/Notification/Listener.php @@ -1,4 +1,5 @@ @@ -58,7 +59,7 @@ class Listener { } public static function register(IEventDispatcher $dispatcher): void { - $listener = static function(AddParticipantsEvent $event) { + $listener = static function (AddParticipantsEvent $event) { $room = $event->getRoom(); if ($room->getObjectType() === 'file') { @@ -71,28 +72,28 @@ class Listener { }; $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, $listener); - $listener = static function(JoinRoomUserEvent $event) { + $listener = static function (JoinRoomUserEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->markInvitationRead($event->getRoom()); }; $dispatcher->addListener(Room::EVENT_AFTER_ROOM_CONNECT, $listener); - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->checkCallNotifications($event->getRoom()); }; $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, $listener); - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->sendCallNotifications($event->getRoom()); }; $dispatcher->addListener(Room::EVENT_AFTER_SESSION_JOIN_CALL, $listener); - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { /** @var self $listener */ $listener = \OC::$server->query(self::class); $listener->markCallNotificationsRead($event->getRoom()); @@ -211,8 +212,8 @@ class Listener { $this->notificationManager->markProcessed($notification); $notification->setSubject('call', [ - 'callee' => $actorId, - ]) + 'callee' => $actorId, + ]) ->setDateTime($dateTime); } catch (\InvalidArgumentException $e) { $this->logger->logException($e, ['app' => 'spreed']); diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 53627fd0a..c336103e6 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Notification; - use OCA\Talk\Chat\CommentsManager; use OCA\Talk\Chat\MessageParser; use OCA\Talk\Config; @@ -256,9 +256,9 @@ class Notifier implements INotifier { if ($notification->getSubject() === 'chat') { if ($room->getType() === Room::ONE_TO_ONE_CALL) { $subject = $l->t('{user} sent you a private message'); - } else if ($richSubjectUser) { + } elseif ($richSubjectUser) { $subject = $l->t('{user} sent a message in conversation {call}'); - } else if (!$isGuest) { + } elseif (!$isGuest) { $subject = $l->t('A deleted user sent a message in conversation {call}'); } else { try { @@ -268,12 +268,12 @@ class Notifier implements INotifier { $subject = $l->t('A guest sent a message in conversation {call}'); } } - } else if ($notification->getSubject() === 'reply') { + } elseif ($notification->getSubject() === 'reply') { if ($room->getType() === Room::ONE_TO_ONE_CALL) { $subject = $l->t('{user} replied to your private message'); - } else if ($richSubjectUser) { + } elseif ($richSubjectUser) { $subject = $l->t('{user} replied to your message in conversation {call}'); - } else if (!$isGuest) { + } elseif (!$isGuest) { $subject = $l->t('A deleted user replied to your message in conversation {call}'); } else { try { @@ -283,11 +283,11 @@ class Notifier implements INotifier { $subject = $l->t('A guest replied to your message in conversation {call}'); } } - } else if ($room->getType() === Room::ONE_TO_ONE_CALL) { + } elseif ($room->getType() === Room::ONE_TO_ONE_CALL) { $subject = $l->t('{user} mentioned you in a private conversation'); - } else if ($richSubjectUser) { + } elseif ($richSubjectUser) { $subject = $l->t('{user} mentioned you in conversation {call}'); - } else if (!$isGuest) { + } elseif (!$isGuest) { $subject = $l->t('A deleted user mentioned you in conversation {call}'); } else { try { @@ -398,8 +398,7 @@ class Notifier implements INotifier { ], ] ); - - } else if (\in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { + } elseif (\in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { $subject = $l->t('{user} invited you to a group conversation: {call}'); if ($room->hasSessionsInCall()) { $notification = $this->addActionButton($notification, $l->t('Join call')); @@ -478,8 +477,7 @@ class Notifier implements INotifier { } else { throw new AlreadyProcessedException(); } - - } else if (\in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { + } elseif (\in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { if ($this->notificationManager->isPreparingPushNotification() || $room->hasSessionsInCall()) { $notification = $this->addActionButton($notification, $l->t('Join call')); $subject = $l->t('A group call has started in {call}'); @@ -500,7 +498,6 @@ class Notifier implements INotifier { ], ] ); - } else { throw new AlreadyProcessedException(); } @@ -555,13 +552,13 @@ class Notifier implements INotifier { $notification ->setParsedSubject(str_replace(['{email}', '{file}'], [$sharedWith, $file['name']], $subject)) ->setRichSubject($subject, [ - 'email' => [ - 'type' => 'email', - 'id' => $sharedWith, - 'name' => $sharedWith, - ], - 'file' => $file, - ] + 'email' => [ + 'type' => 'email', + 'id' => $sharedWith, + 'name' => $sharedWith, + ], + 'file' => $file, + ] ); } else { if ($callIsActive) { diff --git a/lib/Participant.php b/lib/Participant.php index fd43553c7..a8ea6c7d9 100644 --- a/lib/Participant.php +++ b/lib/Participant.php @@ -1,4 +1,5 @@ diff --git a/lib/PublicShare/TemplateLoader.php b/lib/PublicShare/TemplateLoader.php index de5f55554..38a18f330 100644 --- a/lib/PublicShare/TemplateLoader.php +++ b/lib/PublicShare/TemplateLoader.php @@ -1,4 +1,5 @@ addListener('OCA\Files_Sharing::loadAdditionalScripts', static function(GenericEvent $event) { + $dispatcher->addListener('OCA\Files_Sharing::loadAdditionalScripts', static function (GenericEvent $event) { /** @var IShare $share */ $share = $event->getArgument('share'); /** @var self $templateLoader */ @@ -89,5 +89,4 @@ class TemplateLoader { $this->publishInitialStateForGuest(); } - } diff --git a/lib/PublicShareAuth/Listener.php b/lib/PublicShareAuth/Listener.php index 35a6cb7f4..a0518504f 100644 --- a/lib/PublicShareAuth/Listener.php +++ b/lib/PublicShareAuth/Listener.php @@ -1,4 +1,5 @@ getRoom(), $event->getUser()->getUID()); }; $dispatcher->addListener(Room::EVENT_BEFORE_ROOM_CONNECT, $listener); - $listener = static function(JoinRoomGuestEvent $event) { + $listener = static function (JoinRoomGuestEvent $event) { self::preventExtraGuestsFromJoining($event->getRoom()); }; $dispatcher->addListener(Room::EVENT_BEFORE_GUEST_CONNECT, $listener); - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { self::destroyRoomOnParticipantLeave($event->getRoom()); }; $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, $listener); @@ -130,5 +130,4 @@ class Listener { $room->deleteRoom(); } - } diff --git a/lib/PublicShareAuth/TemplateLoader.php b/lib/PublicShareAuth/TemplateLoader.php index 1e7e0ab58..1b96fe419 100644 --- a/lib/PublicShareAuth/TemplateLoader.php +++ b/lib/PublicShareAuth/TemplateLoader.php @@ -1,4 +1,5 @@ getArgument('share'); /** @var self $templateLoader */ @@ -88,5 +88,4 @@ class TemplateLoader { $this->publishInitialStateForGuest(); } - } diff --git a/lib/Room.php b/lib/Room.php index 0791b6c67..d087a2112 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -1,4 +1,5 @@ @@ -461,7 +462,6 @@ class Room { * @return bool */ public function setActiveSince(\DateTime $since, bool $isGuest): bool { - if ($isGuest && $this->getType() === self::PUBLIC_CALL) { $query = $this->db->getQueryBuilder(); $query->update('talk_rooms') @@ -758,7 +758,6 @@ class Room { $query->execute(); $this->dispatcher->dispatch(self::EVENT_AFTER_USER_REMOVE, $event); - } /** diff --git a/lib/Service/CommandService.php b/lib/Service/CommandService.php index b7d147cd8..a6b732a6c 100644 --- a/lib/Service/CommandService.php +++ b/lib/Service/CommandService.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Service; - use OCA\Talk\Chat\Command\ShellExecutor; use OCA\Talk\Model\Command; use OCA\Talk\Model\CommandMapper; diff --git a/lib/Settings/Admin/AdminSettings.php b/lib/Settings/Admin/AdminSettings.php index f162ef652..751c187aa 100644 --- a/lib/Settings/Admin/AdminSettings.php +++ b/lib/Settings/Admin/AdminSettings.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Settings\Admin; - use OCA\Talk\Config; use OCA\Talk\Model\Command; use OCA\Talk\Participant; @@ -83,7 +83,7 @@ class AdminSettings implements ISettings { protected function initCommands(): void { $commands = $this->commandService->findAll(); - $result = array_map(function(Command $command) { + $result = array_map(function (Command $command) { return $command->asArray(); }, $commands); @@ -124,5 +124,4 @@ class AdminSettings implements ISettings { public function getPriority(): int { return 0; } - } diff --git a/lib/Settings/Admin/Section.php b/lib/Settings/Admin/Section.php index 2d2de7ecb..167544471 100644 --- a/lib/Settings/Admin/Section.php +++ b/lib/Settings/Admin/Section.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Settings\Admin; - use OCP\IL10N; use OCP\IURLGenerator; use OCP\Settings\IIconSection; diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php index d37fad4e4..59da32032 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -1,4 +1,5 @@ @@ -24,7 +25,6 @@ declare(strict_types=1); namespace OCA\Talk\Settings; - use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\Settings\ISettings; diff --git a/lib/Share/Helper/DeletedShareAPIController.php b/lib/Share/Helper/DeletedShareAPIController.php index f09e276de..6f5254d58 100644 --- a/lib/Share/Helper/DeletedShareAPIController.php +++ b/lib/Share/Helper/DeletedShareAPIController.php @@ -1,4 +1,5 @@ @@ -30,7 +31,6 @@ use OCP\Share\IShare; use Symfony\Component\EventDispatcher\GenericEvent; class Listener { - public static function register(IEventDispatcher $dispatcher): void { $dispatcher->addListener('OCP\Share::preShare', [self::class, 'listenPreShare'], 1000); $dispatcher->addListener(VerifyMountPointEvent::class, [self::class, 'listenVerifyMountPointEvent'], 1000); diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php index 7878e771f..2f93ead11 100644 --- a/lib/Share/RoomShareProvider.php +++ b/lib/Share/RoomShareProvider.php @@ -1,4 +1,5 @@ getRoom(); if ($event->getParticipant()->getParticipantType() === Participant::USER_SELF_JOINED) { @@ -114,7 +115,7 @@ class RoomShareProvider implements IShareProvider { }; $dispatcher->addListener(Room::EVENT_AFTER_ROOM_DISCONNECT, $listener); - $listener = static function(RemoveUserEvent $event) { + $listener = static function (RemoveUserEvent $event) { $room = $event->getRoom(); /** @var self $roomShareProvider */ @@ -123,7 +124,7 @@ class RoomShareProvider implements IShareProvider { }; $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, $listener); - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { $room = $event->getRoom(); /** @var self $roomShareProvider */ @@ -414,7 +415,7 @@ class RoomShareProvider implements IShareProvider { 'permissions' => $qb->createNamedParameter(0), 'stime' => $qb->createNamedParameter($share->getShareTime()->getTimestamp()), ])->execute(); - } else if ($data['permissions'] !== 0) { + } elseif ($data['permissions'] !== 0) { // Already a userroom share. Update it. $qb = $this->dbConnection->getQueryBuilder(); $qb->update('share') @@ -795,7 +796,9 @@ class RoomShareProvider implements IShareProvider { $qb->andWhere($qb->expr()->eq('s.file_source', $qb->createNamedParameter($node->getId()))); } - $rooms = array_map(function(Room $room) { return $room->getToken(); }, $rooms); + $rooms = array_map(function (Room $room) { + return $room->getToken(); + }, $rooms); $qb->andWhere($qb->expr()->eq('s.share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))) ->andWhere($qb->expr()->in('s.share_with', $qb->createNamedParameter( @@ -838,7 +841,7 @@ class RoomShareProvider implements IShareProvider { $pathSections = explode('/', $data['path'], 2); // FIXME: would not detect rare md5'd home storage case properly if ($pathSections[0] !== 'files' - && in_array(explode(':', $data['storage_string_id'], 2)[0], array('home', 'object'))) { + && in_array(explode(':', $data['storage_string_id'], 2)[0], ['home', 'object'])) { return false; } return true; @@ -948,7 +951,7 @@ class RoomShareProvider implements IShareProvider { $cursor = $qb->execute(); $users = []; - while($row = $cursor->fetch()) { + while ($row = $cursor->fetch()) { $type = (int)$row['share_type']; if ($type === IShare::TYPE_ROOM) { $roomToken = $row['share_with']; @@ -963,7 +966,7 @@ class RoomShareProvider implements IShareProvider { $users[$uid] = $users[$uid] ?? []; $users[$uid][$row['id']] = $row; } - } else if ($type === self::SHARE_TYPE_USERROOM && $currentAccess === true) { + } elseif ($type === self::SHARE_TYPE_USERROOM && $currentAccess === true) { $uid = $row['share_with']; $users[$uid] = $users[$uid] ?? []; $users[$uid][$row['id']] = $row; @@ -1070,7 +1073,7 @@ class RoomShareProvider implements IShareProvider { $cursor = $qb->execute(); $ids = []; - while($row = $cursor->fetch()) { + while ($row = $cursor->fetch()) { $ids[] = (int)$row['id']; } $cursor->closeCursor(); @@ -1107,7 +1110,7 @@ class RoomShareProvider implements IShareProvider { $cursor = $qb->execute(); $ids = []; - while($row = $cursor->fetch()) { + while ($row = $cursor->fetch()) { $ids[] = (int)$row['id']; } $cursor->closeCursor(); @@ -1144,7 +1147,7 @@ class RoomShareProvider implements IShareProvider { ); $cursor = $qb->execute(); - while($data = $cursor->fetch()) { + while ($data = $cursor->fetch()) { $share = $this->createShareObject($data); yield $share; diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php index 87d6a4558..718521821 100644 --- a/lib/Signaling/BackendNotifier.php +++ b/lib/Signaling/BackendNotifier.php @@ -1,4 +1,5 @@ @@ -100,7 +101,7 @@ class BackendNotifier { $url = $signaling['server'] . $url; if (strpos($url, 'wss://') === 0) { $url = 'https://' . substr($url, 6); - } else if (strpos($url, 'ws://') === 0) { + } elseif (strpos($url, 'ws://') === 0) { $url = 'http://' . substr($url, 5); } $body = json_encode($data); @@ -328,5 +329,4 @@ class BackendNotifier { ], ]); } - } diff --git a/lib/Signaling/Listener.php b/lib/Signaling/Listener.php index 6b1c8d0c3..3081a4c8d 100644 --- a/lib/Signaling/Listener.php +++ b/lib/Signaling/Listener.php @@ -1,4 +1,5 @@ @@ -27,9 +28,7 @@ use OCA\Talk\Config; use OCA\Talk\Events\AddParticipantsEvent; use OCA\Talk\Events\ChatEvent; use OCA\Talk\Events\ChatParticipantEvent; -use OCA\Talk\Events\ModifyLobbyEvent; use OCA\Talk\Events\ModifyParticipantEvent; -use OCA\Talk\Events\ModifyRoomEvent; use OCA\Talk\Events\ParticipantEvent; use OCA\Talk\Events\RemoveParticipantEvent; use OCA\Talk\Events\RemoveUserEvent; @@ -40,7 +39,6 @@ use OCA\Talk\Room; use OCP\EventDispatcher\IEventDispatcher; class Listener { - public static function register(IEventDispatcher $dispatcher): void { self::registerInternalSignaling($dispatcher); self::registerExternalSignaling($dispatcher); @@ -53,7 +51,7 @@ class Listener { } protected static function registerInternalSignaling(IEventDispatcher $dispatcher): void { - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { if (!self::isUsingInternalSignaling()) { return; } @@ -68,7 +66,7 @@ class Listener { $dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $listener); $dispatcher->addListener(GuestManager::EVENT_AFTER_NAME_UPDATE, $listener); - $listener = static function(ParticipantEvent $event) { + $listener = static function (ParticipantEvent $event) { if (!self::isUsingInternalSignaling()) { return; } @@ -92,7 +90,7 @@ class Listener { $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_REMOVE, $listener); $dispatcher->addListener(Room::EVENT_AFTER_ROOM_DISCONNECT, $listener); - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { $room = $event->getRoom(); if (!self::isUsingInternalSignaling()) { return; @@ -112,7 +110,7 @@ class Listener { } protected static function registerExternalSignaling(IEventDispatcher $dispatcher): void { - $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, static function(AddParticipantsEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, static function (AddParticipantsEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -122,7 +120,7 @@ class Listener { $notifier->roomInvited($event->getRoom(), $event->getParticipants()); }); - $listener = static function(RoomEvent $event) { + $listener = static function (RoomEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -141,7 +139,7 @@ class Listener { // "participantsModified" once the clients no longer expect a // "roomModified" message for participant type changes. $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, $listener); - $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, static function(ModifyParticipantEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, static function (ModifyParticipantEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -158,7 +156,7 @@ class Listener { } $notifier->participantsModified($event->getRoom(), $sessionIds); }); - $dispatcher->addListener(Room::EVENT_BEFORE_ROOM_DELETE, static function(RoomEvent $event) { + $dispatcher->addListener(Room::EVENT_BEFORE_ROOM_DELETE, static function (RoomEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -170,7 +168,7 @@ class Listener { $participants = $room->getParticipantsLegacy(); $notifier->roomDeleted($room, $participants); }); - $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, static function(RemoveUserEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, static function (RemoveUserEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -180,7 +178,7 @@ class Listener { $notifier->roomsDisinvited($event->getRoom(), [$event->getUser()->getUID()]); }); - $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_REMOVE, static function(RemoveParticipantEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_REMOVE, static function (RemoveParticipantEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -191,7 +189,7 @@ class Listener { $notifier->roomSessionsRemoved($event->getRoom(), [$event->getParticipant()->getSessionId()]); }); - $listener = static function(ModifyParticipantEvent $event) { + $listener = static function (ModifyParticipantEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -208,7 +206,7 @@ class Listener { $dispatcher->addListener(Room::EVENT_AFTER_SESSION_JOIN_CALL, $listener); $dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $listener); - $dispatcher->addListener(Room::EVENT_AFTER_GUESTS_CLEAN, static function(RoomEvent $event) { + $dispatcher->addListener(Room::EVENT_AFTER_GUESTS_CLEAN, static function (RoomEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -221,7 +219,7 @@ class Listener { $sessionIds = []; $notifier->participantsModified($event->getRoom(), $sessionIds); }); - $dispatcher->addListener(GuestManager::EVENT_AFTER_NAME_UPDATE, static function(ModifyParticipantEvent $event) { + $dispatcher->addListener(GuestManager::EVENT_AFTER_NAME_UPDATE, static function (ModifyParticipantEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -231,7 +229,7 @@ class Listener { $notifier->participantsModified($event->getRoom(), [$event->getParticipant()->getSessionId()]); }); - $dispatcher->addListener(ChatManager::EVENT_AFTER_MESSAGE_SEND , static function(ChatParticipantEvent $event) { + $dispatcher->addListener(ChatManager::EVENT_AFTER_MESSAGE_SEND , static function (ChatParticipantEvent $event) { if (self::isUsingInternalSignaling()) { return; } @@ -248,7 +246,7 @@ class Listener { ]; $notifier->sendRoomMessage($room, $message); }); - $dispatcher->addListener(ChatManager::EVENT_AFTER_SYSTEM_MESSAGE_SEND, static function(ChatEvent $event) { + $dispatcher->addListener(ChatManager::EVENT_AFTER_SYSTEM_MESSAGE_SEND, static function (ChatEvent $event) { if (self::isUsingInternalSignaling()) { return; } diff --git a/lib/Signaling/Manager.php b/lib/Signaling/Manager.php index f59e8868b..36486c78d 100644 --- a/lib/Signaling/Manager.php +++ b/lib/Signaling/Manager.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Signaling; - use OCA\Talk\Config; use OCA\Talk\Room; use OCP\ICache; diff --git a/lib/Signaling/Messages.php b/lib/Signaling/Messages.php index a1d8d144e..83407e144 100644 --- a/lib/Signaling/Messages.php +++ b/lib/Signaling/Messages.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Signaling; - use OCA\Talk\Room; use OCP\AppFramework\Utility\ITimeFactory; use OCP\DB\QueryBuilder\IQueryBuilder; diff --git a/lib/TInitialState.php b/lib/TInitialState.php index ea24e17ca..5b689e53b 100644 --- a/lib/TInitialState.php +++ b/lib/TInitialState.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk; - use OC\HintException; use OC\User\NoUserException; use OCP\App\IAppManager; @@ -70,7 +70,6 @@ trait TInitialState { } protected function publishInitialStateForUser(IUser $user, IRootFolder $rootFolder, IAppManager $appManager): void { - $this->publishInitialStateShared(); $this->initialStateService->provideInitialState( @@ -103,7 +102,6 @@ trait TInitialState { } protected function publishInitialStateForGuest(): void { - $this->publishInitialStateShared(); $this->initialStateService->provideInitialState( diff --git a/lib/TalkSession.php b/lib/TalkSession.php index 669f1b75c..667001a2e 100644 --- a/lib/TalkSession.php +++ b/lib/TalkSession.php @@ -1,4 +1,5 @@ @@ -22,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk; - use OCP\ISession; class TalkSession { @@ -132,5 +132,4 @@ class TalkSession { $this->session->set($key, json_encode($values)); } - } diff --git a/lib/Webinary.php b/lib/Webinary.php index 7b15053f1..d29866b6a 100644 --- a/lib/Webinary.php +++ b/lib/Webinary.php @@ -1,4 +1,5 @@ @@ -22,10 +23,7 @@ declare(strict_types=1); namespace OCA\Talk; - class Webinary { - public const LOBBY_NONE = 0; public const LOBBY_NON_MODERATORS = 1; - } -- cgit v1.2.3