generated from Nodarx/template
feat: initial version
Signed-off-by: Sebastian Krupinski <root@LAPTOP-7DVOR6NC>
This commit was merged in pull request #1.
This commit is contained in:
13
lib/Client/Protocol/Response/Line/CommandContinuation.php
Normal file
13
lib/Client/Protocol/Response/Line/CommandContinuation.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line;
|
||||
|
||||
final readonly class CommandContinuation implements Line
|
||||
{
|
||||
public function __construct(
|
||||
public string $message,
|
||||
) {
|
||||
}
|
||||
}
|
||||
15
lib/Client/Protocol/Response/Line/Data/CapabilityData.php
Normal file
15
lib/Client/Protocol/Response/Line/Data/CapabilityData.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data;
|
||||
|
||||
final readonly class CapabilityData implements Data
|
||||
{
|
||||
/**
|
||||
* @param list<string> $capabilities
|
||||
*/
|
||||
public function __construct(public array $capabilities)
|
||||
{
|
||||
}
|
||||
}
|
||||
11
lib/Client/Protocol/Response/Line/Data/Data.php
Normal file
11
lib/Client/Protocol/Response/Line/Data/Data.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data;
|
||||
|
||||
use Gricob\IMAP\Protocol\Response\Line\Line;
|
||||
|
||||
interface Data extends Line
|
||||
{
|
||||
}
|
||||
12
lib/Client/Protocol/Response/Line/Data/ExistsData.php
Normal file
12
lib/Client/Protocol/Response/Line/Data/ExistsData.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data;
|
||||
|
||||
final readonly class ExistsData implements Data
|
||||
{
|
||||
public function __construct(public int $numberOfMessages)
|
||||
{
|
||||
}
|
||||
}
|
||||
12
lib/Client/Protocol/Response/Line/Data/ExpungeData.php
Normal file
12
lib/Client/Protocol/Response/Line/Data/ExpungeData.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data;
|
||||
|
||||
final readonly class ExpungeData implements Data
|
||||
{
|
||||
public function __construct(public int $id)
|
||||
{
|
||||
}
|
||||
}
|
||||
16
lib/Client/Protocol/Response/Line/Data/Fetch/Address.php
Normal file
16
lib/Client/Protocol/Response/Line/Data/Fetch/Address.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch;
|
||||
|
||||
final readonly class Address
|
||||
{
|
||||
public function __construct(
|
||||
public ?string $displayName,
|
||||
public ?string $atDomainList,
|
||||
public ?string $mailboxName,
|
||||
public ?string $hostName,
|
||||
) {
|
||||
}
|
||||
}
|
||||
12
lib/Client/Protocol/Response/Line/Data/Fetch/BodySection.php
Normal file
12
lib/Client/Protocol/Response/Line/Data/Fetch/BodySection.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch;
|
||||
|
||||
final readonly class BodySection
|
||||
{
|
||||
public function __construct(public string $section, public string $text)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch;
|
||||
|
||||
use Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodyStructure\Part;
|
||||
|
||||
class BodyStructure
|
||||
{
|
||||
public function __construct(
|
||||
public Part $part,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodyStructure;
|
||||
|
||||
final readonly class Disposition
|
||||
{
|
||||
/**
|
||||
* @param array<string, string> $attributes
|
||||
*/
|
||||
public function __construct(
|
||||
public string $type,
|
||||
public array $attributes,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodyStructure;
|
||||
|
||||
use Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodyStructure;
|
||||
use Gricob\IMAP\Protocol\Response\Line\Data\Fetch\Envelope;
|
||||
|
||||
readonly class MessagePart extends SinglePart
|
||||
{
|
||||
/**
|
||||
* @param array<string, string> $attributes
|
||||
* @param string[]|null $language
|
||||
*/
|
||||
public function __construct(
|
||||
array $attributes,
|
||||
?string $id,
|
||||
?string $description,
|
||||
string $encoding,
|
||||
int $size,
|
||||
public Envelope $envelope,
|
||||
public BodyStructure $bodyStructure,
|
||||
public int $textLines,
|
||||
?string $md5,
|
||||
?Disposition $disposition,
|
||||
?array $language,
|
||||
?string $location,
|
||||
) {
|
||||
parent::__construct(
|
||||
'MESSAGE',
|
||||
'RFC822',
|
||||
$attributes,
|
||||
$id,
|
||||
$description,
|
||||
$encoding,
|
||||
$size,
|
||||
$md5,
|
||||
$disposition,
|
||||
$language,
|
||||
$location,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodyStructure;
|
||||
|
||||
final readonly class MultiPart extends Part
|
||||
{
|
||||
/**
|
||||
* @param array<string,string> $attributes
|
||||
* @param string[] $language
|
||||
* @param list<Part> $parts
|
||||
*/
|
||||
public function __construct(
|
||||
string $subtype,
|
||||
array $attributes,
|
||||
public array $parts,
|
||||
public ?Disposition $disposition,
|
||||
public ?array $language,
|
||||
public ?string $location,
|
||||
) {
|
||||
parent::__construct('MULTIPART', $subtype, $attributes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodyStructure;
|
||||
|
||||
abstract readonly class Part
|
||||
{
|
||||
/**
|
||||
* @param array<string,string> $attributes
|
||||
*/
|
||||
public function __construct(
|
||||
public string $type,
|
||||
public string $subtype,
|
||||
public array $attributes,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodyStructure;
|
||||
|
||||
readonly class SinglePart extends Part
|
||||
{
|
||||
/**
|
||||
* @param array<string,string> $attributes
|
||||
* @param string[]|null $language
|
||||
*/
|
||||
public function __construct(
|
||||
string $type,
|
||||
string $subtype,
|
||||
array $attributes,
|
||||
public ?string $id,
|
||||
public ?string $description,
|
||||
public string $encoding,
|
||||
public int $size,
|
||||
public ?string $md5,
|
||||
public ?Disposition $disposition,
|
||||
public ?array $language,
|
||||
public ?string $location,
|
||||
) {
|
||||
parent::__construct($type, $subtype, $attributes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodyStructure;
|
||||
|
||||
final readonly class TextPart extends SinglePart
|
||||
{
|
||||
/**
|
||||
* @param array<string, string> $attributes
|
||||
* @param string[]|null $language
|
||||
*/
|
||||
public function __construct(
|
||||
string $subtype,
|
||||
array $attributes,
|
||||
?string $id,
|
||||
?string $description,
|
||||
string $encoding,
|
||||
int $size,
|
||||
public int $textLines,
|
||||
?string $md5,
|
||||
?Disposition $disposition,
|
||||
?array $language,
|
||||
?string $location,
|
||||
) {
|
||||
parent::__construct(
|
||||
'TEXT',
|
||||
$subtype,
|
||||
$attributes,
|
||||
$id,
|
||||
$description,
|
||||
$encoding,
|
||||
$size,
|
||||
$md5,
|
||||
$disposition,
|
||||
$language,
|
||||
$location,
|
||||
);
|
||||
}
|
||||
}
|
||||
32
lib/Client/Protocol/Response/Line/Data/Fetch/Envelope.php
Normal file
32
lib/Client/Protocol/Response/Line/Data/Fetch/Envelope.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data\Fetch;
|
||||
|
||||
use DateTimeImmutable;
|
||||
|
||||
final readonly class Envelope
|
||||
{
|
||||
/**
|
||||
* @param Address[]|null $from
|
||||
* @param Address[]|null $sender
|
||||
* @param Address[]|null $replyTo
|
||||
* @param Address[]|null $to
|
||||
* @param Address[]|null $cc
|
||||
* @param Address[]|null $bcc
|
||||
*/
|
||||
public function __construct(
|
||||
public ?DateTimeImmutable $date,
|
||||
public ?string $subject,
|
||||
public ?array $from,
|
||||
public ?array $sender,
|
||||
public ?array $replyTo,
|
||||
public ?array $to,
|
||||
public ?array $cc,
|
||||
public ?array $bcc,
|
||||
public ?string $inReplyTo,
|
||||
public ?string $messageId,
|
||||
) {
|
||||
}
|
||||
}
|
||||
40
lib/Client/Protocol/Response/Line/Data/FetchData.php
Normal file
40
lib/Client/Protocol/Response/Line/Data/FetchData.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data;
|
||||
|
||||
use Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodySection;
|
||||
use Gricob\IMAP\Protocol\Response\Line\Data\Fetch\BodyStructure;
|
||||
use Gricob\IMAP\Protocol\Response\Line\Data\Fetch\Envelope;
|
||||
|
||||
final readonly class FetchData implements Data
|
||||
{
|
||||
/**
|
||||
* @param array<string>|null $flags
|
||||
* @param BodySection[] $bodySections
|
||||
*/
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public ?array $flags = null,
|
||||
public ?\DateTimeImmutable $internalDate = null,
|
||||
public ?Envelope $envelope = null,
|
||||
public ?int $rfc822Size = null,
|
||||
public ?string $rfc822 = null,
|
||||
public ?int $uid = null,
|
||||
public ?BodyStructure $bodyStructure = null,
|
||||
public array $bodySections = [],
|
||||
) {
|
||||
}
|
||||
|
||||
public function getBodySection(string $name): ?BodySection
|
||||
{
|
||||
foreach (($this->bodySections ?? []) as $bodySection) {
|
||||
if ($bodySection->section == $name) {
|
||||
return $bodySection;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
15
lib/Client/Protocol/Response/Line/Data/FlagsData.php
Normal file
15
lib/Client/Protocol/Response/Line/Data/FlagsData.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data;
|
||||
|
||||
final readonly class FlagsData implements Data
|
||||
{
|
||||
/**
|
||||
* @param list<string> $flags
|
||||
*/
|
||||
public function __construct(public array $flags)
|
||||
{
|
||||
}
|
||||
}
|
||||
18
lib/Client/Protocol/Response/Line/Data/ListData.php
Normal file
18
lib/Client/Protocol/Response/Line/Data/ListData.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data;
|
||||
|
||||
final class ListData implements Data
|
||||
{
|
||||
/**
|
||||
* @param list<string> $nameAttributes
|
||||
*/
|
||||
public function __construct(
|
||||
public array $nameAttributes,
|
||||
public string $hierarchyDelimiter,
|
||||
public string $name
|
||||
) {
|
||||
}
|
||||
}
|
||||
12
lib/Client/Protocol/Response/Line/Data/RecentData.php
Normal file
12
lib/Client/Protocol/Response/Line/Data/RecentData.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data;
|
||||
|
||||
final class RecentData implements Data
|
||||
{
|
||||
public function __construct(public int $numberOfMessages)
|
||||
{
|
||||
}
|
||||
}
|
||||
15
lib/Client/Protocol/Response/Line/Data/SearchData.php
Normal file
15
lib/Client/Protocol/Response/Line/Data/SearchData.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Data;
|
||||
|
||||
final readonly class SearchData implements Data
|
||||
{
|
||||
/**
|
||||
* @param list<int> $numbers
|
||||
*/
|
||||
public function __construct(public array $numbers)
|
||||
{
|
||||
}
|
||||
}
|
||||
9
lib/Client/Protocol/Response/Line/Line.php
Normal file
9
lib/Client/Protocol/Response/Line/Line.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line;
|
||||
|
||||
interface Line
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status\Code;
|
||||
|
||||
final readonly class AppendUidCode implements Code
|
||||
{
|
||||
public function __construct(
|
||||
public int $uidValidity,
|
||||
public int $uid,
|
||||
) {
|
||||
}
|
||||
}
|
||||
9
lib/Client/Protocol/Response/Line/Status/Code/Code.php
Normal file
9
lib/Client/Protocol/Response/Line/Status/Code/Code.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status\Code;
|
||||
|
||||
interface Code
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status\Code;
|
||||
|
||||
final readonly class PermanentFlagsCode implements Code
|
||||
{
|
||||
/**
|
||||
* @param string[] $flags
|
||||
*/
|
||||
public function __construct(
|
||||
public array $flags,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status\Code;
|
||||
|
||||
final readonly class ReadOnlyCode implements Code
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status\Code;
|
||||
|
||||
final readonly class ReadWriteCode implements Code
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status\Code;
|
||||
|
||||
final readonly class UidNextCode implements Code
|
||||
{
|
||||
public function __construct(
|
||||
public int $value,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status\Code;
|
||||
|
||||
final readonly class UidValidityCode implements Code
|
||||
{
|
||||
public function __construct(
|
||||
public int $value,
|
||||
) {
|
||||
}
|
||||
}
|
||||
13
lib/Client/Protocol/Response/Line/Status/Code/UnseenCode.php
Normal file
13
lib/Client/Protocol/Response/Line/Status/Code/UnseenCode.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status\Code;
|
||||
|
||||
final readonly class UnseenCode implements Code
|
||||
{
|
||||
public function __construct(
|
||||
public int $seq,
|
||||
) {
|
||||
}
|
||||
}
|
||||
19
lib/Client/Protocol/Response/Line/Status/Status.php
Normal file
19
lib/Client/Protocol/Response/Line/Status/Status.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status;
|
||||
|
||||
use Gricob\IMAP\Protocol\Response\Line\Line;
|
||||
use Gricob\IMAP\Protocol\Response\Line\Status\Code\Code;
|
||||
|
||||
final readonly class Status implements Line
|
||||
{
|
||||
final public function __construct(
|
||||
public string $tag,
|
||||
public StatusType $type,
|
||||
public ?Code $code,
|
||||
public string $message
|
||||
) {
|
||||
}
|
||||
}
|
||||
12
lib/Client/Protocol/Response/Line/Status/StatusType.php
Normal file
12
lib/Client/Protocol/Response/Line/Status/StatusType.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Response\Line\Status;
|
||||
|
||||
enum StatusType: string
|
||||
{
|
||||
case OK = 'OK';
|
||||
case NO = 'NO';
|
||||
case BAD = 'BAD';
|
||||
case PREAUTH = 'PREAUTH';
|
||||
case BYE = 'BYE';
|
||||
}
|
||||
Reference in New Issue
Block a user