Skip to content

Commit

Permalink
Merge branch '1.x' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
RTippin committed May 23, 2024
2 parents 858ae14 + 4bf5123 commit 9756e3b
Show file tree
Hide file tree
Showing 83 changed files with 334 additions and 254 deletions.
2 changes: 1 addition & 1 deletion database/factories/FactoryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trait FactoryHelper
/**
* Owner relation to add.
*
* @param $owner
* @param $owner
* @return $this
*/
public function owner($owner): self
Expand Down
4 changes: 2 additions & 2 deletions database/factories/FriendFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function definition(): array
/**
* Owner and party relations to add.
*
* @param $owner
* @param $party
* @param $owner
* @param $party
* @return $this
*/
public function providers($owner, $party): self
Expand Down
2 changes: 1 addition & 1 deletion database/factories/InviteFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function definition(): array
/**
* Indicate thread is a group.
*
* @param $expires
* @param $expires
* @return $this
*/
public function expires($expires): self
Expand Down
4 changes: 2 additions & 2 deletions database/factories/PendingFriendFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function definition(): array
/**
* Sender and recipient relations to add.
*
* @param $sender
* @param $recipient
* @param $sender
* @param $recipient
* @return $this
*/
public function providers($sender, $recipient): self
Expand Down
4 changes: 2 additions & 2 deletions database/factories/SentFriendFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function definition(): array
/**
* Sender and recipient relations to add.
*
* @param $sender
* @param $recipient
* @param $sender
* @param $recipient
* @return $this
*/
public function providers($sender, $recipient): self
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/BaseMessengerAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function getJsonResource()
}

/**
* @param $resource
* @param $resource
* @return $this
*/
public function setJsonResource($resource): self
Expand Down Expand Up @@ -229,7 +229,7 @@ public function getData(bool $withoutRelations = false)
}

/**
* @param $data
* @param $data
* @return $this
*/
public function setData($data): self
Expand Down
1 change: 1 addition & 0 deletions src/Actions/Friends/StoreFriendRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ private function locateAndSetRecipientProvider(string $alias, string $id): void

/**
* @throws FriendException|ProviderNotFoundException
*
* @noinspection PhpParamsInspection
*/
private function bailIfChecksFail(): void
Expand Down
8 changes: 4 additions & 4 deletions src/Actions/Messages/EditMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ private function handle(string $body): self
private function generateResource(): void
{
$this->setJsonResource(new MessageResource(
$this->getMessage(),
$this->getThread(),
true
)
$this->getMessage(),
$this->getThread(),
true
)
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Actions/Messages/NewMessageAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ protected function finalize(): void
private function generateResource(): self
{
$this->setJsonResource(new MessageResource(
$this->getMessage(),
$this->getThread(),
true
)
$this->getMessage(),
$this->getThread(),
true
)
);

return $this;
Expand Down
6 changes: 3 additions & 3 deletions src/Actions/Messenger/UpdateMessengerSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ private function setOnlineCacheStatus(int $onlineStatus): void
switch ($onlineStatus) {
case 0:
$this->messenger->setProviderToOffline();
break;
break;
case 1:
$this->messenger->setProviderToOnline();
break;
break;
case 2:
$this->messenger->setProviderToAway();
break;
break;
}
}
}
1 change: 1 addition & 0 deletions src/Actions/Threads/StoreGroupThread.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ private function creatorParticipant(): array

/**
* @param array $providers
*
* @mixin StoreManyParticipants
*
* @return array
Expand Down
2 changes: 1 addition & 1 deletion src/Broadcasting/Channels/CallChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(Messenger $messenger)
/**
* Authenticate the provider's access to the channel.
*
* @param $user
* @param $user
* @param Thread $thread
* @param Call $call
* @return ProviderResource
Expand Down
2 changes: 1 addition & 1 deletion src/Broadcasting/Channels/ProviderChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(Messenger $messenger)
/**
* Authenticate the provider's access to the channel.
*
* @param $user
* @param $user
* @param string|null $alias
* @param string|null $id
* @return bool
Expand Down
2 changes: 1 addition & 1 deletion src/Broadcasting/Channels/ThreadChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(Messenger $messenger)
/**
* Authenticate the provider's access to the channel.
*
* @param $user
* @param $user
* @param Thread $thread
* @return ProviderResource
*
Expand Down
6 changes: 3 additions & 3 deletions src/Brokers/FriendBroker.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private function getProviderSentFriendsBuilder(): Builder
}

/**
* @param $model
* @param $model
* @return Friend|null
*/
private function getFriend($model): ?Friend
Expand All @@ -232,7 +232,7 @@ private function getFriend($model): ?Friend
}

/**
* @param $model
* @param $model
* @return SentFriend|null
*/
private function getSentFriend($model): ?SentFriend
Expand All @@ -245,7 +245,7 @@ private function getSentFriend($model): ?SentFriend
}

/**
* @param $model
* @param $model
* @return PendingFriend|null
*/
private function getPendingFriend($model): ?PendingFriend
Expand Down
1 change: 1 addition & 0 deletions src/Contracts/Ownerable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @property string|int $owner_id
* @property string $owner_type
* @property-read Model|MessengerProvider $owner
*
* @mixin Model|\Eloquent
*/
interface Ownerable
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public function renderForConsole($output, Throwable $e): void
}

