diff options
author | Joas Schilling <coding@schilljs.com> | 2023-04-14 12:31:25 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-04-18 11:49:15 +0200 |
commit | 788fd58bedf4197c271a3b04a6c9d9a116c98ba7 (patch) | |
tree | b7568a807c10cb8e49d1af48e6523c4dc32d82f7 /lib/Service | |
parent | 799bcbf03aa589541d55dfb6b23b81b262beee18 (diff) |
fix(recording): Type strictness
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/RecordingService.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Service/RecordingService.php b/lib/Service/RecordingService.php index 0e3ef118b..7679f86b0 100644 --- a/lib/Service/RecordingService.php +++ b/lib/Service/RecordingService.php @@ -82,7 +82,7 @@ class RecordingService { public function start(Room $room, int $status, string $owner, Participant $participant): void { $availableRecordingTypes = [Room::RECORDING_VIDEO, Room::RECORDING_AUDIO]; - if (!in_array($status, $availableRecordingTypes)) { + if (!in_array($status, $availableRecordingTypes, true)) { throw new InvalidArgumentException('status'); } if ($room->getCallRecording() !== Room::RECORDING_NONE && $room->getCallRecording() !== Room::RECORDING_FAILED) { @@ -97,7 +97,7 @@ class RecordingService { $this->backendNotifier->start($room, $status, $owner, $participant); - $startingStatus = $status == Room::RECORDING_VIDEO ? Room::RECORDING_VIDEO_STARTING : Room::RECORDING_AUDIO_STARTING; + $startingStatus = $status === Room::RECORDING_VIDEO ? Room::RECORDING_VIDEO_STARTING : Room::RECORDING_AUDIO_STARTING; $this->roomService->setCallRecording($room, $startingStatus); } @@ -130,8 +130,8 @@ class RecordingService { try { $recordingFolder = $this->getRecordingFolder($owner, $room->getToken()); - $file = $recordingFolder->newFile($fileName, $content); - $this->notifyStoredRecording($room, $participant, $file); + $fileNode = $recordingFolder->newFile($fileName, $content); + $this->notifyStoredRecording($room, $participant, $fileNode); } catch (NoUserException $e) { throw new InvalidArgumentException('owner_invalid'); } catch (NotPermittedException $e) { @@ -180,6 +180,10 @@ class RecordingService { } } + /** + * @throws NotPermittedException + * @throws NoUserException + */ private function getRecordingFolder(string $owner, string $token): Folder { $userFolder = $this->rootFolder->getUserFolder($owner); $recordingRootFolderName = $this->config->getRecordingFolder($owner); @@ -265,7 +269,7 @@ class RecordingService { 'messageType' => $this->getTypeOfShare($file->getMimeType()), ], ], - ]); + ], JSON_THROW_ON_ERROR); try { $this->chatManager->addSystemMessage( |