Browse Source

Update coding standard

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/6888/head
Joas Schilling 4 years ago
parent
commit
96074f7c95
No known key found for this signature in database GPG Key ID: 7076EA9751AACDDA
  1. 2
      lib/Chat/ChatManager.php
  2. 2
      lib/Chat/Command/Executor.php
  3. 4
      lib/Chat/Command/Listener.php
  4. 2
      lib/Controller/RoomController.php
  5. 2
      lib/Federation/CloudFederationProviderTalk.php
  6. 6
      lib/Manager.php
  7. 2
      lib/Share/RoomShareProvider.php
  8. 2
      lib/Signaling/Listener.php
  9. 2
      sample-commands/hackernews.php
  10. 2
      sample-commands/wikipedia.php
  11. 6
      tests/php/Notification/NotifierTest.php

2
lib/Chat/ChatManager.php

@ -562,7 +562,7 @@ class ChatManager {
* @param int $limit
* @return IComment[]
*/
public function searchForObjects(string $search, array $objectIds, string $verb = '', int $offset = 0, int $limit = 50): array {
public function searchForObjects(string $search, array $objectIds, string $verb = '', int $offset = 0, int $limit = 50): array {
return $this->commentsManager->searchForObjects($search, 'chat', $objectIds, $verb, $offset, $limit);
}

2
lib/Chat/Command/Executor.php

@ -132,7 +132,7 @@ class Executor {
if ($command->getApp() !== '') {
$response = $this->execHelpSingleCommand($room, $message, $command->getApp() . ' ' . $command->getCommand());
} else {
if ($command->getCommand() === 'help' || strpos($command->getScript(),'alias:') !== false ||
if ($command->getCommand() === 'help' || strpos($command->getScript(), 'alias:') !== false ||
!$this->isCommandAvailableForParticipant($command, $participant)) {
continue;
}

4
lib/Chat/Command/Listener.php

@ -91,11 +91,11 @@ class Listener {
}
try {
return [$this->commandService->find('', $app), trim($cmd . ' ' . $arguments)];
return [$this->commandService->find('', $app), trim($cmd . ' ' . $arguments)];
} catch (DoesNotExistException $e) {
}
return [$this->commandService->find('', 'help'), trim($message)];
return [$this->commandService->find('', 'help'), trim($message)];
}
protected function matchesCommand(string $message): array {

2
lib/Controller/RoomController.php

@ -1493,7 +1493,7 @@ class RoomController extends AEnvironmentAwareController {
* @param bool $promote Shall the attendee be promoted or demoted
* @return DataResponse
*/
protected function changeParticipantType(int $attendeeId, bool $promote): DataResponse {
protected function changeParticipantType(int $attendeeId, bool $promote): DataResponse {
try {
$targetParticipant = $this->room->getParticipantByAttendeeId($attendeeId);
} catch (ParticipantNotFoundException $e) {

2
lib/Federation/CloudFederationProviderTalk.php

@ -149,7 +149,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider {
if ($remote && $shareSecret && $shareWith && $roomToken && $remoteId && is_string($roomName) && $roomName && $owner) {
$shareWith = $this->userManager->get($shareWith);
if ($shareWith === null) {
throw new ProviderCouldNotAddShareException('User does not exist', '',Http::STATUS_BAD_REQUEST);
throw new ProviderCouldNotAddShareException('User does not exist', '', Http::STATUS_BAD_REQUEST);
}
$shareId = (string) $this->federationManager->addRemoteRoom($shareWith, $remoteId, $roomType, $roomName, $roomToken, $remote, $shareSecret);

6
lib/Manager.php

@ -884,7 +884,7 @@ class Manager {
$room->setListable(Room::LISTABLE_NONE);
$user = $this->userManager->get($userId);
$this->participantService->addUsers($room,[[
$this->participantService->addUsers($room, [[
'actorType' => Attendee::ACTOR_USERS,
'actorId' => $userId,
'displayName' => $user ? $user->getDisplayName() : $userId,
@ -898,7 +898,7 @@ class Manager {
$room->getParticipant($userId, false);
} catch (ParticipantNotFoundException $e) {
$user = $this->userManager->get($userId);
$this->participantService->addUsers($room,[[
$this->participantService->addUsers($room, [[
'actorType' => Attendee::ACTOR_USERS,
'actorId' => $userId,
'displayName' => $user ? $user->getDisplayName() : $userId,
@ -1168,7 +1168,7 @@ class Manager {
}
protected function loadLastMessageInfo(IQueryBuilder $query): void {
$query->leftJoin('r','comments', 'c', $query->expr()->eq('r.last_message', 'c.id'));
$query->leftJoin('r', 'comments', 'c', $query->expr()->eq('r.last_message', 'c.id'));
$query->selectAlias('c.id', 'comment_id');
$query->selectAlias('c.parent_id', 'comment_parent_id');
$query->selectAlias('c.topmost_parent_id', 'comment_topmost_parent_id');

2
lib/Share/RoomShareProvider.php

@ -574,7 +574,7 @@ class RoomShareProvider implements IShareProvider {
);
}
$qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
$qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
$qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
$qb->orderBy('s.id');

2
lib/Signaling/Listener.php

@ -323,7 +323,7 @@ class Listener {
$notifier->participantsModified($event->getRoom(), $sessionIds);
}
});
$dispatcher->addListener(ChatManager::EVENT_AFTER_MESSAGE_SEND , static function (ChatParticipantEvent $event) {
$dispatcher->addListener(ChatManager::EVENT_AFTER_MESSAGE_SEND, static function (ChatParticipantEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}

2
sample-commands/hackernews.php

@ -55,7 +55,7 @@ foreach ($stories as $storyId) {
$result = json_decode($content, true);
$link = " - {$result['url']}\n";
$remainingLength = max(strlen($result['title']),$length - strlen($link));
$remainingLength = max(strlen($result['title']), $length - strlen($link));
if ($remainingLength < strlen('* ' . $result['title'])) {
$response .= substr('* ' . $result['title'], 0, $remainingLength) . '…' . $link;
} else {

2
sample-commands/wikipedia.php

@ -72,7 +72,7 @@ foreach ($pages as $key => $page) {
}
$link = " - {$page['canonicalurl']}\n";
$remainingLength = max(strlen($page['title']),$length - strlen($link));
$remainingLength = max(strlen($page['title']), $length - strlen($link));
if ($remainingLength < strlen("* {$page['title']} - {$page['description']}")) {
$response .= substr("* {$page['title']} - {$page['description']}", 0, $remainingLength) . '…' . $link;
} else {

6
tests/php/Notification/NotifierTest.php

@ -185,7 +185,7 @@ class NotifierTest extends \Test\TestCase {
->willReturnSelf();
$n->expects($this->once())
->method('setRichSubject')
->with('{user} invited you to a private conversation',[
->with('{user} invited you to a private conversation', [
'user' => [
'type' => 'user',
'id' => $uid,
@ -301,7 +301,7 @@ class NotifierTest extends \Test\TestCase {
->willReturnSelf();
$n->expects($this->once())
->method('setRichSubject')
->with('{user} invited you to a private conversation',[
->with('{user} invited you to a private conversation', [
'user' => [
'type' => 'user',
'id' => $uid,
@ -416,7 +416,7 @@ class NotifierTest extends \Test\TestCase {
if ($type === Room::TYPE_GROUP) {
$n->expects($this->once())
->method('setRichSubject')
->with('{user} invited you to a group conversation: {call}',[
->with('{user} invited you to a group conversation: {call}', [
'user' => [
'type' => 'user',
'id' => $uid,

Loading…
Cancel
Save