/**
* @param $method
* @param $parameters
* @param $method
* @param $parameters
* @return mixed
*/
public function __call($method, $parameters)
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/AudioMessageCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AudioMessageCollection extends MessengerCollection
/**
* AudioMessageCollection constructor.
*
* @param $resource
* @param $resource
* @param Thread $thread
* @param bool $paginate
* @param string|null $pageId
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/CallCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CallCollection extends MessengerCollection
/**
* CallCollection constructor.
*
* @param $resource
* @param $resource
* @param Thread $thread
* @param bool $paginate
* @param string|null $pageId
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/DocumentMessageCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DocumentMessageCollection extends MessengerCollection
/**
* DocumentMessageCollection constructor.
*
* @param $resource
* @param $resource
* @param Thread $thread
* @param bool $paginate
* @param string|null $pageId
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/GroupThreadCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GroupThreadCollection extends MessengerCollection
/**
* GroupThreadCollection constructor.
*
* @param $resource
* @param $resource
* @param bool $paginate
* @param string|null $pageId
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/ImageMessageCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ImageMessageCollection extends MessengerCollection
/**
* ImagesCollection constructor.
*
* @param $resource
* @param $resource
* @param Thread $thread
* @param bool $paginate
* @param string|null $pageId
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/InviteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class InviteCollection extends MessengerCollection
/**
* InviteCollection constructor.
*
* @param $resource
* @param $resource
* @param Thread $thread
*/
public function __construct($resource, Thread $thread)
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/MessageCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MessageCollection extends MessengerCollection
/**
* MessageCollection constructor.
*
* @param $resource
* @param $resource
* @param Thread $thread
* @param bool $paginate
* @param string|null $pageId
Expand Down
22 changes: 11 additions & 11 deletions src/Http/Collections/MessengerCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,37 +270,37 @@ protected function isFinalPage(): bool
switch ($this->collectionType) {
case 'threads':
$model = app(ThreadRepository::class)->getProviderOldestThread();
break;
break;
case 'groups':
$model = app(GroupThreadRepository::class)->getProviderOldestGroupThread();
break;
break;
case 'privates':
$model = app(PrivateThreadRepository::class)->getProviderOldestPrivateThread();
break;
break;
case 'participants':
$model = $this->thread->participants()->latest()->first();
break;
break;
case 'messages':
$model = $this->thread->messages()->oldest()->first();
break;
break;
case 'calls':
$model = $this->thread->calls()->videoCall()->oldest()->first();
break;
break;
case 'logs':
$model = $this->thread->messages()->system()->oldest()->first();
break;
break;
case 'images':
$model = $this->thread->messages()->image()->oldest()->first();
break;
break;
case 'audio':
$model = $this->thread->messages()->audio()->oldest()->first();
break;
break;
case 'documents':
$model = $this->thread->messages()->document()->oldest()->first();
break;
break;
case 'videos':
$model = $this->thread->messages()->video()->oldest()->first();
break;
break;
}

return (bool) $this->collection->firstWhere('id', optional($model)->getKey());
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/ParticipantCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ParticipantCollection extends MessengerCollection
/**
* ParticipantCollection constructor.
*
* @param $resource
* @param $resource
* @param Thread $thread
* @param bool $paginate
* @param string|null $pageId
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/PrivateThreadCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PrivateThreadCollection extends MessengerCollection
/**
* GroupThreadCollection constructor.
*
* @param $resource
* @param $resource
* @param bool $paginate
* @param string|null $pageId
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/SearchCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SearchCollection extends MessengerCollection
/**
* SearchCollection constructor.
*
* @param $resource
* @param $resource
* @param null $searchQuery
* @param array|null $searchQueryItems
* @param bool $addOptions
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/SystemMessageCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SystemMessageCollection extends MessengerCollection
/**
* SystemMessageCollection constructor.
*
* @param $resource
* @param $resource
* @param Thread $thread
* @param bool $paginate
* @param string|null $pageId
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/ThreadCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ThreadCollection extends MessengerCollection
/**
* ThreadCollection constructor.
*
* @param $resource
* @param $resource
* @param bool $paginate
* @param string|null $pageId
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Collections/VideoMessageCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class VideoMessageCollection extends MessengerCollection
/**
* VideoMessageCollection constructor.
*
* @param $resource
* @param $resource
* @param Thread $thread
* @param bool $paginate
* @param string|null $pageId
Expand Down
2 changes: 1 addition & 1 deletion src/Messenger.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function flush(): void
}

/**
* @param $provider
* @param $provider
* @return Model|string|null
*/
private function getClassNameString($provider = null): ?string
Expand Down
4 changes: 2 additions & 2 deletions src/MessengerBots.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function findHandler(?string $handlerOrAlias = null): ?string
}

return $this->handlers->search(
fn (BotActionHandlerDTO $handler) => $handler->alias === $handlerOrAlias
fn (BotActionHandlerDTO $handler) => $handler->alias === $handlerOrAlias
) ?: null;
}

Expand Down Expand Up @@ -406,7 +406,7 @@ public function findPackagedBot(?string $packageOrAlias = null): ?string
}

return $this->packagedBots->search(
fn (PackagedBotDTO $package) => $package->alias === $packageOrAlias
fn (PackagedBotDTO $package) => $package->alias === $packageOrAlias
) ?: null;
}

Expand Down
Loading

0 comments on commit 9756e3b

Please sign in to comment.