generated from Nodarx/template
refactor: use custom imap client
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
178
lib/Client/Message.php
Normal file
178
lib/Client/Message.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KTXM\ProviderImap\Client;
|
||||
|
||||
final class Message
|
||||
{
|
||||
/**
|
||||
* @param list<string> $flags
|
||||
* @param list<MessageAddress> $from
|
||||
* @param list<MessageAddress> $sender
|
||||
* @param list<MessageAddress> $replyTo
|
||||
* @param list<MessageAddress> $to
|
||||
* @param list<MessageAddress> $cc
|
||||
* @param list<MessageAddress> $bcc
|
||||
* @param array<string, string> $bodySections
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly int $sequence,
|
||||
private readonly int $uid,
|
||||
private readonly int $size,
|
||||
private readonly ?string $internalDate,
|
||||
private readonly array $flags,
|
||||
private readonly ?string $subject,
|
||||
private readonly ?string $sentAt,
|
||||
private readonly ?string $messageId,
|
||||
private readonly ?string $inReplyTo,
|
||||
private readonly array $from,
|
||||
private readonly array $sender,
|
||||
private readonly array $replyTo,
|
||||
private readonly array $to,
|
||||
private readonly array $cc,
|
||||
private readonly array $bcc,
|
||||
private readonly ?MessagePart $bodyStructure,
|
||||
private readonly array $bodySections,
|
||||
) {}
|
||||
|
||||
public function sequence(): int
|
||||
{
|
||||
return $this->sequence;
|
||||
}
|
||||
|
||||
public function uid(): int
|
||||
{
|
||||
return $this->uid;
|
||||
}
|
||||
|
||||
public function size(): int
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
public function internalDate(): ?string
|
||||
{
|
||||
return $this->internalDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function flags(): array
|
||||
{
|
||||
return $this->flags;
|
||||
}
|
||||
|
||||
public function subject(): ?string
|
||||
{
|
||||
return $this->subject;
|
||||
}
|
||||
|
||||
public function sentAt(): ?string
|
||||
{
|
||||
return $this->sentAt;
|
||||
}
|
||||
|
||||
public function messageId(): ?string
|
||||
{
|
||||
return $this->messageId;
|
||||
}
|
||||
|
||||
public function inReplyTo(): ?string
|
||||
{
|
||||
return $this->inReplyTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<MessageAddress>
|
||||
*/
|
||||
public function from(): array
|
||||
{
|
||||
return $this->from;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<MessageAddress>
|
||||
*/
|
||||
public function sender(): array
|
||||
{
|
||||
return $this->sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<MessageAddress>
|
||||
*/
|
||||
public function replyTo(): array
|
||||
{
|
||||
return $this->replyTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<MessageAddress>
|
||||
*/
|
||||
public function to(): array
|
||||
{
|
||||
return $this->to;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<MessageAddress>
|
||||
*/
|
||||
public function cc(): array
|
||||
{
|
||||
return $this->cc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<MessageAddress>
|
||||
*/
|
||||
public function bcc(): array
|
||||
{
|
||||
return $this->bcc;
|
||||
}
|
||||
|
||||
public function bodyStructure(): ?MessagePart
|
||||
{
|
||||
return $this->bodyStructure;
|
||||
}
|
||||
|
||||
public function bodyText(): ?string
|
||||
{
|
||||
return $this->bodyText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function bodySections(): array
|
||||
{
|
||||
return $this->bodySections;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $bodySections
|
||||
*/
|
||||
public function withBodyData(?MessagePart $bodyStructure, array $bodySections): self
|
||||
{
|
||||
return new self(
|
||||
$this->sequence,
|
||||
$this->uid,
|
||||
$this->size,
|
||||
$this->internalDate,
|
||||
$this->flags,
|
||||
$this->subject,
|
||||
$this->sentAt,
|
||||
$this->messageId,
|
||||
$this->inReplyTo,
|
||||
$this->from,
|
||||
$this->sender,
|
||||
$this->replyTo,
|
||||
$this->to,
|
||||
$this->cc,
|
||||
$this->bcc,
|
||||
$bodyStructure,
|
||||
$bodySections,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user