generated from Nodarx/template
refactor: mailbox status names
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace KTXM\ProviderImap\Client;
|
||||
|
||||
use KTXM\ProviderImap\Client\Result\StatusResult;
|
||||
use KTXM\ProviderImap\Client\Result\MailboxStatusResult;
|
||||
|
||||
final class Mailbox
|
||||
{
|
||||
@@ -18,13 +18,13 @@ final class Mailbox
|
||||
private readonly array $attributes,
|
||||
private readonly int $messages = 0,
|
||||
private readonly int $unread = 0,
|
||||
private readonly ?int $state = null,
|
||||
private readonly ?int $uidValidity = null,
|
||||
private readonly int $recent = 0,
|
||||
private readonly array $flags = [],
|
||||
private readonly bool $readOnly = true,
|
||||
) {}
|
||||
|
||||
public function fromStatus(StatusResult $status): self
|
||||
public function fromStatus(MailboxStatusResult $status): self
|
||||
{
|
||||
return new self(
|
||||
$this->name,
|
||||
@@ -32,7 +32,7 @@ final class Mailbox
|
||||
$this->attributes,
|
||||
$status->messages() ?? $this->messages,
|
||||
$status->unseen() ?? $this->unread,
|
||||
$status->state() ?? $this->state,
|
||||
$status->uidValidity() ?? $this->uidValidity,
|
||||
$this->recent,
|
||||
$this->flags,
|
||||
$this->readOnly,
|
||||
@@ -57,9 +57,9 @@ final class Mailbox
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
public function state(): ?int
|
||||
public function uidValidity(): ?int
|
||||
{
|
||||
return $this->state;
|
||||
return $this->uidValidity;
|
||||
}
|
||||
|
||||
public function messages(): int
|
||||
|
||||
@@ -153,7 +153,7 @@ final class ListCommand implements CommandInterface
|
||||
$mailbox->attributes(),
|
||||
$status['MESSAGES'] ?? $mailbox->messages(),
|
||||
$status['UNSEEN'] ?? $mailbox->unread(),
|
||||
$mailbox->state(),
|
||||
$mailbox->uidValidity(),
|
||||
$mailbox->recent(),
|
||||
$mailbox->flags(),
|
||||
$mailbox->readOnly(),
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace KTXM\ProviderImap\Client\Protocol\Command;
|
||||
|
||||
use KTXM\ProviderImap\Client\Protocol\StringEncoder;
|
||||
use KTXM\ProviderImap\Client\Protocol\Parser\StatusResponseParser;
|
||||
use KTXM\ProviderImap\Client\Result\StatusResult;
|
||||
use KTXM\ProviderImap\Client\Result\MailboxStatusResult;
|
||||
use KTXM\ProviderImap\Client\ImapException;
|
||||
use KTXM\ProviderImap\Client\Protocol\RequestFrame;
|
||||
use KTXM\ProviderImap\Client\Protocol\Response\TaggedResponse;
|
||||
@@ -16,7 +16,7 @@ use KTXM\ProviderImap\Client\Protocol\SessionContext;
|
||||
use KTXM\ProviderImap\Client\Protocol\SessionState;
|
||||
|
||||
/**
|
||||
* @implements CommandInterface<StatusResult>
|
||||
* @implements CommandInterface<MailboxStatusResult>
|
||||
*/
|
||||
final class StatusCommand implements CommandInterface
|
||||
{
|
||||
@@ -57,7 +57,7 @@ final class StatusCommand implements CommandInterface
|
||||
));
|
||||
}
|
||||
|
||||
public function handle(ResponseStream $responses, SessionContext $context): StatusResult
|
||||
public function handle(ResponseStream $responses, SessionContext $context): MailboxStatusResult
|
||||
{
|
||||
unset($context);
|
||||
|
||||
@@ -75,7 +75,7 @@ final class StatusCommand implements CommandInterface
|
||||
throw new ImapException('STATUS failed: ' . $response->text());
|
||||
}
|
||||
|
||||
return new StatusResult($mailbox, $items);
|
||||
return new MailboxStatusResult($mailbox, $items);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace KTXM\ProviderImap\Client\Result;
|
||||
|
||||
final class StatusResult
|
||||
final class MailboxStatusResult
|
||||
{
|
||||
/**
|
||||
* @param array<string, int> $items
|
||||
@@ -47,7 +47,7 @@ final class StatusResult
|
||||
return max(0, $this->messages() - $this->unseen());
|
||||
}
|
||||
|
||||
public function state(): int
|
||||
public function uidValidity(): int
|
||||
{
|
||||
return $this->value('UIDVALIDITY');
|
||||
}
|
||||
Reference in New Issue
Block a user