chore(php): Auto-fixes of coding standards

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2024-08-23 14:09:23 +02:00
parent 610aa0f424
commit 956a1ab00f
No known key found for this signature in database
GPG key ID: C400AAF20C1BB6FC
97 changed files with 471 additions and 471 deletions

View file

@ -31,13 +31,13 @@ class Call extends Base {
$parameters = $event->getSubjectParameters();
try {
$room = $this->manager->getRoomForUser((int) $parameters['room'], $this->activityManager->getCurrentUserId());
$room = $this->manager->getRoomForUser((int)$parameters['room'], $this->activityManager->getCurrentUserId());
} catch (RoomNotFoundException) {
$room = null;
}
$result = $this->parseCall($room, $event, $l);
$result['subject'] .= ' ' . $this->getDuration($l, (int) $parameters['duration']);
$result['subject'] .= ' ' . $this->getDuration($l, (int)$parameters['duration']);
// $result['params']['call'] = $roomParameter;
$this->setSubjects($event, $result['subject'], $result['params']);
} else {

View file

@ -28,9 +28,9 @@ class Invitation extends Base {
$l = $this->languageFactory->get('spreed', $language);
$parameters = $event->getSubjectParameters();
$roomParameter = $this->getFormerRoom($l, (int) $parameters['room']);
$roomParameter = $this->getFormerRoom($l, (int)$parameters['room']);
try {
$room = $this->manager->getRoomById((int) $parameters['room']);
$room = $this->manager->getRoomById((int)$parameters['room']);
$roomParameter = $this->getRoom($room, $event->getAffectedUser());
} catch (RoomNotFoundException $e) {
}

View file

@ -118,7 +118,7 @@ class CheckCertificates extends TimedJob {
$signalingServers = $this->talkConfig->getSignalingServers();
foreach ($signalingServers as $signalingServer) {
if ((bool) $signalingServer['verify']) {
if ((bool)$signalingServer['verify']) {
$this->checkServerCertificate($signalingServer['server']);
}
}
@ -126,7 +126,7 @@ class CheckCertificates extends TimedJob {
$recordingServers = $this->talkConfig->getRecordingServers();
foreach ($recordingServers as $recordingServer) {
if ((bool) $recordingServer['verify']) {
if ((bool)$recordingServer['verify']) {
$this->checkServerCertificate($recordingServer['server']);
}
}

View file

@ -90,7 +90,7 @@ class RemoveEmptyRooms extends TimedJob {
return false;
}
$mountsForFile = $this->userMountCache->getMountsForFileId((int) $room->getObjectId());
$mountsForFile = $this->userMountCache->getMountsForFileId((int)$room->getObjectId());
if (!empty($mountsForFile)) {
return false;
}

View file

@ -184,7 +184,7 @@ class Capabilities implements IPublicCapability {
// 'folder' => string,
],
'call' => [
'enabled' => ((int) $this->serverConfig->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE)) !== Room::START_CALL_NOONE,
'enabled' => ((int)$this->serverConfig->getAppValue('spreed', 'start_calls', (string)Room::START_CALL_EVERYONE)) !== Room::START_CALL_NOONE,
'breakout-rooms' => $this->talkConfig->isBreakoutRoomsEnabled(),
'recording' => $this->talkConfig->isRecordingEnabled(),
'recording-consent' => $this->talkConfig->recordingConsentRequired(),

View file

@ -110,7 +110,7 @@ class SearchPlugin implements ISearchPlugin {
$matches = $exactMatches = [];
foreach ($users as $userId => $displayName) {
$userId = (string) $userId;
$userId = (string)$userId;
if ($this->userId !== '' && $this->userId === $userId) {
// Do not suggest the current user
continue;
@ -219,7 +219,7 @@ class SearchPlugin implements ISearchPlugin {
continue;
}
$groupId = (string) $groupId;
$groupId = (string)$groupId;
if ($searchResult->hasResult($type, $groupId)) {
continue;
}

View file

@ -29,7 +29,7 @@ class Manager {
}
public function getChangelogForUser(string $userId): int {
return (int) $this->config->getUserValue($userId, 'spreed', 'changelog', '0');
return (int)$this->config->getUserValue($userId, 'spreed', 'changelog', '0');
}
public function userHasNewChangelog(string $userId): bool {
@ -43,7 +43,7 @@ class Manager {
$hasReceivedLog = $this->getChangelogForUser($userId);
try {
$this->config->setUserValue($userId, 'spreed', 'changelog', (string) count($logs), (string) $hasReceivedLog);
$this->config->setUserValue($userId, 'spreed', 'changelog', (string)count($logs), (string)$hasReceivedLog);
} catch (PreConditionNotMetException $e) {
// Parallel request won the race
return;

View file

@ -109,10 +109,10 @@ class ChatManager {
* Sends a new message to the given chat.
*
* @param bool $shouldSkipLastMessageUpdate If multiple messages will be posted
* (e.g. when adding multiple users to a room) we can skip the last
* message and last activity update until the last entry was created
* and then update with those values.
* This will replace O(n) with 1 database update.
* (e.g. when adding multiple users to a room) we can skip the last
* message and last activity update until the last entry was created
* and then update with those values.
* This will replace O(n) with 1 database update.
* @throws MessagingNotAllowedException
*/
public function addSystemMessage(
@ -133,7 +133,7 @@ class ChatManager {
throw $e;
}
$comment = $this->commentsManager->create($actorType, $actorId, 'chat', (string) $chat->getId());
$comment = $this->commentsManager->create($actorType, $actorId, 'chat', (string)$chat->getId());
$comment->setMessage($message, self::MAX_CHAT_LENGTH);
$comment->setCreationDateTime($creationDateTime);
if ($referenceId !== null) {
@ -200,10 +200,10 @@ class ChatManager {
$alreadyNotifiedUsers = $this->notifier->notifyMentionedUsers($chat, $captionComment ?? $comment, $alreadyNotifiedUsers, $silent);
if (!empty($alreadyNotifiedUsers)) {
$userIds = array_column($alreadyNotifiedUsers, 'id');
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int) $comment->getId(), $usersDirectlyMentioned);
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int)$comment->getId(), $usersDirectlyMentioned);
}
if (!empty($federatedUsersDirectlyMentioned)) {
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentioned, (int) $comment->getId(), $federatedUsersDirectlyMentioned);
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentioned, (int)$comment->getId(), $federatedUsersDirectlyMentioned);
}
$this->notifier->notifyOtherParticipant($chat, $comment, [], $silent);
@ -214,7 +214,7 @@ class ChatManager {
// e.g. sharing an item to the chat
try {
$participant = $this->participantService->getParticipantByActor($chat, $actorType, $actorId);
$this->participantService->updateLastReadMessage($participant, (int) $comment->getId());
$this->participantService->updateLastReadMessage($participant, (int)$comment->getId());
} catch (ParticipantNotFoundException) {
// Participant not found => No read-marker update needed
}
@ -245,7 +245,7 @@ class ChatManager {
* @return IComment
*/
public function addChangelogMessage(Room $chat, string $message): IComment {
$comment = $this->commentsManager->create(Attendee::ACTOR_GUESTS, Attendee::ACTOR_ID_CHANGELOG, 'chat', (string) $chat->getId());
$comment = $this->commentsManager->create(Attendee::ACTOR_GUESTS, Attendee::ACTOR_ID_CHANGELOG, 'chat', (string)$chat->getId());
$comment->setMessage($message, self::MAX_CHAT_LENGTH);
$comment->setCreationDateTime($this->timeFactory->getDateTime());
@ -294,7 +294,7 @@ class ChatManager {
throw $e;
}
$comment = $this->commentsManager->create($actorType, $actorId, 'chat', (string) $chat->getId());
$comment = $this->commentsManager->create($actorType, $actorId, 'chat', (string)$chat->getId());
$comment->setMessage($message, self::MAX_CHAT_LENGTH);
$comment->setCreationDateTime($creationDateTime);
// A verb ('comment', 'like'...) must be provided to be able to save a
@ -340,7 +340,7 @@ class ChatManager {
$this->commentsManager->save($comment);
if ($participant instanceof Participant) {
$this->participantService->updateLastReadMessage($participant, (int) $comment->getId());
$this->participantService->updateLastReadMessage($participant, (int)$comment->getId());
}
// Update last_message
@ -368,10 +368,10 @@ class ChatManager {
$alreadyNotifiedUsers = $this->notifier->notifyMentionedUsers($chat, $comment, $alreadyNotifiedUsers, $silent, $participant);
if (!empty($alreadyNotifiedUsers)) {
$userIds = array_column($alreadyNotifiedUsers, 'id');
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int) $comment->getId(), $usersDirectlyMentioned);
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int)$comment->getId(), $usersDirectlyMentioned);
}
if (!empty($federatedUsersDirectlyMentioned)) {
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentioned, (int) $comment->getId(), $federatedUsersDirectlyMentioned);
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentioned, (int)$comment->getId(), $federatedUsersDirectlyMentioned);
}
// User was not mentioned, send a normal notification
@ -460,7 +460,7 @@ class ChatManager {
],
], JSON_THROW_ON_ERROR),
'chat',
[(string) $room->getId()],
[(string)$room->getId()],
'system',
0
);
@ -517,7 +517,7 @@ class ChatManager {
$this->commentsManager->save($comment);
$this->attachmentService->deleteAttachmentByMessageId((int) $comment->getId());
$this->attachmentService->deleteAttachmentByMessageId((int)$comment->getId());
$this->referenceManager->invalidateCache($chat->getToken());
@ -602,10 +602,10 @@ class ChatManager {
$alreadyNotifiedUsers = $this->notifier->notifyMentionedUsers($chat, $comment, $usersToNotifyBefore, silent: false);
if (!empty($alreadyNotifiedUsers)) {
$userIds = array_column($alreadyNotifiedUsers, 'id');
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int) $comment->getId(), $addedUsersDirectMentioned);
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_USERS, $userIds, (int)$comment->getId(), $addedUsersDirectMentioned);
}
if (!empty($federatedUsersDirectlyMentionedAfter)) {
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentionedAfter, (int) $comment->getId(), $federatedUsersDirectlyMentionedAfter);
$this->participantService->markUsersAsMentioned($chat, Attendee::ACTOR_FEDERATED_USERS, $federatedUsersDirectlyMentionedAfter, (int)$comment->getId(), $federatedUsersDirectlyMentionedAfter);
}
}
}
@ -631,7 +631,7 @@ class ChatManager {
}
public function clearHistory(Room $chat, string $actorType, string $actorId): IComment {
$this->commentsManager->deleteCommentsAtObject('chat', (string) $chat->getId());
$this->commentsManager->deleteCommentsAtObject('chat', (string)$chat->getId());
$this->shareProvider->deleteInRoom($chat->getToken());
@ -660,7 +660,7 @@ class ChatManager {
public function getParentComment(Room $chat, string $parentId): IComment {
$comment = $this->commentsManager->get($parentId);
if ($comment->getObjectType() !== 'chat' || $comment->getObjectId() !== (string) $chat->getId()) {
if ($comment->getObjectType() !== 'chat' || $comment->getObjectId() !== (string)$chat->getId()) {
throw new NotFoundException('Parent not found in the right context');
}
@ -680,7 +680,7 @@ class ChatManager {
$comment = $this->commentsManager->get($messageId);
if ($comment->getObjectType() !== 'chat' || $comment->getObjectId() !== (string) $chat->getId()) {
if ($comment->getObjectType() !== 'chat' || $comment->getObjectId() !== (string)$chat->getId()) {
throw new NotFoundException('Message not found in the right context');
}
@ -688,12 +688,12 @@ class ChatManager {
}
public function getLastReadMessageFromLegacy(Room $chat, IUser $user): int {
$marker = $this->commentsManager->getReadMark('chat', (string) $chat->getId(), $user);
$marker = $this->commentsManager->getReadMark('chat', (string)$chat->getId(), $user);
if ($marker === null) {
return 0;
}
return $this->commentsManager->getLastCommentBeforeDate('chat', (string) $chat->getId(), $marker, self::VERB_MESSAGE);
return $this->commentsManager->getLastCommentBeforeDate('chat', (string)$chat->getId(), $marker, self::VERB_MESSAGE);
}
public function getUnreadCount(Room $chat, int $lastReadMessage): int {
@ -705,7 +705,7 @@ class ChatManager {
$key = $chat->getId() . '-' . $lastReadMessage;
$unreadCount = $this->unreadCountCache->get($key);
if ($unreadCount === null) {
$unreadCount = $this->commentsManager->getNumberOfCommentsWithVerbsForObjectSinceComment('chat', (string) $chat->getId(), $lastReadMessage, [self::VERB_MESSAGE, 'object_shared']);
$unreadCount = $this->commentsManager->getNumberOfCommentsWithVerbsForObjectSinceComment('chat', (string)$chat->getId(), $lastReadMessage, [self::VERB_MESSAGE, 'object_shared']);
$this->unreadCountCache->set($key, $unreadCount, 1800);
}
return $unreadCount;
@ -730,11 +730,11 @@ class ChatManager {
* @param int $limit
* @param bool $includeLastKnown
* @return IComment[] the messages found (only the id, actor type and id,
* creation date and message are relevant), or an empty array if the
* timeout expired.
* creation date and message are relevant), or an empty array if the
* timeout expired.
*/
public function getHistory(Room $chat, int $offset, int $limit, bool $includeLastKnown): array {
return $this->commentsManager->getForObjectSince('chat', (string) $chat->getId(), $offset, 'desc', $limit, $includeLastKnown);
return $this->commentsManager->getForObjectSince('chat', (string)$chat->getId(), $offset, 'desc', $limit, $includeLastKnown);
}
/**
@ -748,7 +748,7 @@ class ChatManager {
public function getPreviousMessageWithVerb(Room $chat, int $offset, array $verbs, bool $offsetIsVerbMatch): IComment {
$messages = $this->commentsManager->getCommentsWithVerbForObjectSinceComment(
'chat',
(string) $chat->getId(),
(string)$chat->getId(),
$verbs,
$offset,
'desc',
@ -780,8 +780,8 @@ class ChatManager {
* @param bool $includeLastKnown
* @param bool $markNotificationsAsRead (defaults to true)
* @return IComment[] the messages found (only the id, actor type and id,
* creation date and message are relevant), or an empty array if the
* timeout expired.
* creation date and message are relevant), or an empty array if the
* timeout expired.
*/
public function waitForNewMessages(Room $chat, int $offset, int $limit, int $timeout, ?IUser $user, bool $includeLastKnown, bool $markNotificationsAsRead = true): array {
if ($markNotificationsAsRead && $user instanceof IUser) {
@ -839,7 +839,7 @@ class ChatManager {
}
// Load data from the database
$comments = $this->commentsManager->getForObjectSince('chat', (string) $chat->getId(), $offset, 'asc', $limit, $includeLastKnown);
$comments = $this->commentsManager->getForObjectSince('chat', (string)$chat->getId(), $offset, 'asc', $limit, $includeLastKnown);
if (empty($comments)) {
// We only write the cache when there were no new comments,
@ -865,13 +865,13 @@ class ChatManager {
protected function waitForNewMessagesWithDatabase(Room $chat, int $offset, int $limit, int $timeout, bool $includeLastKnown): array {
$elapsedTime = 0;
$comments = $this->commentsManager->getForObjectSince('chat', (string) $chat->getId(), $offset, 'asc', $limit, $includeLastKnown);
$comments = $this->commentsManager->getForObjectSince('chat', (string)$chat->getId(), $offset, 'asc', $limit, $includeLastKnown);
while (empty($comments) && $elapsedTime < $timeout) {
sleep(1);
$elapsedTime++;
$comments = $this->commentsManager->getForObjectSince('chat', (string) $chat->getId(), $offset, 'asc', $limit, $includeLastKnown);
$comments = $this->commentsManager->getForObjectSince('chat', (string)$chat->getId(), $offset, 'asc', $limit, $includeLastKnown);
}
return $comments;
@ -883,7 +883,7 @@ class ChatManager {
* @param Room $chat
*/
public function deleteMessages(Room $chat): void {
$this->commentsManager->deleteCommentsAtObject('chat', (string) $chat->getId());
$this->commentsManager->deleteCommentsAtObject('chat', (string)$chat->getId());
$this->shareProvider->deleteInRoom($chat->getToken());

View file

@ -43,7 +43,7 @@ class CommentsManager extends Manager {
$comments = [];
$result = $query->execute();
while ($row = $result->fetch()) {
$comments[(int) $row['id']] = $this->getCommentFromData($row);
$comments[(int)$row['id']] = $this->getCommentFromData($row);
}
$result->closeCursor();
@ -70,8 +70,8 @@ class CommentsManager extends Manager {
$reactions = [];
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$reactions[(int) $row['parent_id']] ??= [];
$reactions[(int) $row['parent_id']][] = $row['reaction'];
$reactions[(int)$row['parent_id']] ??= [];
$reactions[(int)$row['parent_id']][] = $row['reaction'];
}
$result->closeCursor();

View file

@ -555,7 +555,7 @@ class Notifier {
}
protected function getDefaultGroupNotification(): int {
return (int) $this->config->getAppValue('spreed', 'default_group_notification', (string) Participant::NOTIFY_MENTION);
return (int)$this->config->getAppValue('spreed', 'default_group_notification', (string)Participant::NOTIFY_MENTION);
}
/**

View file

@ -524,7 +524,7 @@ class SystemMessage implements IEventListener {
}
} elseif ($message === 'object_shared') {
$parsedParameters['object'] = $parameters['metaData'];
$parsedParameters['object']['id'] = (string) $parsedParameters['object']['id'];
$parsedParameters['object']['id'] = (string)$parsedParameters['object']['id'];
$parsedMessage = '{object}';
if (isset($parsedParameters['object']['type'])
@ -576,10 +576,10 @@ class SystemMessage implements IEventListener {
$parsedMessage = $this->l->t('You deleted a reaction');
}
} elseif ($message === 'message_expiration_enabled') {
$weeks = $parameters['seconds'] >= (86400 * 7) ? (int) round($parameters['seconds'] / (86400 * 7)) : 0;
$days = $parameters['seconds'] >= 86400 ? (int) round($parameters['seconds'] / 86400) : 0;
$hours = $parameters['seconds'] >= 3600 ? (int) round($parameters['seconds'] / 3600) : 0;
$minutes = (int) round($parameters['seconds'] / 60);
$weeks = $parameters['seconds'] >= (86400 * 7) ? (int)round($parameters['seconds'] / (86400 * 7)) : 0;
$days = $parameters['seconds'] >= 86400 ? (int)round($parameters['seconds'] / 86400) : 0;
$hours = $parameters['seconds'] >= 3600 ? (int)round($parameters['seconds'] / 3600) : 0;
$minutes = (int)round($parameters['seconds'] / 60);
if ($currentUserIsActor) {
if ($weeks > 0) {
@ -624,7 +624,7 @@ class SystemMessage implements IEventListener {
}
} elseif ($message === 'poll_closed') {
$parsedParameters['poll'] = $parameters['poll'];
$parsedParameters['poll']['id'] = (string) $parsedParameters['poll']['id'];
$parsedParameters['poll']['id'] = (string)$parsedParameters['poll']['id'];
$parsedMessage = $this->l->t('{actor} ended the poll {poll}');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You ended the poll {poll}');
@ -653,7 +653,7 @@ class SystemMessage implements IEventListener {
$parsedMessage = $this->l->t('The recording failed');
} elseif ($message === 'poll_voted') {
$parsedParameters['poll'] = $parameters['poll'];
$parsedParameters['poll']['id'] = (string) $parsedParameters['poll']['id'];
$parsedParameters['poll']['id'] = (string)$parsedParameters['poll']['id'];
$parsedMessage = $this->l->t('Someone voted on the poll {poll}');
unset($parsedParameters['actor']);
@ -738,7 +738,7 @@ class SystemMessage implements IEventListener {
* @throws ShareNotFound
*/
protected function getFileFromShare(Room $room, ?Participant $participant, string $shareId): array {
$share = $this->shareProvider->getShareById((int) $shareId);
$share = $this->shareProvider->getShareById((int)$shareId);
if ($participant && $participant->getAttendee()->getActorType() === Attendee::ACTOR_USERS) {
if ($share->getShareOwner() !== $participant->getAttendee()->getActorId()) {
@ -800,13 +800,13 @@ class SystemMessage implements IEventListener {
$data = [
'type' => 'file',
'id' => (string) $fileId,
'id' => (string)$fileId,
'name' => $name,
'size' => (string) $size,
'size' => (string)$size,
'path' => $path,
'link' => $url,
'etag' => $node->getEtag(),
'permissions' => (string) $node->getPermissions(),
'permissions' => (string)$node->getPermissions(),
'mimetype' => $node->getMimeType(),
'preview-available' => $isPreviewAvailable ? 'yes' : 'no',
];
@ -816,8 +816,8 @@ class SystemMessage implements IEventListener {
try {
$sizeMetadata = $this->metadataCache->getImageMetadataForFileId($fileId);
if (isset($sizeMetadata['width'], $sizeMetadata['height'])) {
$data['width'] = (string) $sizeMetadata['width'];
$data['height'] = (string) $sizeMetadata['height'];
$data['width'] = (string)$sizeMetadata['width'];
$data['height'] = (string)$sizeMetadata['height'];
}
if (isset($sizeMetadata['blurhash'])) {
@ -832,7 +832,7 @@ class SystemMessage implements IEventListener {
$vObject = Reader::read($vCard);
if (!empty($vObject->FN)) {
$data['contact-name'] = (string) $vObject->FN;
$data['contact-name'] = (string)$vObject->FN;
}
$photo = $this->photoCache->getPhotoFromVObject($vObject);

View file

@ -50,11 +50,11 @@ class ReactionManager {
* @throws ReactionOutOfContextException
*/
public function addReactionMessage(Room $chat, string $actorType, string $actorId, int $messageId, string $reaction): IComment {
$parentMessage = $this->getCommentToReact($chat, (string) $messageId);
$parentMessage = $this->getCommentToReact($chat, (string)$messageId);
try {
// Check if the user already reacted with the same reaction
$this->commentsManager->getReactionComment(
(int) $parentMessage->getId(),
(int)$parentMessage->getId(),
$actorType,
$actorId,
$reaction
@ -67,7 +67,7 @@ class ReactionManager {
$actorType,
$actorId,
'chat',
(string) $chat->getId()
(string)$chat->getId()
);
$comment->setParentId($parentMessage->getId());
$comment->setMessage($reaction);
@ -93,7 +93,7 @@ class ReactionManager {
*/
public function deleteReactionMessage(Room $chat, string $actorType, string $actorId, int $messageId, string $reaction): IComment {
// Just to verify that messageId is part of the room and throw error if not.
$parentComment = $this->getCommentToReact($chat, (string) $messageId);
$parentComment = $this->getCommentToReact($chat, (string)$messageId);
$comment = $this->commentsManager->getReactionComment(
$messageId,
@ -115,7 +115,7 @@ class ReactionManager {
$chat,
$actorType,
$actorId,
json_encode(['message' => 'reaction_revoked', 'parameters' => ['message' => (int) $comment->getId()]]),
json_encode(['message' => 'reaction_revoked', 'parameters' => ['message' => (int)$comment->getId()]]),
$this->timeFactory->getDateTime(),
false,
null,
@ -181,7 +181,7 @@ class ReactionManager {
$comment = $this->commentsManager->get($messageId);
if ($comment->getObjectType() !== 'chat'
|| $comment->getObjectId() !== (string) $chat->getId()
|| $comment->getObjectId() !== (string)$chat->getId()
|| !in_array($comment->getVerb(), [
ChatManager::VERB_MESSAGE,
ChatManager::VERB_OBJECT_SHARED,

View file

@ -382,7 +382,7 @@ class Listener implements IEventListener {
}
if (isset($metaData[Message::METADATA_SILENT])) {
$silent = (bool) $metaData[Message::METADATA_SILENT];
$silent = (bool)$metaData[Message::METADATA_SILENT];
} else {
$silent = false;
}
@ -454,14 +454,14 @@ class Listener implements IEventListener {
// the system message left for the share in the chat.
$referenceId = $this->request->getParam('referenceId', null);
if ($referenceId !== null) {
$referenceId = (string) $referenceId;
$referenceId = (string)$referenceId;
}
$parent = null;
$replyTo = $parameters['metaData']['replyTo'] ?? null;
if ($replyTo !== null) {
try {
$parentComment = $this->chatManager->getParentComment($room, (string) $replyTo);
$parentComment = $this->chatManager->getParentComment($room, (string)$replyTo);
$parentMessage = $this->messageParser->createMessage($room, $participant, $parentComment, $this->l);
$this->messageParser->parseMessage($parentMessage);
if ($parentMessage->isReplyable()) {

View file

@ -93,7 +93,7 @@ class TalkReferenceProvider extends ADiscoverableReferenceProvider implements IS
if ($hashPosition !== false) {
$afterHash = substr($urlOfInterest, $hashPosition + 1);
if (preg_match('/^message_(\d+)$/', $afterHash, $matches)) {
$messageId = (int) $matches[1];
$messageId = (int)$matches[1];
}
}
@ -163,7 +163,7 @@ class TalkReferenceProvider extends ADiscoverableReferenceProvider implements IS
* Description is the plain text chat message
*/
if ($participant && !empty($referenceMatch['message'])) {
$messageId = (string) $referenceMatch['message'];
$messageId = (string)$referenceMatch['message'];
if (!$room->isFederatedConversation()) {
try {
$comment = $this->chatManager->getComment($room, $messageId);
@ -174,7 +174,7 @@ class TalkReferenceProvider extends ADiscoverableReferenceProvider implements IS
$this->messageParser->parseMessage($message);
} else {
try {
$proxy = $this->proxyCacheMessageMapper->findById($room, (int) $messageId);
$proxy = $this->proxyCacheMessageMapper->findById($room, (int)$messageId);
if ($proxy->getLocalToken() !== $room->getToken()) {
throw new RoomNotFoundException();
}

View file

@ -49,7 +49,7 @@ class Remove extends Base {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$botId = (int) $input->getArgument('bot-id');
$botId = (int)$input->getArgument('bot-id');
$tokens = $input->getArgument('token');
try {

View file

@ -52,7 +52,7 @@ class Setup extends Base {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$botId = (int) $input->getArgument('bot-id');
$botId = (int)$input->getArgument('bot-id');
$tokens = $input->getArgument('token');
try {

View file

@ -45,7 +45,7 @@ class Uninstall extends Base {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$botId = (int) $input->getArgument('id');
$botId = (int)$input->getArgument('id');
try {
if ($botId === 0) {

View file

@ -53,7 +53,7 @@ class AgeChatMessages extends Base {
protected function execute(InputInterface $input, OutputInterface $output): int {
$token = $input->getArgument('token');
$hours = (int) $input->getOption('hours');
$hours = (int)$input->getOption('hours');
if ($hours < 1) {
$output->writeln('<error>Invalid age: ' . $hours . '</error>');
return 1;

View file

@ -49,12 +49,12 @@ class Calls extends Base {
$data = [];
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$key = (string) $row['token'];
$key = (string)$row['token'];
if ($input->getOption('output') === Base::OUTPUT_FORMAT_PLAIN) {
$key = '"' . $key . '"';
}
$data[$key] = (int) $row['num_attendees'];
$data[$key] = (int)$row['num_attendees'];
}
$result->closeCursor();

View file

@ -39,7 +39,7 @@ class HasActiveCalls extends Base {
->where($query->expr()->isNotNull('active_since'));
$result = $query->executeQuery();
$numCalls = (int) $result->fetchColumn();
$numCalls = (int)$result->fetchColumn();
$result->closeCursor();
if ($numCalls === 0) {
@ -59,7 +59,7 @@ class HasActiveCalls extends Base {
->andWhere($query->expr()->gt('last_ping', $query->createNamedParameter(time() - 60)));
$result = $query->executeQuery();
$numParticipants = (int) $result->fetchColumn();
$numParticipants = (int)$result->fetchColumn();
$result->closeCursor();

View file

@ -55,7 +55,7 @@ class Room extends Base {
->where($query->expr()->eq('token', $query->createNamedParameter($token)));
$result = $query->executeQuery();
$roomId = (int) $result->fetchOne();
$roomId = (int)$result->fetchOne();
$result->closeCursor();
if ($roomId === 0) {
@ -71,7 +71,7 @@ class Room extends Base {
->where($query->expr()->eq('room_id', $query->createNamedParameter($roomId, IQueryBuilder::PARAM_INT)));
$result = $query->executeQuery();
$numAttendees = (int) $result->fetchOne();
$numAttendees = (int)$result->fetchOne();
$result->closeCursor();
$numSessions = $numSessionsInCall = 0;
@ -83,7 +83,7 @@ class Room extends Base {
->andWhere($query->expr()->gt('s.last_ping', $query->createNamedParameter(time() - 60, IQueryBuilder::PARAM_INT)));
$result = $query->executeQuery();
$numSessions = (int) $result->fetchOne();
$numSessions = (int)$result->fetchOne();
$result->closeCursor();
$query = $this->connection->getQueryBuilder();
@ -95,7 +95,7 @@ class Room extends Base {
->andWhere($query->expr()->gt('s.last_ping', $query->createNamedParameter(time() - 60, IQueryBuilder::PARAM_INT)));
$result = $query->executeQuery();
$numSessionsInCall = (int) $result->fetchOne();
$numSessionsInCall = (int)$result->fetchOne();
$result->closeCursor();
if ($input->getOption('output') === Base::OUTPUT_FORMAT_PLAIN) {

View file

@ -136,7 +136,7 @@ class Create extends Base {
}
if ($messageExpiration !== null) {
$this->setMessageExpiration($room, (int) $messageExpiration);
$this->setMessageExpiration($room, (int)$messageExpiration);
}
} catch (InvalidArgumentException $e) {
$this->roomService->deleteRoom($room);

View file

@ -41,7 +41,7 @@ trait TRoomCommand {
}
/**
* @param Room $room
* @param Room $room
* @param string $name
*
* @throws InvalidArgumentException
@ -74,7 +74,7 @@ trait TRoomCommand {
}
/**
* @param Room $room
* @param Room $room
* @param string $description
*
* @throws InvalidArgumentException
@ -136,7 +136,7 @@ trait TRoomCommand {
}
/**
* @param Room $room
* @param Room $room
* @param string $password
*
* @throws InvalidArgumentException
@ -160,7 +160,7 @@ trait TRoomCommand {
}
/**
* @param Room $room
* @param Room $room
* @param string $userId
*
* @throws InvalidArgumentException
@ -196,7 +196,7 @@ trait TRoomCommand {
}
/**
* @param Room $room
* @param Room $room
* @param string[] $groupIds
*
* @throws InvalidArgumentException
@ -217,7 +217,7 @@ trait TRoomCommand {
}
/**
* @param Room $room
* @param Room $room
* @param string[] $userIds
*
* @throws InvalidArgumentException
@ -264,7 +264,7 @@ trait TRoomCommand {
}
/**
* @param Room $room
* @param Room $room
* @param string[] $userIds
*
* @throws InvalidArgumentException
@ -287,7 +287,7 @@ trait TRoomCommand {
}
/**
* @param Room $room
* @param Room $room
* @param string[] $userIds
*
* @throws InvalidArgumentException
@ -316,7 +316,7 @@ trait TRoomCommand {
}
/**
* @param Room $room
* @param Room $room
* @param string[] $userIds
*
* @throws InvalidArgumentException

View file

@ -154,7 +154,7 @@ class Update extends Base {
}
if ($messageExpiration !== null) {
$this->setMessageExpiration($room, (int) $messageExpiration);
$this->setMessageExpiration($room, (int)$messageExpiration);
}
} catch (InvalidArgumentException $e) {
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));

View file

@ -65,17 +65,17 @@ class Config {
}
public function getUserReadPrivacy(string $userId): int {
return (int) $this->config->getUserValue(
return (int)$this->config->getUserValue(
$userId,
'spreed', 'read_status_privacy',
(string) Participant::PRIVACY_PUBLIC);
(string)Participant::PRIVACY_PUBLIC);
}
public function getUserTypingPrivacy(string $userId): int {
return (int) $this->config->getUserValue(
return (int)$this->config->getUserValue(
$userId,
'spreed', 'typing_privacy',
(string) Participant::PRIVACY_PUBLIC);
(string)Participant::PRIVACY_PUBLIC);
}
@ -211,7 +211,7 @@ class Config {
* @return RecordingService::CONSENT_REQUIRED_*
*/
public function getRecordingConsentConfig(): int {
return match ((int) $this->config->getAppValue('spreed', 'recording_consent', (string) RecordingService::CONSENT_REQUIRED_NO)) {
return match ((int)$this->config->getAppValue('spreed', 'recording_consent', (string)RecordingService::CONSENT_REQUIRED_NO)) {
RecordingService::CONSENT_REQUIRED_YES => RecordingService::CONSENT_REQUIRED_YES,
RecordingService::CONSENT_REQUIRED_OPTIONAL => RecordingService::CONSENT_REQUIRED_OPTIONAL,
default => RecordingService::CONSENT_REQUIRED_NO,
@ -260,7 +260,7 @@ class Config {
// Admin configured default permissions
$configurableDefault = $this->config->getAppValue('spreed', 'default_permissions');
if ($configurableDefault !== '') {
return (int) $configurableDefault;
return (int)$configurableDefault;
}
// Falling back to an unrestricted set of permissions, only ignoring the lobby is off
@ -588,7 +588,7 @@ class Config {
/**
* @param string|null $userId if given, the id of a user in this instance or
* a cloud id.
* a cloud id.
* @return string
*/
private function getSignalingTicketV2(?string $userId): string {
@ -644,7 +644,7 @@ class Config {
}
public function getGridVideosLimit(): int {
return (int) $this->config->getAppValue('spreed', 'grid_videos_limit', '19'); // 5*4 - self
return (int)$this->config->getAppValue('spreed', 'grid_videos_limit', '19'); // 5*4 - self
}
public function getGridVideosLimitEnforced(): bool {

View file

@ -156,7 +156,7 @@ class BotController extends AEnvironmentAwareController {
$parent = null;
if ($replyTo !== 0) {
try {
$parent = $this->chatManager->getParentComment($room, (string) $replyTo);
$parent = $this->chatManager->getParentComment($room, (string)$replyTo);
} catch (NotFoundException $e) {
// Someone is trying to reply cross-rooms or to a non-existing message
return new DataResponse([], Http::STATUS_BAD_REQUEST);
@ -224,7 +224,7 @@ class BotController extends AEnvironmentAwareController {
return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (ReactionAlreadyExistsException) {
return new DataResponse([], Http::STATUS_OK);
} catch (ReactionNotSupportedException | ReactionOutOfContextException | \Exception) {
} catch (ReactionNotSupportedException|ReactionOutOfContextException|\Exception) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
@ -273,7 +273,7 @@ class BotController extends AEnvironmentAwareController {
$messageId,
$reaction
);
} catch (ReactionNotSupportedException | ReactionOutOfContextException | NotFoundException) {
} catch (ReactionNotSupportedException|ReactionOutOfContextException|NotFoundException) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (\Exception) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);

View file

@ -118,9 +118,9 @@ class CallController extends AEnvironmentAwareController {
* @psalm-param int-mask-of<Participant::FLAG_*>|null $flags
* @param bool $silent Join the call silently
* @param bool $recordingConsent When the user ticked a checkbox and agreed with being recorded
* (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES}
* or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL}
* and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} )
* (Only needed when the `config => call => recording-consent` capability is set to {@see RecordingService::CONSENT_REQUIRED_YES}
* or the capability is {@see RecordingService::CONSENT_REQUIRED_OPTIONAL}
* and the conversation `recordingConsent` value is {@see RecordingService::CONSENT_REQUIRED_YES} )
* @return DataResponse<Http::STATUS_OK|Http::STATUS_NOT_FOUND, array<empty>, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{error?: string}, array{}>
*
* 200: Call joined successfully
@ -177,7 +177,7 @@ class CallController extends AEnvironmentAwareController {
* Validates and stores recording consent.
*
* @throws \InvalidArgumentException if recording consent is required but
* not given
* not given
*/
protected function validateRecordingConsent(bool $recordingConsent): void {
if (!$recordingConsent && $this->talkConfig->recordingConsentRequired() !== RecordingService::CONSENT_REQUIRED_NO) {

View file

@ -154,7 +154,7 @@ class ChatController extends AEnvironmentAwareController {
if (!$chatMessage->getVisibility()) {
$headers = [];
if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) {
$headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)];
$headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)];
}
return new DataResponse(null, Http::STATUS_CREATED, $headers);
}
@ -166,7 +166,7 @@ class ChatController extends AEnvironmentAwareController {
$headers = [];
if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) {
$headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)];
$headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)];
}
return new DataResponse($data, Http::STATUS_CREATED, $headers);
}
@ -216,7 +216,7 @@ class ChatController extends AEnvironmentAwareController {
$parent = $parentMessage = null;
if ($replyTo !== 0) {
try {
$parent = $this->chatManager->getParentComment($this->room, (string) $replyTo);
$parent = $this->chatManager->getParentComment($this->room, (string)$replyTo);
} catch (NotFoundException $e) {
// Someone is trying to reply cross-rooms or to a non-existing message
return new DataResponse([], Http::STATUS_BAD_REQUEST);
@ -499,7 +499,7 @@ class ChatController extends AEnvironmentAwareController {
// As per "section 10.3.5 of RFC 2616" entity headers shall be
// stripped out on 304: https://stackoverflow.com/a/17822709
/** @var array{X-Chat-Last-Common-Read?: numeric-string, X-Chat-Last-Given?: numeric-string} $headers */
$headers = ['X-Chat-Last-Common-Read' => (string) $newLastCommonRead];
$headers = ['X-Chat-Last-Common-Read' => (string)$newLastCommonRead];
return new DataResponse([], Http::STATUS_OK, $headers);
}
}
@ -512,7 +512,7 @@ class ChatController extends AEnvironmentAwareController {
$now = $this->timeFactory->getDateTime();
$messages = $commentIdToIndex = $parentIds = [];
foreach ($comments as $comment) {
$id = (int) $comment->getId();
$id = (int)$comment->getId();
$message = $this->messageParser->createMessage($this->room, $this->participant, $comment, $this->l);
$this->messageParser->parseMessage($message);
@ -579,7 +579,7 @@ class ChatController extends AEnvironmentAwareController {
}
$loadedParents[$parentId] = [
'id' => (int) $parentId,
'id' => (int)$parentId,
'deleted' => true,
];
} catch (NotFoundException $e) {
@ -588,7 +588,7 @@ class ChatController extends AEnvironmentAwareController {
// Message is not visible to the user
$messages[$commentKey]['parent'] = [
'id' => (int) $parentId,
'id' => (int)$parentId,
'deleted' => true,
];
}
@ -598,7 +598,7 @@ class ChatController extends AEnvironmentAwareController {
$headers = [];
$newLastKnown = end($comments);
if ($newLastKnown instanceof IComment) {
$headers = ['X-Chat-Last-Given' => (string) (int) $newLastKnown->getId()];
$headers = ['X-Chat-Last-Given' => (string)(int)$newLastKnown->getId()];
if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) {
/**
* This falsely set the read marker on new messages, although you
@ -668,9 +668,9 @@ class ChatController extends AEnvironmentAwareController {
// Create a map, so we can translate the parent's $messageId to the correct child entries
$parentMap = $parentIdsWithReactions = [];
foreach ($parentsWithReactions as $entry) {
$parentMap[(int) $entry['parent']] ??= [];
$parentMap[(int) $entry['parent']][] = (int) $entry['message'];
$parentIdsWithReactions[] = (int) $entry['parent'];
$parentMap[(int)$entry['parent']] ??= [];
$parentMap[(int)$entry['parent']][] = (int)$entry['message'];
$parentIdsWithReactions[] = (int)$entry['parent'];
}
// Unique list for the query
@ -728,7 +728,7 @@ class ChatController extends AEnvironmentAwareController {
}
try {
$message = $this->chatManager->getComment($this->room, (string) $messageId);
$message = $this->chatManager->getComment($this->room, (string)$messageId);
} catch (NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
@ -766,7 +766,7 @@ class ChatController extends AEnvironmentAwareController {
$systemMessage = $this->messageParser->createMessage($this->room, $this->participant, $systemMessageComment, $this->l);
$this->messageParser->parseMessage($systemMessage);
$comment = $this->chatManager->getComment($this->room, (string) $messageId);
$comment = $this->chatManager->getComment($this->room, (string)$messageId);
$message = $this->messageParser->createMessage($this->room, $this->participant, $comment, $this->l);
$this->messageParser->parseMessage($message);
@ -781,7 +781,7 @@ class ChatController extends AEnvironmentAwareController {
$headers = [];
if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) {
$headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)];
$headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)];
}
return new DataResponse($data, $hasBotOrBridge ? Http::STATUS_ACCEPTED : Http::STATUS_OK, $headers);
}
@ -821,7 +821,7 @@ class ChatController extends AEnvironmentAwareController {
}
try {
$comment = $this->chatManager->getComment($this->room, (string) $messageId);
$comment = $this->chatManager->getComment($this->room, (string)$messageId);
} catch (NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
@ -873,7 +873,7 @@ class ChatController extends AEnvironmentAwareController {
$systemMessage = $this->messageParser->createMessage($this->room, $this->participant, $systemMessageComment, $this->l);
$this->messageParser->parseMessage($systemMessage);
$comment = $this->chatManager->getComment($this->room, (string) $messageId);
$comment = $this->chatManager->getComment($this->room, (string)$messageId);
$parseMessage = $this->messageParser->createMessage($this->room, $this->participant, $comment, $this->l);
$this->messageParser->parseMessage($parseMessage);
@ -888,7 +888,7 @@ class ChatController extends AEnvironmentAwareController {
$headers = [];
if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) {
$headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)];
$headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)];
}
return new DataResponse($data, $hasBotOrBridge ? Http::STATUS_ACCEPTED : Http::STATUS_OK, $headers);
}
@ -1051,7 +1051,7 @@ class ChatController extends AEnvironmentAwareController {
$headers = [];
if ($this->participant->getAttendee()->getReadPrivacy() === Participant::PRIVACY_PUBLIC) {
$headers = ['X-Chat-Last-Common-Read' => (string) $this->chatManager->getLastCommonReadMessage($this->room)];
$headers = ['X-Chat-Last-Common-Read' => (string)$this->chatManager->getLastCommonReadMessage($this->room)];
}
return new DataResponse($data, $bridge['enabled'] ? Http::STATUS_ACCEPTED : Http::STATUS_OK, $headers);
}
@ -1087,7 +1087,7 @@ class ChatController extends AEnvironmentAwareController {
$headers = $lastCommonRead = [];
if ($attendee->getReadPrivacy() === Participant::PRIVACY_PUBLIC) {
$lastCommonRead[$this->room->getId()] = $this->chatManager->getLastCommonReadMessage($this->room);
$headers = ['X-Chat-Last-Common-Read' => (string) $lastCommonRead[$this->room->getId()]];
$headers = ['X-Chat-Last-Common-Read' => (string)$lastCommonRead[$this->room->getId()]];
}
return new DataResponse($this->roomFormatter->formatRoom(
@ -1126,7 +1126,7 @@ class ChatController extends AEnvironmentAwareController {
[ChatManager::VERB_MESSAGE],
$message->getVerb() === ChatManager::VERB_MESSAGE
);
$unreadId = (int) $previousMessage->getId();
$unreadId = (int)$previousMessage->getId();
} catch (NotFoundException $e) {
// No chat message found, only system messages.
// Marking unread from beginning
@ -1212,7 +1212,7 @@ class ChatController extends AEnvironmentAwareController {
$headers = [];
if (!empty($messages)) {
$newLastKnown = (string) (int) min(array_keys($messages));
$newLastKnown = (string)(int)min(array_keys($messages));
$headers = ['X-Chat-Last-Given' => $newLastKnown];
}
@ -1243,7 +1243,7 @@ class ChatController extends AEnvironmentAwareController {
continue;
}
$messages[(int) $comment->getId()] = $message->toArray($this->getResponseFormat());
$messages[(int)$comment->getId()] = $message->toArray($this->getResponseFormat());
}
return $messages;
@ -1286,7 +1286,7 @@ class ChatController extends AEnvironmentAwareController {
$this->autoCompleteManager->registerSorter(Sorter::class);
$this->autoCompleteManager->runSorters(['talk_chat_participants'], $results, [
'itemType' => 'chat',
'itemId' => (string) $this->room->getId(),
'itemId' => (string)$this->room->getId(),
'search' => $search,
]);

View file

@ -77,8 +77,8 @@ class FilesIntegrationController extends OCSController {
*
* @param string $fileId ID of the file
* @return DataResponse<Http::STATUS_OK, array{token: string}, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array<empty>, array{}>
* 200: Room token returned
* 400: Rooms not allowed for shares
* 200: Room token returned
* 400: Rooms not allowed for shares
* @throws OCSNotFoundException Share not found
*/
#[NoAdminRequired]
@ -143,9 +143,9 @@ class FilesIntegrationController extends OCSController {
*
* @param string $shareToken Token of the file share
* @return DataResponse<Http::STATUS_OK, array{token: string, userId: string, userDisplayName: string}, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, array<empty>, array{}>
* 200: Room token and user info returned
* 400: Rooms not allowed for shares
* 404: Share not found
* 200: Room token and user info returned
* 400: Rooms not allowed for shares
* 404: Share not found
*/
#[PublicPage]
#[UseSession]

View file

@ -201,7 +201,7 @@ class PageController extends Controller {
}
if ($requirePassword) {
$password = $password !== '' ? $password : (string) $this->talkSession->getPasswordForRoom($token);
$password = $password !== '' ? $password : (string)$this->talkSession->getPasswordForRoom($token);
$passwordVerification = $this->roomService->verifyPassword($room, $password);
@ -356,7 +356,7 @@ class PageController extends Controller {
}
if ($room->hasPassword()) {
$password = $password !== '' ? $password : (string) $this->talkSession->getPasswordForRoom($token);
$password = $password !== '' ? $password : (string)$this->talkSession->getPasswordForRoom($token);
$passwordVerification = $this->roomService->verifyPassword($room, $password);
if ($passwordVerification['result']) {

View file

@ -76,7 +76,7 @@ class ReactionController extends AEnvironmentAwareController {
return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (ReactionAlreadyExistsException $e) {
$status = Http::STATUS_OK;
} catch (ReactionNotSupportedException | ReactionOutOfContextException | \Exception $e) {
} catch (ReactionNotSupportedException|ReactionOutOfContextException|\Exception $e) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
$reactions = $this->reactionManager->retrieveReactionMessages($this->getRoom(), $this->getParticipant(), $messageId);
@ -117,7 +117,7 @@ class ReactionController extends AEnvironmentAwareController {
$reaction
);
$reactions = $this->reactionManager->retrieveReactionMessages($this->getRoom(), $this->getParticipant(), $messageId);
} catch (ReactionNotSupportedException | ReactionOutOfContextException | NotFoundException $e) {
} catch (ReactionNotSupportedException|ReactionOutOfContextException|NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (\Exception $e) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
@ -150,8 +150,8 @@ class ReactionController extends AEnvironmentAwareController {
try {
// Verify that messageId is part of the room
$this->reactionManager->getCommentToReact($this->getRoom(), (string) $messageId);
} catch (ReactionNotSupportedException | ReactionOutOfContextException | NotFoundException $e) {
$this->reactionManager->getCommentToReact($this->getRoom(), (string)$messageId);
} catch (ReactionNotSupportedException|ReactionOutOfContextException|NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}

View file

@ -69,7 +69,7 @@ class RecordingController extends AEnvironmentAwareController {
$url = rtrim($recordingServers[$serverId]['server'], '/');
$url = strtolower($url);
$verifyServer = (bool) $recordingServers[$serverId]['verify'];
$verifyServer = (bool)$recordingServers[$serverId]['verify'];
if ($verifyServer && str_contains($url, 'https://')) {
$expiration = $this->certificateService->getCertificateExpirationInDays($url);

View file

@ -254,11 +254,11 @@ class RoomController extends AEnvironmentAwareController {
}
/** @var array{X-Nextcloud-Talk-Modified-Before: numeric-string, X-Nextcloud-Talk-Federation-Invites?: numeric-string} $headers */
$headers = ['X-Nextcloud-Talk-Modified-Before' => (string) $nextModifiedSince];
$headers = ['X-Nextcloud-Talk-Modified-Before' => (string)$nextModifiedSince];
if ($this->talkConfig->isFederationEnabledForUserId($user)) {
$numInvites = $this->federationManager->getNumberOfPendingInvitationsForUser($user);
if ($numInvites !== 0) {
$headers['X-Nextcloud-Talk-Federation-Invites'] = (string) $numInvites;
$headers['X-Nextcloud-Talk-Federation-Invites'] = (string)$numInvites;
}
}
@ -1019,7 +1019,7 @@ class RoomController extends AEnvironmentAwareController {
// Generate a PIN if the attendee is a user and doesn't have one.
$this->participantService->generatePinForParticipant($this->room, $participant);
$result['attendeePin'] = (string) $participant->getAttendee()->getPin();
$result['attendeePin'] = (string)$participant->getAttendee()->getPin();
}
if ($participant->getSession() instanceof Session) {
@ -1610,7 +1610,7 @@ class RoomController extends AEnvironmentAwareController {
'result' => true,
];
} else {
$result = $this->roomService->verifyPassword($room, (string) $this->session->getPasswordForRoom($token));
$result = $this->roomService->verifyPassword($room, (string)$this->session->getPasswordForRoom($token));
}
$user = $this->userManager->get($this->userId);
@ -2282,7 +2282,7 @@ class RoomController extends AEnvironmentAwareController {
* Set recording consent requirement for this conversation
*
* @param int $recordingConsent New consent setting for the conversation
* (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.)
* (Only {@see RecordingService::CONSENT_REQUIRED_NO} and {@see RecordingService::CONSENT_REQUIRED_YES} are allowed here.)
* @psalm-param RecordingService::CONSENT_REQUIRED_NO|RecordingService::CONSENT_REQUIRED_YES $recordingConsent
* @return DataResponse<Http::STATUS_OK, TalkRoom, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{error: string}, array{}>|DataResponse<Http::STATUS_PRECONDITION_FAILED, array<empty>, array{}>
*

View file

@ -61,7 +61,7 @@ class SettingsController extends OCSController {
$this->config->setUserValue($this->userId, 'spreed', $key, $value);
if ($key === 'read_status_privacy') {
$this->participantService->updateReadPrivacyForActor(Attendee::ACTOR_USERS, $this->userId, (int) $value);
$this->participantService->updateReadPrivacyForActor(Attendee::ACTOR_USERS, $this->userId, (int)$value);
}
return new DataResponse();
@ -95,8 +95,8 @@ class SettingsController extends OCSController {
}
if ($setting === 'typing_privacy' || $setting === 'read_status_privacy') {
return (int) $value === Participant::PRIVACY_PUBLIC ||
(int) $value === Participant::PRIVACY_PRIVATE;
return (int)$value === Participant::PRIVACY_PUBLIC ||
(int)$value === Participant::PRIVACY_PRIVATE;
}
if ($setting === 'play_sounds') {
return $value === 'yes' || $value === 'no';

View file

@ -284,7 +284,7 @@ class SignalingController extends OCSController {
$url = 'http://' . substr($url, 5);
}
$verifyServer = (bool) $signalingServers[$serverId]['verify'];
$verifyServer = (bool)$signalingServers[$serverId]['verify'];
if ($verifyServer && str_contains($url, 'https://')) {
$expiration = $this->certificateService->getCertificateExpirationInDays($url);
@ -866,7 +866,7 @@ class SignalingController extends OCSController {
'room' => [
'version' => '1.0',
'roomid' => $room->getToken(),
'properties' => $room->getPropertiesForSignaling((string) $userId),
'properties' => $room->getPropertiesForSignaling((string)$userId),
'permissions' => $permissions,
],
];

View file

@ -30,7 +30,7 @@ class Authenticator {
}
protected function readHeaders(): void {
$this->isFederationRequest = (bool) $this->request->getHeader('X-Nextcloud-Federation');
$this->isFederationRequest = (bool)$this->request->getHeader('X-Nextcloud-Federation');
if (!$this->isFederationRequest) {
$this->federationCloudId = '';
$this->accessToken = '';

View file

@ -110,7 +110,7 @@ class BackendNotifier {
$response = $this->federationProviderManager->sendCloudShare($share);
if ($response->getStatusCode() === Http::STATUS_CREATED) {
$body = $response->getBody();
$data = json_decode((string) $body, true);
$data = json_decode((string)$body, true);
if (isset($data['recipientUserId']) && $data['recipientUserId'] !== '') {
$shareWithCloudId = $data['recipientUserId'] . '@' . $remote;
}
@ -122,7 +122,7 @@ class BackendNotifier {
$this->logger->warning("Failed sharing $roomToken with $shareWith, received status code {code}\n{body}", [
'code' => $response->getStatusCode(),
'body' => (string) $response->getBody(),
'body' => (string)$response->getBody(),
]);
return false;
@ -152,7 +152,7 @@ class BackendNotifier {
$notification->setMessage(
FederationManager::NOTIFICATION_SHARE_ACCEPTED,
FederationManager::TALK_ROOM_RESOURCE,
(string) $remoteAttendeeId,
(string)$remoteAttendeeId,
[
'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
@ -181,7 +181,7 @@ class BackendNotifier {
$notification->setMessage(
FederationManager::NOTIFICATION_SHARE_DECLINED,
FederationManager::TALK_ROOM_RESOURCE,
(string) $remoteAttendeeId,
(string)$remoteAttendeeId,
[
'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
@ -206,7 +206,7 @@ class BackendNotifier {
$notification->setMessage(
FederationManager::NOTIFICATION_SHARE_UNSHARED,
FederationManager::TALK_ROOM_RESOURCE,
(string) $localAttendeeId,
(string)$localAttendeeId,
[
'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
@ -239,7 +239,7 @@ class BackendNotifier {
$notification->setMessage(
FederationManager::NOTIFICATION_ROOM_MODIFIED,
FederationManager::TALK_ROOM_RESOURCE,
(string) $localAttendeeId,
(string)$localAttendeeId,
[
'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
@ -273,7 +273,7 @@ class BackendNotifier {
$notification->setMessage(
FederationManager::NOTIFICATION_PARTICIPANT_MODIFIED,
FederationManager::TALK_ROOM_RESOURCE,
(string) $localAttendeeId,
(string)$localAttendeeId,
[
'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
@ -310,7 +310,7 @@ class BackendNotifier {
$notification->setMessage(
FederationManager::NOTIFICATION_ROOM_MODIFIED,
FederationManager::TALK_ROOM_RESOURCE,
(string) $localAttendeeId,
(string)$localAttendeeId,
[
'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
@ -349,7 +349,7 @@ class BackendNotifier {
$notification->setMessage(
FederationManager::NOTIFICATION_ROOM_MODIFIED,
FederationManager::TALK_ROOM_RESOURCE,
(string) $localAttendeeId,
(string)$localAttendeeId,
[
'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
@ -387,7 +387,7 @@ class BackendNotifier {
$notification->setMessage(
FederationManager::NOTIFICATION_ROOM_MODIFIED,
FederationManager::TALK_ROOM_RESOURCE,
(string) $localAttendeeId,
(string)$localAttendeeId,
[
'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
@ -395,7 +395,7 @@ class BackendNotifier {
'changedProperty' => $changedProperty,
'newValue' => $newValue,
'oldValue' => $oldValue,
'dateTime' => $dateTime ? (string) $dateTime->getTimestamp() : '',
'dateTime' => $dateTime ? (string)$dateTime->getTimestamp() : '',
'timerReached' => $timerReached,
],
);
@ -425,7 +425,7 @@ class BackendNotifier {
$notification->setMessage(
FederationManager::NOTIFICATION_MESSAGE_POSTED,
FederationManager::TALK_ROOM_RESOURCE,
(string) $localAttendeeId,
(string)$localAttendeeId,
[
'remoteServerUrl' => $this->getServerRemoteUrl(),
'sharedSecret' => $accessToken,
@ -446,7 +446,7 @@ class BackendNotifier {
}
if ($response->getStatusCode() === Http::STATUS_BAD_REQUEST) {
$ocmBody = json_decode((string) $response->getBody(), true) ?? [];
$ocmBody = json_decode((string)$response->getBody(), true) ?? [];
if (isset($ocmBody['message']) && $ocmBody['message'] === FederationManager::OCM_RESOURCE_NOT_FOUND) {
// Remote exists but tells us the OCM notification can not be received (invalid invite data)
// So we stop retrying
@ -456,7 +456,7 @@ class BackendNotifier {
$this->logger->warning("Failed to send notification for share from $remote, received status code {code}\n{body}", [
'code' => $response->getStatusCode(),
'body' => (string) $response->getBody(),
'body' => (string)$response->getBody(),
]);
} catch (OCMProviderException $e) {
$this->logger->error("Failed to send notification for share from $remote, received OCMProviderException", ['exception' => $e]);

View file

@ -115,7 +115,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider {
}
$roomType = $share->getProtocol()['roomType'];
if (!is_numeric($roomType) || !in_array((int) $roomType, $this->validSharedRoomTypes(), true)) {
if (!is_numeric($roomType) || !in_array((int)$roomType, $this->validSharedRoomTypes(), true)) {
$this->logger->debug('Received a federation invite for invalid room type');
throw new ProviderCouldNotAddShareException('roomType is not a valid number', '', Http::STATUS_BAD_REQUEST);
}
@ -133,7 +133,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider {
$cloudId = $this->cloudIdManager->getCloudId($shareWith, null);
$localCloudId = $cloudId->getUser() . '@' . $cloudId->getRemote();
}
$roomType = (int) $roomType;
$roomType = (int)$roomType;
$sharedByDisplayName = $share->getSharedByDisplayName();
$sharedByFederatedId = $share->getSharedBy();
$ownerDisplayName = $share->getOwnerDisplayName();
@ -174,10 +174,10 @@ class CloudFederationProviderTalk implements ICloudFederationProvider {
throw new ProviderCouldNotAddShareException('User does not exist', '', Http::STATUS_BAD_REQUEST);
}
$invite = $this->federationManager->addRemoteRoom($shareWithUser, (int) $remoteId, $roomType, $roomName, $roomDefaultPermissions, $roomToken, $remote, $shareSecret, $sharedByFederatedId, $sharedByDisplayName, $localCloudId);
$invite = $this->federationManager->addRemoteRoom($shareWithUser, (int)$remoteId, $roomType, $roomName, $roomDefaultPermissions, $roomToken, $remote, $shareSecret, $sharedByFederatedId, $sharedByDisplayName, $localCloudId);
$this->notifyAboutNewShare($shareWithUser, (string) $invite->getId(), $sharedByFederatedId, $sharedByDisplayName, $roomName, $roomToken, $remote);
return (string) $invite->getId();
$this->notifyAboutNewShare($shareWithUser, (string)$invite->getId(), $sharedByFederatedId, $sharedByDisplayName, $roomName, $roomToken, $remote);
return (string)$invite->getId();
}
$this->logger->debug('Received a federation invite with missing request data');
@ -193,17 +193,17 @@ class CloudFederationProviderTalk implements ICloudFederationProvider {
}
switch ($notificationType) {
case FederationManager::NOTIFICATION_SHARE_ACCEPTED:
return $this->shareAccepted((int) $providerId, $notification);
return $this->shareAccepted((int)$providerId, $notification);
case FederationManager::NOTIFICATION_SHARE_DECLINED:
return $this->shareDeclined((int) $providerId, $notification);
return $this->shareDeclined((int)$providerId, $notification);
case FederationManager::NOTIFICATION_SHARE_UNSHARED:
return $this->shareUnshared((int) $providerId, $notification);
return $this->shareUnshared((int)$providerId, $notification);
case FederationManager::NOTIFICATION_PARTICIPANT_MODIFIED:
return $this->participantModified((int) $providerId, $notification);
return $this->participantModified((int)$providerId, $notification);
case FederationManager::NOTIFICATION_ROOM_MODIFIED:
return $this->roomModified((int) $providerId, $notification);
return $this->roomModified((int)$providerId, $notification);
case FederationManager::NOTIFICATION_MESSAGE_POSTED:
return $this->messagePosted((int) $providerId, $notification);
return $this->messagePosted((int)$providerId, $notification);
}
throw new BadRequestException([$notificationType]);
@ -461,7 +461,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider {
$lastMessageId = $room->getLastMessageId();
if ($notification['messageData']['remoteMessageId'] > $lastMessageId) {
$lastMessageId = (int) $notification['messageData']['remoteMessageId'];
$lastMessageId = (int)$notification['messageData']['remoteMessageId'];
}
if ($notification['messageData']['systemMessage'] !== 'message_edited'

View file

@ -130,7 +130,7 @@ class FederationManager {
$notification = $this->notificationManager->createNotification();
$notification->setApp(Application::APP_ID)
->setUser($userId)
->setObject('remote_talk_share', (string) $shareId);
->setObject('remote_talk_share', (string)$shareId);
$this->notificationManager->markProcessed($notification);
}

View file

@ -49,7 +49,7 @@ class AvatarController {
);
if ($proxy->getStatusCode() !== Http::STATUS_OK) {
$this->proxy->logUnexpectedStatusCode(__METHOD__, $proxy->getStatusCode(), (string) $proxy->getBody());
$this->proxy->logUnexpectedStatusCode(__METHOD__, $proxy->getStatusCode(), (string)$proxy->getBody());
throw new CannotReachRemoteException('Avatar request had unexpected status code');
}
@ -83,7 +83,7 @@ class AvatarController {
if ($proxy->getStatusCode() !== Http::STATUS_OK) {
if ($proxy->getStatusCode() !== Http::STATUS_NOT_FOUND) {
$this->proxy->logUnexpectedStatusCode(__METHOD__, $proxy->getStatusCode(), (string) $proxy->getBody());
$this->proxy->logUnexpectedStatusCode(__METHOD__, $proxy->getStatusCode(), (string)$proxy->getBody());
}
throw new CannotReachRemoteException('Avatar request had unexpected status code');
}

View file

@ -68,7 +68,7 @@ class CallController {
*
* @param Room $room the federated room to join the call in
* @param Participant $participant the federated user that will join the
* call; the participant must have a session
* call; the participant must have a session
* @param int<0, 15> $flags In-Call flags
* @psalm-param int-mask-of<Participant::FLAG_*> $flags
* @param bool $silent Join the call silently
@ -109,7 +109,7 @@ class CallController {
*
* @param Room $room the federated room to update the call flags in
* @param Participant $participant the federated user to update the call
* flags; the participant must have a session
* flags; the participant must have a session
* @param int<0, 15> $flags New flags
* @psalm-param int-mask-of<Participant::FLAG_*> $flags New flags
* @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, array<empty>, array{}>
@ -146,7 +146,7 @@ class CallController {
*
* @param Room $room the federated room to leave the call in
* @param Participant $participant the federated user that will leave the
* call; the participant must have a session
* call; the participant must have a session
* @return DataResponse<Http::STATUS_OK|Http::STATUS_NOT_FOUND, array<empty>, array{}>
* @throws CannotReachRemoteException
*

View file

@ -93,7 +93,7 @@ class ChatController {
$headers = [];
if ($proxy->getHeader('X-Chat-Last-Common-Read')) {
$headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read');
$headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read');
}
return new DataResponse(
@ -134,7 +134,7 @@ class ChatController {
if ($lookIntoFuture) {
if ($this->proxyCacheMessages instanceof ICache) {
for ($i = 0; $i <= $timeout; $i++) {
$cacheData = (int) $this->proxyCacheMessages->get($cacheKey);
$cacheData = (int)$this->proxyCacheMessages->get($cacheKey);
if ($lastKnownMessageId !== $cacheData) {
break;
}
@ -169,7 +169,7 @@ class ChatController {
0,
false,
false,
(int) ($proxy->getHeader('X-Chat-Last-Given') ?: $lastKnownMessageId),
(int)($proxy->getHeader('X-Chat-Last-Given') ?: $lastKnownMessageId),
);
}
@ -185,14 +185,14 @@ class ChatController {
$headers = [];
if ($proxy->getHeader('X-Chat-Last-Common-Read')) {
$headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read');
$headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read');
}
if ($proxy->getHeader('X-Chat-Last-Given')) {
$headers['X-Chat-Last-Given'] = (string) (int) $proxy->getHeader('X-Chat-Last-Given');
$headers['X-Chat-Last-Given'] = (string)(int)$proxy->getHeader('X-Chat-Last-Given');
if ($lookIntoFuture && $this->proxyCacheMessages instanceof ICache) {
$cacheData = $this->proxyCacheMessages->get($cacheKey);
if ($cacheData === null || $cacheData < $headers['X-Chat-Last-Given']) {
$this->proxyCacheMessages->set($cacheKey, (int) $headers['X-Chat-Last-Given'], 300);
$this->proxyCacheMessages->set($cacheKey, (int)$headers['X-Chat-Last-Given'], 300);
}
}
}
@ -234,10 +234,10 @@ class ChatController {
$headers = [];
if ($proxy->getHeader('X-Chat-Last-Common-Read')) {
$headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read');
$headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read');
}
if ($proxy->getHeader('X-Chat-Last-Given')) {
$headers['X-Chat-Last-Given'] = (string) (int) $proxy->getHeader('X-Chat-Last-Given');
$headers['X-Chat-Last-Given'] = (string)(int)$proxy->getHeader('X-Chat-Last-Given');
}
/** @var TalkChatMessageWithParent[] $data */
@ -297,7 +297,7 @@ class ChatController {
$headers = [];
if ($proxy->getHeader('X-Chat-Last-Common-Read')) {
$headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read');
$headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read');
}
return new DataResponse(
@ -348,7 +348,7 @@ class ChatController {
$headers = [];
if ($proxy->getHeader('X-Chat-Last-Common-Read')) {
$headers['X-Chat-Last-Common-Read'] = (string) (int) $proxy->getHeader('X-Chat-Last-Common-Read');
$headers['X-Chat-Last-Common-Read'] = (string)(int)$proxy->getHeader('X-Chat-Last-Common-Read');
}
return new DataResponse(
@ -390,8 +390,8 @@ class ChatController {
$headers = $lastCommonRead = [];
if ($proxy->getHeader('X-Chat-Last-Common-Read')) {
$lastCommonRead[$room->getId()] = (int) $proxy->getHeader('X-Chat-Last-Common-Read');
$headers['X-Chat-Last-Common-Read'] = (string) $lastCommonRead[$room->getId()];
$lastCommonRead[$room->getId()] = (int)$proxy->getHeader('X-Chat-Last-Common-Read');
$headers['X-Chat-Last-Common-Read'] = (string)$lastCommonRead[$room->getId()];
}
return new DataResponse($this->roomFormatter->formatRoom(
@ -431,8 +431,8 @@ class ChatController {
$headers = $lastCommonRead = [];
if ($proxy->getHeader('X-Chat-Last-Common-Read')) {
$lastCommonRead[$room->getId()] = (int) $proxy->getHeader('X-Chat-Last-Common-Read');
$headers['X-Chat-Last-Common-Read'] = (string) $lastCommonRead[$room->getId()];
$lastCommonRead[$room->getId()] = (int)$proxy->getHeader('X-Chat-Last-Common-Read');
$headers['X-Chat-Last-Common-Read'] = (string)$lastCommonRead[$room->getId()];
}
return new DataResponse($this->roomFormatter->formatRoom(

View file

@ -64,7 +64,7 @@ class RoomController {
*
* @param Room $room the federated room to join
* @param Participant $participant the federated user to will join the room;
* the participant must have a session
* the participant must have a session
* @return DataResponse<Http::STATUS_OK|Http::STATUS_NOT_FOUND, array<empty>, array{X-Nextcloud-Talk-Proxy-Hash: string}>
* @throws CannotReachRemoteException
*
@ -104,7 +104,7 @@ class RoomController {
*
* @param Room $room the federated room to leave
* @param Participant $participant the federated user that will leave the
* room; the participant must have a session
* room; the participant must have a session
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
* @throws CannotReachRemoteException
*

View file

@ -34,7 +34,7 @@ class CancelRetryOCMListener implements IEventListener {
}
$this->retryNotificationMapper->deleteByProviderId(
(string) $event->getAttendee()->getId()
(string)$event->getAttendee()->getId()
);
}
}

View file

@ -77,11 +77,11 @@ class MessageSentListener implements IEventListener {
if ($parent instanceof IComment) {
$metaData[ProxyCacheMessage::METADATA_REPLY_TO_ACTOR_TYPE] = $parent->getActorType();
$metaData[ProxyCacheMessage::METADATA_REPLY_TO_ACTOR_ID] = $parent->getActorId();
$metaData[ProxyCacheMessage::METADATA_REPLY_TO_MESSAGE_ID] = (int) $parent->getId();
$metaData[ProxyCacheMessage::METADATA_REPLY_TO_MESSAGE_ID] = (int)$parent->getId();
}
$messageData = [
'remoteMessageId' => (int) $event->getComment()->getId(),
'remoteMessageId' => (int)$event->getComment()->getId(),
'actorType' => $chatMessage->getActorType(),
'actorId' => $chatMessage->getActorId(),
'actorDisplayName' => $chatMessage->getActorDisplayName(),

View file

@ -37,7 +37,7 @@ class Util {
*/
public function getUsersWithAccessFile(string $fileId): array {
if (!isset($this->accessLists[$fileId])) {
$nodes = $this->rootFolder->getById((int) $fileId);
$nodes = $this->rootFolder->getById((int)$fileId);
if (empty($nodes)) {
return [];
@ -68,7 +68,7 @@ class Util {
public function canGuestsAccessFile(string $fileId): bool {
if (!isset($this->publicAccessLists[$fileId])) {
$nodes = $this->rootFolder->getById((int) $fileId);
$nodes = $this->rootFolder->getById((int)$fileId);
if (empty($nodes)) {
return false;
@ -106,7 +106,7 @@ class Util {
*/
public function getAnyNodeOfFileAccessibleByUser(string $fileId, string $userId): ?Node {
$userFolder = $this->rootFolder->getUserFolder($userId);
$nodes = $userFolder->getById((int) $fileId);
$nodes = $userFolder->getById((int)$fileId);
$nodes = array_filter($nodes, static function (Node $node) {
return $node->getType() === FileInfo::TYPE_FILE;

View file

@ -31,10 +31,10 @@ class DisplayNameListener implements IEventListener {
public function handle(Event $event): void {
if ($event instanceof UserChangedEvent && $event->getFeature() === 'displayName') {
$this->updateCachedName(Attendee::ACTOR_USERS, $event->getUser()->getUID(), (string) $event->getValue());
$this->updateCachedName(Attendee::ACTOR_USERS, $event->getUser()->getUID(), (string)$event->getValue());
}
if ($event instanceof GroupChangedEvent && $event->getFeature() === 'displayName') {
$this->updateCachedName(Attendee::ACTOR_GROUPS, $event->getGroup()->getGID(), (string) $event->getValue());
$this->updateCachedName(Attendee::ACTOR_GROUPS, $event->getGroup()->getGID(), (string)$event->getValue());
}
}

View file

@ -150,7 +150,7 @@ class Manager {
$assignedSignalingServer = $row['assigned_hpb'];
if ($assignedSignalingServer !== null) {
$assignedSignalingServer = (int) $assignedSignalingServer;
$assignedSignalingServer = (int)$assignedSignalingServer;
}
return new Room(
@ -158,37 +158,37 @@ class Manager {
$this->db,
$this->dispatcher,
$this->timeFactory,
(int) $row['r_id'],
(int) $row['type'],
(int) $row['read_only'],
(int) $row['listable'],
(int) $row['message_expiration'],
(int) $row['lobby_state'],
(int) $row['sip_enabled'],
(int)$row['r_id'],
(int)$row['type'],
(int)$row['read_only'],
(int)$row['listable'],
(int)$row['message_expiration'],
(int)$row['lobby_state'],
(int)$row['sip_enabled'],
$assignedSignalingServer,
(string) $row['token'],
(string) $row['name'],
(string) $row['description'],
(string) $row['password'],
(string) $row['avatar'],
(string) $row['remote_server'],
(string) $row['remote_token'],
(int) $row['default_permissions'],
(int) $row['call_permissions'],
(int) $row['call_flag'],
(string)$row['token'],
(string)$row['name'],
(string)$row['description'],
(string)$row['password'],
(string)$row['avatar'],
(string)$row['remote_server'],
(string)$row['remote_token'],
(int)$row['default_permissions'],
(int)$row['call_permissions'],
(int)$row['call_flag'],
$activeSince,
$lastActivity,
(int) $row['last_message'],
(int)$row['last_message'],
$lastMessage,
$lobbyTimer,
(string) $row['object_type'],
(string) $row['object_id'],
(int) $row['breakout_room_mode'],
(int) $row['breakout_room_status'],
(int) $row['call_recording'],
(int) $row['recording_consent'],
(int) $row['has_federation'],
(int) $row['mention_permissions'],
(string)$row['object_type'],
(string)$row['object_id'],
(int)$row['breakout_room_mode'],
(int)$row['breakout_room_status'],
(int)$row['call_recording'],
(int)$row['recording_consent'],
(int)$row['has_federation'],
(int)$row['mention_permissions'],
);
}
@ -1219,7 +1219,7 @@ class Manager {
* @return string
*/
protected function getNewToken(): string {
$entropy = (int) $this->config->getAppValue('spreed', 'token_entropy', '8');
$entropy = (int)$this->config->getAppValue('spreed', 'token_entropy', '8');
$entropy = max(8, $entropy); // For update cases
$digitsOnly = $this->talkConfig->isSIPConfigured();
if ($digitsOnly) {
@ -1250,7 +1250,7 @@ class Manager {
}
$entropy++;
$this->config->setAppValue('spreed', 'token_entropy', (string) $entropy);
$this->config->setAppValue('spreed', 'token_entropy', (string)$entropy);
return $this->generateNewToken($query, $entropy, $digitsOnly);
}

View file

@ -161,12 +161,12 @@ class MatterbridgeManager {
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$bridge = [
'enabled' => (bool) $row['enabled'],
'pid' => (int) $row['pid'],
'enabled' => (bool)$row['enabled'],
'pid' => (int)$row['pid'],
'parts' => json_decode($row['json_values'], true),
];
try {
$room = $this->manager->getRoomById((int) $row['room_id']);
$room = $this->manager->getRoomById((int)$row['room_id']);
} catch (RoomNotFoundException $e) {
continue;
}
@ -519,7 +519,7 @@ class MatterbridgeManager {
private function checkBridgeProcess(Room $room, array $bridge, bool $relaunch = true): int {
$pid = 0;
if (isset($bridge['pid']) && (int) $bridge['pid'] !== 0) {
if (isset($bridge['pid']) && (int)$bridge['pid'] !== 0) {
// config : there is a PID stored
$isRunning = $this->isRunning($bridge['pid']);
// if bridge running and enabled is false : kill it
@ -676,7 +676,7 @@ class MatterbridgeManager {
$cmdResult = $this->runCommand($cmd);
if (!is_null($cmdResult) && $cmdResult['return_code'] === 0 && is_numeric($cmdResult['stdout'] ?? 0)) {
return (int) $cmdResult['stdout'];
return (int)$cmdResult['stdout'];
}
return 0;
}
@ -696,7 +696,7 @@ class MatterbridgeManager {
if (preg_match('/matterbridge/i', $l)) {
$items = preg_split('/\s+/', $l);
if (count($items) > 1 && is_numeric($items[1])) {
$runningPidList[] = (int) $items[1];
$runningPidList[] = (int)$items[1];
}
}
}
@ -724,7 +724,7 @@ class MatterbridgeManager {
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$expectedPidList[] = (int) $row['pid'];
$expectedPidList[] = (int)$row['pid'];
}
$result->closeCursor();
@ -765,7 +765,7 @@ class MatterbridgeManager {
foreach ($lines as $l) {
$items = preg_split('/\s+/', $l);
if (count($items) > 1 && is_numeric($items[1])) {
$lPid = (int) $items[1];
$lPid = (int)$items[1];
if ($lPid === $pid) {
return true;
}
@ -840,8 +840,8 @@ class MatterbridgeManager {
$pid = 0;
$jsonValues = '[]';
if ($row = $result->fetch()) {
$pid = (int) $row['pid'];
$enabled = ((int) $row['enabled'] === 1);
$pid = (int)$row['pid'];
$enabled = ((int)$row['enabled'] === 1);
$jsonValues = $row['json_values'];
}
$result->closeCursor();

View file

@ -91,7 +91,7 @@ class CanUseTalkMiddleware extends Middleware {
$hasAttribute = !empty($reflectionMethod->getAttributes(RequireCallEnabled::class));
if ($hasAttribute
&& ((int) $this->serverConfig->getAppValue('spreed', 'start_calls')) === Room::START_CALL_NOONE) {
&& ((int)$this->serverConfig->getAppValue('spreed', 'start_calls')) === Room::START_CALL_NOONE) {
throw new CanNotUseTalkException();
}
}

View file

@ -93,7 +93,7 @@ class InjectionMiddleware extends Middleware {
$reflectionMethod = new \ReflectionMethod($controller, $methodName);
$apiVersion = $this->request->getParam('apiVersion');
$controller->setAPIVersion((int) substr($apiVersion, 1));
$controller->setAPIVersion((int)substr($apiVersion, 1));
if (!empty($reflectionMethod->getAttributes(AllowWithoutParticipantWhenPendingInvitation::class))) {
try {

View file

@ -29,7 +29,7 @@ class ClearResourceAccessCache implements IRepairStep {
}
public function run(IOutput $output): void {
$invalidatedCache = (int) $this->config->getAppValue('spreed', 'project_access_invalidated', '0');
$invalidatedCache = (int)$this->config->getAppValue('spreed', 'project_access_invalidated', '0');
if ($invalidatedCache === self::INVALIDATIONS) {
$output->info('Invalidation not required');
@ -37,6 +37,6 @@ class ClearResourceAccessCache implements IRepairStep {
}
$this->manager->invalidateAccessCacheForProvider($this->provider);
$this->config->setAppValue('spreed', 'project_access_invalidated', (string) self::INVALIDATIONS);
$this->config->setAppValue('spreed', 'project_access_invalidated', (string)self::INVALIDATIONS);
}
}

View file

@ -191,15 +191,15 @@ class Version10000Date20201015134000 extends SimpleMigrationStep {
}
$insert
->setParameter('room_id', (int) $row['room_id'], IQueryBuilder::PARAM_INT)
->setParameter('room_id', (int)$row['room_id'], IQueryBuilder::PARAM_INT)
->setParameter('actor_type', Attendee::ACTOR_USERS)
->setParameter('actor_id', $row['user_id'])
->setParameter('participant_type', (int) $row['participant_type'], IQueryBuilder::PARAM_INT)
->setParameter('favorite', (bool) $row['favorite'], IQueryBuilder::PARAM_BOOL)
->setParameter('notification_level', (int) $row['notification_level'], IQueryBuilder::PARAM_INT)
->setParameter('participant_type', (int)$row['participant_type'], IQueryBuilder::PARAM_INT)
->setParameter('favorite', (bool)$row['favorite'], IQueryBuilder::PARAM_BOOL)
->setParameter('notification_level', (int)$row['notification_level'], IQueryBuilder::PARAM_INT)
->setParameter('last_joined_call', $lastJoinedCall, IQueryBuilder::PARAM_INT)
->setParameter('last_read_message', (int) $row['last_read_message'], IQueryBuilder::PARAM_INT)
->setParameter('last_mention_message', (int) $row['last_mention_message'], IQueryBuilder::PARAM_INT)
->setParameter('last_read_message', (int)$row['last_read_message'], IQueryBuilder::PARAM_INT)
->setParameter('last_mention_message', (int)$row['last_mention_message'], IQueryBuilder::PARAM_INT)
;
try {

View file

@ -118,8 +118,8 @@ class Version14000Date20220330141647 extends SimpleMigrationStep {
$result = $select->executeQuery();
while ($row = $result->fetch()) {
$attachment = [
'room_id' => (int) $row['object_id'],
'message_id' => (int) $row['id'],
'room_id' => (int)$row['object_id'],
'message_id' => (int)$row['id'],
'actor_type' => $row['actor_type'],
'actor_id' => $row['actor_id'],
];
@ -152,13 +152,13 @@ class Version14000Date20220330141647 extends SimpleMigrationStep {
$attachment['object_type'] = Attachment::TYPE_MEDIA;
} else {
if ($mimetype === '' && isset($parameters['share'])) {
$sharesWithoutMimetype[(int) $parameters['share']] = (int) $row['id'];
$sharesWithoutMimetype[(int)$parameters['share']] = (int)$row['id'];
}
$attachment['object_type'] = Attachment::TYPE_FILE;
}
}
$attachments[(int) $row['id']] = $attachment;
$attachments[(int)$row['id']] = $attachment;
}
$result->closeCursor();

View file

@ -53,7 +53,7 @@ class Version2000Date20171026140256 extends SimpleMigrationStep {
continue;
}
$update->setParameter('room_id', (int) $row['id'], IQueryBuilder::PARAM_INT)
$update->setParameter('room_id', (int)$row['id'], IQueryBuilder::PARAM_INT)
->executeStatement();
}
$output->finishProgress();

View file

@ -40,7 +40,7 @@ class Version2000Date20171026140257 extends SimpleMigrationStep {
}
$chars = str_replace(['l', '0', '1'], '', ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS);
$entropy = (int) $this->config->getAppValue('spreed', 'token_entropy', '8');
$entropy = (int)$this->config->getAppValue('spreed', 'token_entropy', '8');
$update = $this->connection->getQueryBuilder();
$update->update('spreedme_rooms')
@ -61,7 +61,7 @@ class Version2000Date20171026140257 extends SimpleMigrationStep {
$token = $this->getNewToken($entropy, $chars);
$update->setParameter('token', $token)
->setParameter('room_id', (int) $row['id'], IQueryBuilder::PARAM_INT)
->setParameter('room_id', (int)$row['id'], IQueryBuilder::PARAM_INT)
->executeStatement();
}
$output->finishProgress();

View file

@ -65,9 +65,9 @@ class Version2001Date20170707115443 extends SimpleMigrationStep {
$query->selectAlias($query->createFunction('COUNT(*)'), 'num_rooms')
->from('spreedme_rooms');
$result = $query->executeQuery();
$return = (int) $result->fetch();
$return = (int)$result->fetch();
$result->closeCursor();
$numRooms = (int) $return['num_rooms'];
$numRooms = (int)$return['num_rooms'];
if ($numRooms === 0) {
return;
@ -80,7 +80,7 @@ class Version2001Date20170707115443 extends SimpleMigrationStep {
$one2oneRooms = [];
while ($row = $result->fetch()) {
$one2oneRooms[] = (int) $row['id'];
$one2oneRooms[] = (int)$row['id'];
}
$result->closeCursor();

View file

@ -176,7 +176,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
$insert
->setParameter('name', $row['name'])
->setParameter('token', $row['token'])
->setParameter('type', (int) $row['type'], IQueryBuilder::PARAM_INT)
->setParameter('type', (int)$row['type'], IQueryBuilder::PARAM_INT)
->setParameter('password', $row['password']);
$insert->executeStatement();
@ -218,20 +218,20 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
$result = $query->executeQuery();
while ($row = $result->fetch()) {
if (!isset($roomIdMap[(int) $row['roomId']])) {
if (!isset($roomIdMap[(int)$row['roomId']])) {
continue;
}
$insert
->setParameter('userId', $row['userId'])
->setParameter('roomId', $roomIdMap[(int) $row['roomId']], IQueryBuilder::PARAM_INT)
->setParameter('lastPing', (int) $row['lastPing'], IQueryBuilder::PARAM_INT)
->setParameter('roomId', $roomIdMap[(int)$row['roomId']], IQueryBuilder::PARAM_INT)
->setParameter('lastPing', (int)$row['lastPing'], IQueryBuilder::PARAM_INT)
->setParameter('sessionId', $row['sessionId'])
;
if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_POSTGRES) {
$insert->setParameter('participantType', (int) $row['participantType'], IQueryBuilder::PARAM_INT);
$insert->setParameter('participantType', (int)$row['participantType'], IQueryBuilder::PARAM_INT);
} else {
$insert->setParameter('participantType', (int) $row['participanttype'], IQueryBuilder::PARAM_INT);
$insert->setParameter('participantType', (int)$row['participanttype'], IQueryBuilder::PARAM_INT);
}
$insert->executeStatement();
}
@ -264,17 +264,17 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
}
while ($row = $result->fetch()) {
if (!isset($roomIdMap[(int) $row['object_id']])) {
if (!isset($roomIdMap[(int)$row['object_id']])) {
$delete
->setParameter('id', (int) $row['notification_id'])
->setParameter('id', (int)$row['notification_id'])
;
$delete->executeStatement();
continue;
}
$update
->setParameter('id', (int) $row['notification_id'])
->setParameter('newId', $roomIdMap[(int) $row['object_id']])
->setParameter('id', (int)$row['notification_id'])
->setParameter('newId', $roomIdMap[(int)$row['object_id']])
;
$update->executeStatement();
}
@ -309,9 +309,9 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
}
while ($row = $result->fetch()) {
if (!isset($roomIdMap[(int) $row['object_id']])) {
if (!isset($roomIdMap[(int)$row['object_id']])) {
$delete
->setParameter('id', (int) $row['activity_id'])
->setParameter('id', (int)$row['activity_id'])
;
$delete->executeStatement();
continue;
@ -321,17 +321,17 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
if (!isset($params['room'])) {
$delete
->setParameter('id', (int) $row['activity_id'])
->setParameter('id', (int)$row['activity_id'])
;
$delete->executeStatement();
continue;
}
$params['room'] = $roomIdMap[(int) $row['object_id']];
$params['room'] = $roomIdMap[(int)$row['object_id']];
$update
->setParameter('id', (int) $row['activity_id'])
->setParameter('newId', $roomIdMap[(int) $row['object_id']])
->setParameter('id', (int)$row['activity_id'])
->setParameter('newId', $roomIdMap[(int)$row['object_id']])
->setParameter('subjectParams', json_encode($params))
;
$update->executeStatement();
@ -367,18 +367,18 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
while ($row = $result->fetch()) {
$params = json_decode($row['subjectparams'], true);
if (!isset($params['room']) || !isset($roomIdMap[(int) $params['room']])) {
if (!isset($params['room']) || !isset($roomIdMap[(int)$params['room']])) {
$delete
->setParameter('id', (int) $row['mail_id'])
->setParameter('id', (int)$row['mail_id'])
;
$delete->executeStatement();
continue;
}
$params['room'] = $roomIdMap[(int) $params['room']];
$params['room'] = $roomIdMap[(int)$params['room']];
$update
->setParameter('id', (int) $row['mail_id'])
->setParameter('id', (int)$row['mail_id'])
->setParameter('subjectParams', json_encode($params))
;
$update->executeStatement();

View file

@ -79,9 +79,9 @@ class Version7000Date20190724121136 extends SimpleMigrationStep {
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$update->setParameter('message_id', (int) $row['last_comment'], IQueryBuilder::PARAM_INT)
$update->setParameter('message_id', (int)$row['last_comment'], IQueryBuilder::PARAM_INT)
->setParameter('user_id', $row['user_id'])
->setParameter('room_id', (int) $row['object_id'], IQueryBuilder::PARAM_INT);
->setParameter('room_id', (int)$row['object_id'], IQueryBuilder::PARAM_INT);
$update->executeStatement();
}
$result->closeCursor();

View file

@ -50,9 +50,9 @@ class Version7000Date20190724121137 extends SimpleMigrationStep {
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$update->setParameter('message_id', (int) $row['last_mention_message'], IQueryBuilder::PARAM_INT)
$update->setParameter('message_id', (int)$row['last_mention_message'], IQueryBuilder::PARAM_INT)
->setParameter('user_id', $row['user_id'])
->setParameter('room_id', (int) $row['room_id'], IQueryBuilder::PARAM_INT);
->setParameter('room_id', (int)$row['room_id'], IQueryBuilder::PARAM_INT);
$update->executeStatement();
}
$result->closeCursor();

View file

@ -31,13 +31,13 @@ class AttachmentMapper extends QBMapper {
public function createAttachmentFromRow(array $row): Attachment {
return $this->mapRowToEntity([
'id' => (int) $row['id'],
'room_id' => (int) $row['room_id'],
'message_id' => (int) $row['message_id'],
'message_time' => (int) $row['message_time'],
'object_type' => (string) $row['object_type'],
'actor_type' => (string) $row['actor_type'],
'actor_id' => (string) $row['actor_id'],
'id' => (int)$row['id'],
'room_id' => (int)$row['room_id'],
'message_id' => (int)$row['message_id'],
'message_time' => (int)$row['message_time'],
'object_type' => (string)$row['object_type'],
'actor_type' => (string)$row['actor_type'],
'actor_id' => (string)$row['actor_id'],
]);
}

View file

@ -150,6 +150,6 @@ class Attendee extends Entity {
}
public function getDisplayName(): string {
return (string) $this->displayName;
return (string)$this->displayName;
}
}

View file

@ -158,7 +158,7 @@ class AttendeeMapper extends QBMapper {
}
$result = $query->executeQuery();
$count = (int) $result->fetchOne();
$count = (int)$result->fetchOne();
$result->closeCursor();
return $count;
@ -187,7 +187,7 @@ class AttendeeMapper extends QBMapper {
$row = $result->fetch();
$result->closeCursor();
return (int) ($row['num_actors'] ?? 0);
return (int)($row['num_actors'] ?? 0);
}
/**
@ -304,26 +304,26 @@ class AttendeeMapper extends QBMapper {
'room_id' => $row['room_id'],
'actor_type' => $row['actor_type'],
'actor_id' => $row['actor_id'],
'display_name' => (string) $row['display_name'],
'display_name' => (string)$row['display_name'],
'pin' => $row['pin'],
'participant_type' => (int) $row['participant_type'],
'favorite' => (bool) $row['favorite'],
'notification_level' => (int) $row['notification_level'],
'notification_calls' => (int) $row['notification_calls'],
'last_joined_call' => (int) $row['last_joined_call'],
'last_read_message' => (int) $row['last_read_message'],
'last_mention_message' => (int) $row['last_mention_message'],
'last_mention_direct' => (int) $row['last_mention_direct'],
'read_privacy' => (int) $row['read_privacy'],
'permissions' => (int) $row['permissions'],
'access_token' => (string) $row['access_token'],
'remote_id' => (string) $row['remote_id'],
'invited_cloud_id' => (string) $row['invited_cloud_id'],
'participant_type' => (int)$row['participant_type'],
'favorite' => (bool)$row['favorite'],
'notification_level' => (int)$row['notification_level'],
'notification_calls' => (int)$row['notification_calls'],
'last_joined_call' => (int)$row['last_joined_call'],
'last_read_message' => (int)$row['last_read_message'],
'last_mention_message' => (int)$row['last_mention_message'],
'last_mention_direct' => (int)$row['last_mention_direct'],
'read_privacy' => (int)$row['read_privacy'],
'permissions' => (int)$row['permissions'],
'access_token' => (string)$row['access_token'],
'remote_id' => (string)$row['remote_id'],
'invited_cloud_id' => (string)$row['invited_cloud_id'],
'phone_number' => $row['phone_number'],
'call_id' => $row['call_id'],
'state' => (int) $row['state'],
'unread_messages' => (int) $row['unread_messages'],
'last_attendee_activity' => (int) $row['last_attendee_activity'],
'state' => (int)$row['state'],
'unread_messages' => (int)$row['unread_messages'],
'last_attendee_activity' => (int)$row['last_attendee_activity'],
]);
}
}

View file

@ -93,7 +93,7 @@ class InvitationMapper extends QBMapper {
}
$result = $qb->executeQuery();
$count = (int) $result->fetchOne();
$count = (int)$result->fetchOne();
$result->closeCursor();
return $count;
@ -128,6 +128,6 @@ class InvitationMapper extends QBMapper {
$row = $result->fetch();
$result->closeCursor();
return (int) ($row['num_invitations'] ?? 0);
return (int)($row['num_invitations'] ?? 0);
}
}

View file

@ -95,7 +95,7 @@ class Message {
*/
public function getMessageId(): int {
return $this->comment ? (int) $this->comment->getId() : $this->proxy->getRemoteMessageId();
return $this->comment ? (int)$this->comment->getId() : $this->proxy->getRemoteMessageId();
}
public function getExpirationDateTime(): ?\DateTimeInterface {
@ -194,7 +194,7 @@ class Message {
}
$data = [
'id' => (int) $this->getComment()->getId(),
'id' => (int)$this->getComment()->getId(),
'token' => $this->getRoom()->getToken(),
'actorType' => $this->getActorType(),
'actorId' => $this->getActorId(),
@ -205,7 +205,7 @@ class Message {
'systemMessage' => $this->getMessageType() === ChatManager::VERB_SYSTEM ? $this->getMessageRaw() : '',
'messageType' => $this->getMessageType(),
'isReplyable' => $this->isReplyable(),
'referenceId' => (string) $this->getComment()->getReferenceId(),
'referenceId' => (string)$this->getComment()->getReferenceId(),
'reactions' => $reactions,
'expirationTimestamp' => $expireDate ? $expireDate->getTimestamp() : 0,
'markdown' => $this->getMessageType() === ChatManager::VERB_SYSTEM ? false : true,

View file

@ -91,10 +91,10 @@ class SessionMapper extends QBMapper {
return $this->mapRowToEntity([
'id' => $row['s_id'],
'session_id' => $row['session_id'],
'attendee_id' => (int) $row['a_id'],
'in_call' => (int) $row['in_call'],
'last_ping' => (int) $row['last_ping'],
'state' => (int) $row['s_state'],
'attendee_id' => (int)$row['a_id'],
'in_call' => (int)$row['in_call'],
'last_ping' => (int)$row['last_ping'],
'state' => (int)$row['s_state'],
]);
}
}

View file

@ -133,7 +133,7 @@ class Notifier implements INotifier {
try {
// Before 3.2.3 the id was passed in notifications
$room = $this->manager->getRoomById((int) $objectId);
$room = $this->manager->getRoomById((int)$objectId);
$this->rooms[$objectId] = $room;
return $room;
} catch (RoomNotFoundException $e) {
@ -401,7 +401,7 @@ class Notifier implements INotifier {
$subjectParameters = $notification->getSubjectParameters();
try {
$invite = $this->federationManager->getRemoteShareById((int) $notification->getObjectId());
$invite = $this->federationManager->getRemoteShareById((int)$notification->getObjectId());
if ($invite->getUserId() !== $notification->getUser()) {
throw new AlreadyProcessedException();
}
@ -441,7 +441,7 @@ class Notifier implements INotifier {
$acceptAction->setParsedLabel($l->t('Accept'));
$acceptAction->setLink($this->url->linkToOCSRouteAbsolute(
'spreed.Federation.acceptShare',
['apiVersion' => 'v1', 'id' => (int) $notification->getObjectId()]
['apiVersion' => 'v1', 'id' => (int)$notification->getObjectId()]
), IAction::TYPE_POST);
$acceptAction->setPrimary(true);
$notification->addParsedAction($acceptAction);
@ -450,7 +450,7 @@ class Notifier implements INotifier {
$declineAction->setParsedLabel($l->t('Decline'));
$declineAction->setLink($this->url->linkToOCSRouteAbsolute(
'spreed.Federation.rejectShare',
['apiVersion' => 'v1', 'id' => (int) $notification->getObjectId()]
['apiVersion' => 'v1', 'id' => (int)$notification->getObjectId()]
), IAction::TYPE_DELETE);
$notification->addParsedAction($declineAction);
@ -488,7 +488,7 @@ class Notifier implements INotifier {
* @see Listener::markReactionNotificationsRead()
*/
&& $notification->getSubject() !== 'reaction'
&& ((int) $messageParameters['commentId']) <= $participant->getAttendee()->getLastReadMessage()) {
&& ((int)$messageParameters['commentId']) <= $participant->getAttendee()->getLastReadMessage()) {
// Mark notifications of messages that are read as processed
throw new AlreadyProcessedException();
}

View file

@ -80,7 +80,7 @@ class Participant {
return false;
}
$defaultStartCall = (int) $config->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE);
$defaultStartCall = (int)$config->getAppValue('spreed', 'start_calls', (string)Room::START_CALL_EVERYONE);
if ($defaultStartCall === Room::START_CALL_NOONE) {
return false;

View file

@ -50,7 +50,7 @@ class BackendNotifier {
$client = $this->clientService->newClient();
try {
$response = $client->post($url, $params);
} catch (ServerException | ConnectException $e) {
} catch (ServerException|ConnectException $e) {
if ($retries > 1) {
$this->logger->error('Failed to send message to recording server, ' . $retries . ' retries left!', ['exception' => $e]);
$this->doRequest($url, $params, $retries - 1);

View file

@ -156,9 +156,9 @@ class Room {
/**
* @param int $readOnly Currently it is only allowed to change between
* `self::READ_ONLY` and `self::READ_WRITE`
* Also it's only allowed on rooms of type
* `self::TYPE_GROUP` and `self::TYPE_PUBLIC`
* `self::READ_ONLY` and `self::READ_WRITE`
* Also it's only allowed on rooms of type
* `self::TYPE_GROUP` and `self::TYPE_PUBLIC`
*/
public function setReadOnly(int $readOnly): void {
$this->readOnly = $readOnly;
@ -170,8 +170,8 @@ class Room {
/**
* @param int $newState New listable scope from self::LISTABLE_*
* Also it's only allowed on rooms of type
* `self::TYPE_GROUP` and `self::TYPE_PUBLIC`
* Also it's only allowed on rooms of type
* `self::TYPE_GROUP` and `self::TYPE_PUBLIC`
*/
public function setListable(int $newState): void {
$this->listable = $newState;
@ -362,7 +362,7 @@ class Room {
public function setLastMessage(IComment $message): void {
$this->lastMessage = $message;
$this->lastMessageId = (int) $message->getId();
$this->lastMessageId = (int)$message->getId();
}
public function getObjectType(): string {

View file

@ -159,7 +159,7 @@ class MessageSearch implements IProvider, IFilteringProvider {
continue;
}
$roomMap[(string) $room->getId()] = $room;
$roomMap[(string)$room->getId()] = $room;
}
if (empty($roomMap)) {
@ -187,7 +187,7 @@ class MessageSearch implements IProvider, IFilteringProvider {
}
}
$offset = (int) $query->getCursor();
$offset = (int)$query->getCursor();
$comments = $this->chatManager->searchForObjectsWithFilters(
$query->getTerm(),
array_keys($roomMap),
@ -223,7 +223,7 @@ class MessageSearch implements IProvider, IFilteringProvider {
protected function commentToSearchResultEntry(Room $room, IUser $user, IComment $comment, ISearchQuery $query): SearchResultEntry {
$participant = $this->participantService->getParticipant($room, $user->getUID(), false);
$id = (int) $comment->getId();
$id = (int)$comment->getId();
$message = $this->messageParser->createMessage($room, $participant, $comment, $this->l);
$this->messageParser->parseMessage($message);

View file

@ -27,7 +27,7 @@ class AttachmentService {
$attachment->setRoomId($room->getId());
$attachment->setActorType($comment->getActorType());
$attachment->setActorId($comment->getActorId());
$attachment->setMessageId((int) $comment->getId());
$attachment->setMessageId((int)$comment->getId());
$attachment->setMessageTime($comment->getCreationDateTime()->getTimestamp());
if ($messageType === 'object_shared') {

View file

@ -175,7 +175,7 @@ class BotService {
/**
* @param BotServer $botServer
* @param array $body
* #param string|null $jsonBody
* #param string|null $jsonBody
*/
protected function sendAsyncRequest(BotServer $botServer, array $body, ?string $jsonBody = null): void {
$jsonBody = $jsonBody ?? json_encode($body, JSON_THROW_ON_ERROR);

View file

@ -159,7 +159,7 @@ class BreakoutRoomService {
continue;
}
$roomNumber = (int) $cleanedMap[$participant->getAttendee()->getId()];
$roomNumber = (int)$cleanedMap[$participant->getAttendee()->getId()];
$map[$roomNumber] ??= [];
$map[$roomNumber][] = $participant;
@ -233,7 +233,7 @@ class BreakoutRoomService {
continue;
}
$roomNumber = (int) $cleanedMap[$participant->getAttendee()->getId()];
$roomNumber = (int)$cleanedMap[$participant->getAttendee()->getId()];
$map[$roomNumber] ??= [];
$map[$roomNumber][] = $participant;
@ -305,7 +305,7 @@ class BreakoutRoomService {
for ($i = 1; $i <= $amount; $i++) {
$breakoutRoom = $this->roomService->createConversation(
$parent->getType(),
str_replace('{number}', (string) $i, $label),
str_replace('{number}', (string)$i, $label),
null,
BreakoutRoom::PARENT_OBJECT_TYPE,
$parent->getToken()

View file

@ -331,7 +331,7 @@ class HostedSignalingServerService {
}
$body = $response->getBody();
$data = (array) json_decode($body, true);
$data = (array)json_decode($body, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);

View file

@ -79,7 +79,7 @@ class NoteToSelfService {
);
try {
$this->config->setUserValue($user->getUID(), 'spreed', 'note_to_self', (string) $room->getId(), (string) $previousValue);
$this->config->setUserValue($user->getUID(), 'spreed', 'note_to_self', (string)$room->getId(), (string)$previousValue);
} catch (PreConditionNotMetException $e) {
// This process didn't win the race for creating the conversation, so fetch the other one
$this->roomService->deleteRoom($room);
@ -113,6 +113,6 @@ class NoteToSelfService {
}
protected function getNoteToSelfConversationId(string $userId): int {
return (int) $this->config->getUserValue($userId, 'spreed', 'note_to_self', '0');
return (int)$this->config->getUserValue($userId, 'spreed', 'note_to_self', '0');
}
}

View file

@ -413,7 +413,7 @@ class ParticipantService {
$lastMessage = 0;
if ($room->getLastMessage() instanceof IComment) {
$lastMessage = (int) $room->getLastMessage()->getId();
$lastMessage = (int)$room->getLastMessage()->getId();
}
if ($previousParticipant instanceof Participant) {
@ -465,7 +465,7 @@ class ParticipantService {
$lastMessage = 0;
if ($room->getLastMessage() instanceof IComment) {
$lastMessage = (int) $room->getLastMessage()->getId();
$lastMessage = (int)$room->getLastMessage()->getId();
}
$bannedUserIds = [];
@ -531,7 +531,7 @@ class ParticipantService {
$this->attendeeMapper->insert($attendee);
if ($attendee->getActorType() === Attendee::ACTOR_FEDERATED_USERS) {
$response = $this->backendNotifier->sendRemoteShare((string) $attendee->getId(), $attendee->getAccessToken(), $attendee->getActorId(), $addedBy, 'user', $room, $this->getHighestPermissionAttendee($room));
$response = $this->backendNotifier->sendRemoteShare((string)$attendee->getId(), $attendee->getAccessToken(), $attendee->getActorId(), $addedBy, 'user', $room, $this->getHighestPermissionAttendee($room));
if (!$response) {
$this->attendeeMapper->delete($attendee);
throw new CannotReachRemoteException();
@ -794,7 +794,7 @@ class ParticipantService {
public function inviteEmailAddress(Room $room, string $email): Participant {
$lastMessage = 0;
if ($room->getLastMessage() instanceof IComment) {
$lastMessage = (int) $room->getLastMessage()->getId();
$lastMessage = (int)$room->getLastMessage()->getId();
}
$attendee = new Attendee();
@ -1087,7 +1087,7 @@ class ParticipantService {
$sessionTableIds = [];
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$sessionTableIds[] = (int) $row['s_id'];
$sessionTableIds[] = (int)$row['s_id'];
}
$result->closeCursor();
@ -1112,14 +1112,14 @@ class ParticipantService {
continue;
}
if ((int) $row['participant_type'] !== Participant::GUEST
|| ((int) $row['permissions'] !== Attendee::PERMISSIONS_DEFAULT
&& (int) $row['permissions'] !== Attendee::PERMISSIONS_CUSTOM)) {
if ((int)$row['participant_type'] !== Participant::GUEST
|| ((int)$row['permissions'] !== Attendee::PERMISSIONS_DEFAULT
&& (int)$row['permissions'] !== Attendee::PERMISSIONS_CUSTOM)) {
// Keep guests with non-default permissions in case they just reconnect
continue;
}
$attendeeIds[] = (int) $row['a_id'];
$attendeeIds[] = (int)$row['a_id'];
$attendees[] = $this->attendeeMapper->createAttendeeFromRow($row);
}
$result->closeCursor();
@ -1415,7 +1415,7 @@ class ParticipantService {
$row = $result->fetch();
$result->closeCursor();
return (int) ($row['last_common_read_message'] ?? 0);
return (int)($row['last_common_read_message'] ?? 0);
}
/**
@ -1440,7 +1440,7 @@ class ParticipantService {
$query->setParameter('roomIds', $chunk, IQueryBuilder::PARAM_INT_ARRAY);
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$commonReads[(int) $row['room_id']] = (int) $row['last_common_read_message'];
$commonReads[(int)$row['room_id']] = (int)$row['last_common_read_message'];
}
$result->closeCursor();
}
@ -1628,7 +1628,7 @@ class ParticipantService {
$participants = [];
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$room = $rooms[(int) $row['room_id']] ?? null;
$room = $rooms[(int)$row['room_id']] ?? null;
if ($room === null) {
continue;
}
@ -1815,7 +1815,7 @@ class ParticipantService {
$row = $result->fetch();
$result->closeCursor();
return (bool) $row;
return (bool)$row;
}
public function cacheParticipant(Room $room, Participant $participant): void {
@ -1866,7 +1866,7 @@ class ParticipantService {
$row = $result->fetch();
$result->closeCursor();
return (bool) $row;
return (bool)$row;
}
protected function generatePin(int $entropy = 7): string {

View file

@ -393,7 +393,7 @@ class RoomFormatter {
}
if ($room->isFederatedConversation()) {
$roomData['attendeeId'] = (int) $attendee->getRemoteId();
$roomData['attendeeId'] = (int)$attendee->getRemoteId();
$roomData['canLeaveConversation'] = true;
}

View file

@ -349,9 +349,9 @@ class RoomService {
/**
* @param Room $room
* @param int $newState Currently it is only allowed to change between
* `Webinary::LOBBY_NON_MODERATORS` and `Webinary::LOBBY_NONE`
* Also it's not allowed in one-to-one conversations,
* file conversations and password request conversations.
* `Webinary::LOBBY_NON_MODERATORS` and `Webinary::LOBBY_NONE`
* Also it's not allowed in one-to-one conversations,
* file conversations and password request conversations.
* @param \DateTime|null $dateTime
* @param bool $timerReached
* @param bool $dispatchEvents (Only skip if the room is created in the same PHP request)
@ -421,7 +421,7 @@ class RoomService {
* @param Room $room
* @param integer $status 0 none|1 video|2 audio
* @param Participant|null $participant the Participant that changed the
* state, null for the current user
* state, null for the current user
* @throws InvalidArgumentException When the status is invalid, not Room::RECORDING_*
* @throws InvalidArgumentException When trying to start
*/
@ -521,9 +521,9 @@ class RoomService {
/**
* @param Room $room
* @param int $newState Currently it is only allowed to change between
* `Room::READ_ONLY` and `Room::READ_WRITE`
* Also it's only allowed on rooms of type
* `Room::TYPE_GROUP` and `Room::TYPE_PUBLIC`
* `Room::READ_ONLY` and `Room::READ_WRITE`
* Also it's only allowed on rooms of type
* `Room::TYPE_GROUP` and `Room::TYPE_PUBLIC`
* @return bool True when the change was valid, false otherwise
*/
public function setReadOnly(Room $room, int $newState): bool {
@ -563,8 +563,8 @@ class RoomService {
/**
* @param Room $room
* @param int $newState New listable scope from self::LISTABLE_*
* Also it's only allowed on rooms of type
* `Room::TYPE_GROUP` and `Room::TYPE_PUBLIC`
* Also it's only allowed on rooms of type
* `Room::TYPE_GROUP` and `Room::TYPE_PUBLIC`
* @return bool True when the change was valid, false otherwise
*/
public function setListable(Room $room, int $newState): bool {
@ -654,7 +654,7 @@ class RoomService {
$update->andWhere($update->expr()->isNull('assigned_hpb'));
}
$updated = (bool) $update->executeStatement();
$updated = (bool)$update->executeStatement();
if ($updated) {
$room->setAssignedSignalingServer($signalingServer);
}
@ -848,7 +848,7 @@ class RoomService {
->where($update->expr()->eq('id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
->andWhere($update->expr()->isNotNull('active_since'));
return (bool) $update->executeStatement();
return (bool)$update->executeStatement();
}
/**
@ -928,7 +928,7 @@ class RoomService {
->set('active_since', $update->createNamedParameter($since, IQueryBuilder::PARAM_DATE))
->where($update->expr()->eq('id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
->andWhere($update->expr()->isNull('active_since'));
$result = (bool) $update->executeStatement();
$result = (bool)$update->executeStatement();
$room->setActiveSince($since, $callFlag);
@ -946,7 +946,7 @@ class RoomService {
public function setLastMessage(Room $room, IComment $message): void {
$update = $this->db->getQueryBuilder();
$update->update('talk_rooms')
->set('last_message', $update->createNamedParameter((int) $message->getId()))
->set('last_message', $update->createNamedParameter((int)$message->getId()))
->set('last_activity', $update->createNamedParameter($message->getCreationDateTime(), 'datetime'))
->where($update->expr()->eq('id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)));
$update->executeStatement();
@ -1056,12 +1056,12 @@ class RoomService {
$changed[] = ARoomModifiedEvent::PROPERTY_AVATAR;
}
}
if (isset($host['lastActivity']) && $host['lastActivity'] !== 0 && $host['lastActivity'] !== ((int) $local->getLastActivity()?->getTimestamp())) {
if (isset($host['lastActivity']) && $host['lastActivity'] !== 0 && $host['lastActivity'] !== ((int)$local->getLastActivity()?->getTimestamp())) {
$lastActivity = $this->timeFactory->getDateTime('@' . $host['lastActivity']);
$this->setLastActivity($local, $lastActivity);
$changed[] = ARoomSyncedEvent::PROPERTY_LAST_ACTIVITY;
}
if (isset($host['lobbyState'], $host['lobbyTimer']) && ($host['lobbyState'] !== $local->getLobbyState(false) || $host['lobbyTimer'] !== ((int) $local->getLobbyTimer(false)?->getTimestamp()))) {
if (isset($host['lobbyState'], $host['lobbyTimer']) && ($host['lobbyState'] !== $local->getLobbyState(false) || $host['lobbyTimer'] !== ((int)$local->getLobbyTimer(false)?->getTimestamp()))) {
$hostTimer = $host['lobbyTimer'] === 0 ? null : $this->timeFactory->getDateTime('@' . $host['lobbyTimer']);
$success = $this->setLobby($local, $host['lobbyState'], $hostTimer);
if (!$success) {
@ -1071,7 +1071,7 @@ class RoomService {
}
}
if (isset($host['callStartTime'], $host['callFlag'])) {
$localCallStartTime = (int) $local->getActiveSince()?->getTimestamp();
$localCallStartTime = (int)$local->getActiveSince()?->getTimestamp();
if ($host['callStartTime'] === 0 && ($host['callStartTime'] !== $localCallStartTime || $host['callFlag'] !== $local->getCallFlag())) {
$this->resetActiveSince($local, null);
$changed[] = ARoomModifiedEvent::PROPERTY_ACTIVE_SINCE;

View file

@ -56,10 +56,10 @@ class SIPDialOutService {
->map(
Response::class,
Source::json($response)
->map([
'dialout' => 'dialOut',
'dialout.callid' => 'callId',
])
->map([
'dialout' => 'dialOut',
'dialout.callid' => 'callId',
])
);
} catch (MappingError $e) {
throw new \InvalidArgumentException('Not a valid dial-out response', 0, $e);

View file

@ -68,14 +68,14 @@ class AdminSettings implements ISettings {
}
protected function initGeneralSettings(): void {
$this->initialState->provideInitialState('default_group_notification', (int) $this->serverConfig->getAppValue('spreed', 'default_group_notification', (string) Participant::NOTIFY_MENTION));
$this->initialState->provideInitialState('conversations_files', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files', '1'));
$this->initialState->provideInitialState('conversations_files_public_shares', (int) $this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1'));
$this->initialState->provideInitialState('default_group_notification', (int)$this->serverConfig->getAppValue('spreed', 'default_group_notification', (string)Participant::NOTIFY_MENTION));
$this->initialState->provideInitialState('conversations_files', (int)$this->serverConfig->getAppValue('spreed', 'conversations_files', '1'));
$this->initialState->provideInitialState('conversations_files_public_shares', (int)$this->serverConfig->getAppValue('spreed', 'conversations_files_public_shares', '1'));
$this->initialState->provideInitialState('valid_apache_php_configuration', $this->validApachePHPConfiguration());
}
protected function initAllowedGroups(): void {
$this->initialState->provideInitialState('start_calls', (int) $this->serverConfig->getAppValue('spreed', 'start_calls', (string) Room::START_CALL_EVERYONE));
$this->initialState->provideInitialState('start_calls', (int)$this->serverConfig->getAppValue('spreed', 'start_calls', (string)Room::START_CALL_EVERYONE));
$groups = $this->getGroupDetailsArray($this->talkConfig->getAllowedConversationsGroupIds(), 'start_conversations');
$this->initialState->provideInitialState('start_conversations', $groups);
@ -95,7 +95,7 @@ class AdminSettings implements ISettings {
protected function initMatterbridge(): void {
$error = '';
try {
$version = (string) $this->bridgeManager->getCurrentVersionFromBinary();
$version = (string)$this->bridgeManager->getCurrentVersionFromBinary();
if ($version === '') {
$error = 'binary';
}
@ -518,8 +518,8 @@ class AdminSettings implements ISettings {
/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/

View file

@ -55,8 +55,8 @@ class Section implements IIconSection {
/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
* @since 9.1

View file

@ -38,8 +38,8 @@ class Personal implements ISettings {
/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
* @since 9.1

View file

@ -426,7 +426,7 @@ class RoomShareProvider implements IShareProvider {
$update->executeStatement();
return $this->getShareById((int) $share->getId(), $recipient);
return $this->getShareById((int)$share->getId(), $recipient);
}
/**
@ -668,7 +668,7 @@ class RoomShareProvider implements IShareProvider {
$id = $data['id'];
if ($this->isAccessibleResult($data)) {
$share = $this->createShareObject($data);
$shares[(int) $share->getId()] = $share;
$shares[(int)$share->getId()] = $share;
} else {
$share = false;
}
@ -1003,8 +1003,8 @@ class RoomShareProvider implements IShareProvider {
protected function filterSharesOfUser(array $shares): array {
// Room shares when the user has a share exception
foreach ($shares as $id => $share) {
$type = (int) $share['share_type'];
$permissions = (int) $share['permissions'];
$type = (int)$share['share_type'];
$permissions = (int)$share['permissions'];
if ($type === self::SHARE_TYPE_USERROOM) {
unset($shares[$share['parent']]);

View file

@ -499,7 +499,7 @@ class BackendNotifier {
'app' => 'spreed-hpb',
]);
return (string) $response->getBody();
return (string)$response->getBody();
}
/**

View file

@ -51,7 +51,7 @@ trait TInitialState {
$this->initialState->provideInitialState(
'call_enabled',
((int) $this->serverConfig->getAppValue('spreed', 'start_calls')) !== Room::START_CALL_NOONE
((int)$this->serverConfig->getAppValue('spreed', 'start_calls')) !== Room::START_CALL_NOONE
);
$this->initialState->provideInitialState(

View file

@ -6,8 +6,8 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/** @var $_ array */
/** @var $l \OCP\IL10N */
/** @var array $_ */
/** @var \OCP\IL10N $l */
\OCP\Util::addStyle('core', 'publicshareauth');
\OCP\Util::addScript('core', 'publicshareauth');
?>

View file

@ -484,7 +484,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$data['description'] = $room['description'];
}
if (isset($expectedRoom['type'])) {
$data['type'] = (string) $room['type'];
$data['type'] = (string)$room['type'];
}
if (isset($expectedRoom['remoteServer'])) {
$data['remoteServer'] = isset($room['remoteServer']) ? self::translateRemoteServer($room['remoteServer']) : '';
@ -497,31 +497,31 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
}
if (isset($expectedRoom['hasPassword'])) {
$data['hasPassword'] = (string) $room['hasPassword'];
$data['hasPassword'] = (string)$room['hasPassword'];
}
if (isset($expectedRoom['readOnly'])) {
$data['readOnly'] = (string) $room['readOnly'];
$data['readOnly'] = (string)$room['readOnly'];
}
if (isset($expectedRoom['listable'])) {
$data['listable'] = (string) $room['listable'];
$data['listable'] = (string)$room['listable'];
}
if (isset($expectedRoom['participantType'])) {
$data['participantType'] = (string) $room['participantType'];
$data['participantType'] = (string)$room['participantType'];
}
if (isset($expectedRoom['sipEnabled'])) {
$data['sipEnabled'] = (string) $room['sipEnabled'];
$data['sipEnabled'] = (string)$room['sipEnabled'];
}
if (isset($expectedRoom['callFlag'])) {
$data['callFlag'] = (int) $room['callFlag'];
$data['callFlag'] = (int)$room['callFlag'];
}
if (isset($expectedRoom['lobbyState'])) {
$data['lobbyState'] = (int) $room['lobbyState'];
$data['lobbyState'] = (int)$room['lobbyState'];
}
if (isset($expectedRoom['breakoutRoomMode'])) {
$data['breakoutRoomMode'] = (int) $room['breakoutRoomMode'];
$data['breakoutRoomMode'] = (int)$room['breakoutRoomMode'];
}
if (isset($expectedRoom['breakoutRoomStatus'])) {
$data['breakoutRoomStatus'] = (int) $room['breakoutRoomStatus'];
$data['breakoutRoomStatus'] = (int)$room['breakoutRoomStatus'];
}
if (isset($expectedRoom['attendeePin'])) {
$data['attendeePin'] = $room['attendeePin'] ? '**PIN**' : '';
@ -539,25 +539,25 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$data['lastMessageActorId'] = str_replace(rtrim($this->remoteServerUrl, '/'), '{$REMOTE_URL}', $data['lastMessageActorId']);
}
if (isset($expectedRoom['lastReadMessage'])) {
$data['lastReadMessage'] = self::$messageIdToText[(int) $room['lastReadMessage']] ?? (!$room['lastReadMessage'] ? 'ZERO': 'UNKNOWN_MESSAGE');
$data['lastReadMessage'] = self::$messageIdToText[(int)$room['lastReadMessage']] ?? (!$room['lastReadMessage'] ? 'ZERO': 'UNKNOWN_MESSAGE');
}
if (isset($expectedRoom['unreadMessages'])) {
$data['unreadMessages'] = (int) $room['unreadMessages'];
$data['unreadMessages'] = (int)$room['unreadMessages'];
}
if (isset($expectedRoom['unreadMention'])) {
$data['unreadMention'] = (int) $room['unreadMention'];
$data['unreadMention'] = (int)$room['unreadMention'];
}
if (isset($expectedRoom['unreadMentionDirect'])) {
$data['unreadMentionDirect'] = (int) $room['unreadMentionDirect'];
$data['unreadMentionDirect'] = (int)$room['unreadMentionDirect'];
}
if (isset($expectedRoom['messageExpiration'])) {
$data['messageExpiration'] = (int) $room['messageExpiration'];
$data['messageExpiration'] = (int)$room['messageExpiration'];
}
if (isset($expectedRoom['callRecording'])) {
$data['callRecording'] = (int) $room['callRecording'];
$data['callRecording'] = (int)$room['callRecording'];
}
if (isset($expectedRoom['recordingConsent'])) {
$data['recordingConsent'] = (int) $room['recordingConsent'];
$data['recordingConsent'] = (int)$room['recordingConsent'];
}
if (isset($expectedRoom['permissions'])) {
$data['permissions'] = $this->mapPermissionsAPIOutput($room['permissions']);
@ -655,7 +655,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
Assert::assertCount(count($formData->getHash()), $invites, 'Invite count does not match');
$expectedInvites = array_map(static function ($expectedInvite): array {
if (isset($expectedInvite['state'])) {
$expectedInvite['state'] = (int) $expectedInvite['state'];
$expectedInvite['state'] = (int)$expectedInvite['state'];
}
return $expectedInvite;
}, $formData->getHash());
@ -811,31 +811,31 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$data['actorId'] = $attendee['actorId'];
}
if (isset($expectedKeys['participantType'])) {
$data['participantType'] = (string) $attendee['participantType'];
$data['participantType'] = (string)$attendee['participantType'];
}
if (isset($expectedKeys['inCall'])) {
$data['inCall'] = (string) $attendee['inCall'];
$data['inCall'] = (string)$attendee['inCall'];
}
if (isset($expectedKeys['attendeePin'])) {
$data['attendeePin'] = $attendee['attendeePin'] ? '**PIN**' : '';
}
if (isset($expectedKeys['permissions'])) {
$data['permissions'] = (string) $attendee['permissions'];
$data['permissions'] = (string)$attendee['permissions'];
}
if (isset($expectedKeys['attendeePermissions'])) {
$data['attendeePermissions'] = (string) $attendee['attendeePermissions'];
$data['attendeePermissions'] = (string)$attendee['attendeePermissions'];
}
if (isset($expectedKeys['displayName'])) {
$data['displayName'] = (string) $attendee['displayName'];
$data['displayName'] = (string)$attendee['displayName'];
}
if (isset($expectedKeys['phoneNumber'])) {
$data['phoneNumber'] = (string) $attendee['phoneNumber'];
$data['phoneNumber'] = (string)$attendee['phoneNumber'];
}
if (isset($expectedKeys['callId'])) {
$data['callId'] = (string) $attendee['callId'];
$data['callId'] = (string)$attendee['callId'];
}
if (isset($expectedKeys['status'], $attendee['status'])) {
$data['status'] = (string) $attendee['status'];
$data['status'] = (string)$attendee['status'];
}
if (isset($expectedKeys['sessionIds'])) {
$sessionIds = '[';
@ -1017,7 +1017,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
private function mapPermissionsAPIOutput($permissions): string {
$permissions = (int) $permissions;
$permissions = (int)$permissions;
$permissionsString = !$permissions ? 'D' : '';
foreach (self::$permissionsMap as $char => $int) {
@ -2214,9 +2214,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if ($statusCode === 200) {
$response = $this->getDataFromResponse($this->response);
Assert::assertCount((int) $numPeers, $response);
Assert::assertCount((int)$numPeers, $response);
} else {
Assert::assertEquals((int) $numPeers, 0);
Assert::assertEquals((int)$numPeers, 0);
}
}
@ -2551,7 +2551,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if (isset($expected['details'])) {
$expected['details'] = json_decode($expected['details'], true);
}
$expected['numVoters'] = (int) $expected['numVoters'];
$expected['numVoters'] = (int)$expected['numVoters'];
$expected['options'] = json_decode($expected['options'], true);
$result = preg_match('/POLL_ID\(([^)]+)\)/', $expected['id'], $matches);
@ -2586,8 +2586,8 @@ class FeatureContext implements Context, SnippetAcceptingContext {
unset($widget['icon_url'], $data[$id]['icon_url']);
$widget['item_icons_round'] = (bool) $widget['item_icons_round'];
$widget['order'] = (int) $widget['order'];
$widget['item_icons_round'] = (bool)$widget['item_icons_round'];
$widget['order'] = (int)$widget['order'];
$widget['widget_url'] = str_replace('{$BASE_URL}', $this->baseUrl, $widget['widget_url']);
$widget['buttons'] = str_replace('{$BASE_URL}', $this->baseUrl, $widget['buttons']);
$widget['buttons'] = json_decode($widget['buttons'], true);
@ -2879,7 +2879,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if ($formData instanceof TableNode) {
$expected = $formData->getRowsHash();
$summarized = array_map(function ($type) {
return (string) count($type);
return (string)count($type);
}, $overview);
Assert::assertEquals($expected, $summarized);
}
@ -3160,9 +3160,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
Assert::assertEquals($expected, array_map(function ($message, $expected) {
$data = [
'room' => self::$tokenToIdentifier[$message['token']],
'actorType' => (string) $message['actorType'],
'actorId' => ($message['actorType'] === 'guests') ? self::$sessionIdToUser[$message['actorId']] : (string) $message['actorId'],
'systemMessage' => (string) $message['systemMessage'],
'actorType' => (string)$message['actorType'],
'actorId' => ($message['actorType'] === 'guests') ? self::$sessionIdToUser[$message['actorId']] : (string)$message['actorId'],
'systemMessage' => (string)$message['systemMessage'],
];
if (isset($expected['actorDisplayName'])) {
@ -3415,7 +3415,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
foreach ($formData->getRowsHash() as $attendee => $roomNumber) {
[$type, $id] = explode('::', $attendee);
$attendeeId = $this->getAttendeeId($type, $id, $identifier);
$mapArray[$attendeeId] = (int) $roomNumber;
$mapArray[$attendeeId] = (int)$roomNumber;
}
$data['attendeeMap'] = json_encode($mapArray, JSON_THROW_ON_ERROR);
}
@ -3455,7 +3455,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
foreach ($formData->getRowsHash() as $attendee => $roomNumber) {
[$type, $id] = explode('::', $attendee);
$attendeeId = $this->getAttendeeId($type, $id, $identifier);
$mapArray[$attendeeId] = (int) $roomNumber;
$mapArray[$attendeeId] = (int)$roomNumber;
}
$data['attendeeMap'] = json_encode($mapArray, JSON_THROW_ON_ERROR);
}
@ -3717,20 +3717,20 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
}
if (isset($expectedNotification['subject'])) {
$data['subject'] = (string) $notification['subject'];
$data['subject'] = (string)$notification['subject'];
}
if (isset($expectedNotification['message'])) {
$data['message'] = (string) $notification['message'];
$data['message'] = (string)$notification['message'];
$result = preg_match('/ROOM\(([^)]+)\)/', $expectedNotification['message'], $matches);
if ($result && isset(self::$identifierToToken[$matches[1]])) {
$data['message'] = str_replace(self::$identifierToToken[$matches[1]], $matches[0], $data['message']);
}
}
if (isset($expectedNotification['object_type'])) {
$data['object_type'] = (string) $notification['object_type'];
$data['object_type'] = (string)$notification['object_type'];
}
if (isset($expectedNotification['app'])) {
$data['app'] = (string) $notification['app'];
$data['app'] = (string)$notification['app'];
}
return $data;
@ -4202,7 +4202,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$actual = array_map(function ($reaction, $list) use ($expected): array {
$list = array_map(function ($reaction) {
unset($reaction['timestamp']);
$reaction['actorId'] = ($reaction['actorType'] === 'guests') ? self::$sessionIdToUser[$reaction['actorId']] : (string) $reaction['actorId'];
$reaction['actorId'] = ($reaction['actorType'] === 'guests') ? self::$sessionIdToUser[$reaction['actorId']] : (string)$reaction['actorId'];
if ($reaction['actorType'] === 'federated_users') {
$reaction['actorId'] = str_replace(rtrim($this->localServerUrl, '/'), '{$LOCAL_URL}', $reaction['actorId']);
$reaction['actorId'] = str_replace(rtrim($this->localRemoteServerUrl, '/'), '{$LOCAL_REMOTE_URL}', $reaction['actorId']);
@ -4464,7 +4464,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
public function userStoreRecordingFileInRoom(string $user, string $file, string $identifier, int $statusCode, string $apiVersion = 'v1'): void {
$recordingServerSharedSecret = 'the secret';
$this->setAppConfig('spreed', new TableNode([['recording_servers', json_encode(['secret' => $recordingServerSharedSecret])]]));
$validRandom = md5((string) rand());
$validRandom = md5((string)rand());
$validChecksum = hash_hmac('sha256', $validRandom . self::$identifierToToken[$identifier], $recordingServerSharedSecret);
$headers = [
'TALK_RECORDING_RANDOM' => $validRandom,
@ -4665,9 +4665,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
foreach ($list as $job) {
if ($useForce === 'force run') {
$this->runOcc(['background-job:execute', (string) $job['id'], '--force-execute']);
$this->runOcc(['background-job:execute', (string)$job['id'], '--force-execute']);
} else {
$this->runOcc(['background-job:execute', (string) $job['id']]);
$this->runOcc(['background-job:execute', (string)$job['id']]);
}
if ($this->lastStdErr) {

View file

@ -275,7 +275,7 @@ trait RecordingTrait {
private function sendBackendRequestFromRecordingServer(array $data, int $statusCode, string $apiVersion = 'v1') {
$body = json_encode($data);
$random = md5((string) rand());
$random = md5((string)rand());
$checksum = hash_hmac('sha256', $random . $body, 'the recording secret');
$headers = [

View file

@ -583,11 +583,11 @@ class SharingContext implements Context {
$returnedShare = $this->getXmlResponse()->data[0];
if ($returnedShare->element) {
$returnedShare = (array) $returnedShare;
$returnedShare = (array)$returnedShare;
$returnedShare = $returnedShare['element'];
if (is_array($returnedShare)) {
usort($returnedShare, static function ($share1, $share2) {
return (int) $share1->id - (int) $share2->id;
return (int)$share1->id - (int)$share2->id;
});
}

View file

@ -111,7 +111,7 @@ class ApiController extends OCSController {
->where($query->expr()->eq('token', $query->createNamedParameter($token)));
$result = $query->executeQuery();
$roomId = (int) $result->fetchOne();
$roomId = (int)$result->fetchOne();
$result->closeCursor();
if (!$roomId) {

View file

@ -90,7 +90,7 @@ class CapabilitiesTest extends TestCase {
->willReturnMap([
['spreed', 'has_reference_id', 'no', 'no'],
['spreed', 'max-gif-size', '3145728', '200000'],
['spreed', 'start_calls', (string) Room::START_CALL_EVERYONE, (string) Room::START_CALL_EVERYONE],
['spreed', 'start_calls', (string)Room::START_CALL_EVERYONE, (string)Room::START_CALL_EVERYONE],
['spreed', 'session-ping-limit', '200', '200'],
['core', 'backgroundjobs_mode', 'ajax', 'cron'],
]);
@ -221,7 +221,7 @@ class CapabilitiesTest extends TestCase {
->willReturnMap([
['spreed', 'has_reference_id', 'no', 'yes'],
['spreed', 'max-gif-size', '3145728', '200000'],
['spreed', 'start_calls', (string) Room::START_CALL_EVERYONE, (string) Room::START_CALL_NOONE],
['spreed', 'start_calls', (string)Room::START_CALL_EVERYONE, (string)Room::START_CALL_NOONE],
['spreed', 'session-ping-limit', '200', '50'],
['core', 'backgroundjobs_mode', 'ajax', 'cron'],
]);

View file

@ -85,7 +85,7 @@ class ChatManagerTest extends TestCase {
$this->l->method('n')
->willReturnCallback(function (string $singular, string $plural, int $count, array $parameters = []) {
$text = $count === 1 ? $singular : $plural;
return vsprintf(str_replace('%n', (string) $count, $text), $parameters);
return vsprintf(str_replace('%n', (string)$count, $text), $parameters);
});
$this->chatManager = $this->getManager();
@ -149,7 +149,7 @@ class ChatManagerTest extends TestCase {
private function newComment($id, string $actorType, string $actorId, \DateTime $creationDateTime, string $message): IComment {
$comment = $this->createMock(IComment::class);
$id = (string) $id;
$id = (string)$id;
$comment->method('getId')->willReturn($id);
$comment->method('getActorType')->willReturn($actorType);
@ -169,7 +169,7 @@ class ChatManagerTest extends TestCase {
foreach ($data as $key => $value) {
if ($key === 'id') {
$value = (string) $value;
$value = (string)$value;
}
$comment->method('get' . ucfirst($key))->willReturn($value);
}

View file

@ -170,7 +170,7 @@ class NotifierTest extends TestCase {
public function testNotifyMentionedUsers(string $message, array $alreadyNotifiedUsers, array $notify, array $expectedReturn): void {
if (count($notify)) {
$this->notificationManager->expects($this->exactly(count($notify)))
->method('notify');
->method('notify');
}
$room = $this->getRoom();

View file

@ -81,7 +81,7 @@ class SystemMessageTest extends TestCase {
$this->l->method('n')
->willReturnCallback(function (string $singular, string $plural, int $count, array $parameters = []) {
$text = $count === 1 ? $singular : $plural;
return vsprintf(str_replace('%n', (string) $count, $text), $parameters);
return vsprintf(str_replace('%n', (string)$count, $text), $parameters);
});
}

View file

@ -410,7 +410,7 @@ class ConfigTest extends TestCase {
$this->assertEquals($now, $decoded->iat);
$this->assertEquals('https://domain.invalid/nextcloud', $decoded->iss);
$this->assertEquals('user1', $decoded->sub);
$this->assertSame(['displayname' => 'Jane Doe'], (array) $decoded->userdata);
$this->assertSame(['displayname' => 'Jane Doe'], (array)$decoded->userdata);
}
/**

View file

@ -10,7 +10,7 @@ use OCP\IDBConnection;
use OCP\IUser;
class Manager implements \OCP\Comments\ICommentsManager {
/** @var IDBConnection */
/** @var IDBConnection */
protected $dbConn;
protected function normalizeDatabaseData(array $data): array {