[Web] Update libs
[Web] Update filename when downloading
This commit is contained in:
@@ -8,6 +8,7 @@ use Ddeboer\Imap\Exception\CreateMailboxException;
|
||||
use Ddeboer\Imap\Exception\DeleteMailboxException;
|
||||
use Ddeboer\Imap\Exception\ImapGetmailboxesException;
|
||||
use Ddeboer\Imap\Exception\ImapNumMsgException;
|
||||
use Ddeboer\Imap\Exception\ImapQuotaException;
|
||||
use Ddeboer\Imap\Exception\InvalidResourceException;
|
||||
use Ddeboer\Imap\Exception\MailboxDoesNotExistException;
|
||||
|
||||
@@ -39,9 +40,6 @@ final class Connection implements ConnectionInterface
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ImapResourceInterface $resource
|
||||
* @param string $server
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct(ImapResourceInterface $resource, string $server)
|
||||
@@ -52,8 +50,6 @@ final class Connection implements ConnectionInterface
|
||||
|
||||
/**
|
||||
* Get IMAP resource.
|
||||
*
|
||||
* @return ImapResourceInterface
|
||||
*/
|
||||
public function getResource(): ImapResourceInterface
|
||||
{
|
||||
@@ -62,8 +58,6 @@ final class Connection implements ConnectionInterface
|
||||
|
||||
/**
|
||||
* Delete all messages marked for deletion.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function expunge(): bool
|
||||
{
|
||||
@@ -72,16 +66,46 @@ final class Connection implements ConnectionInterface
|
||||
|
||||
/**
|
||||
* Close connection.
|
||||
*
|
||||
* @param int $flag
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function close(int $flag = 0): bool
|
||||
{
|
||||
$this->resource->clearLastMailboxUsedCache();
|
||||
|
||||
return \imap_close($this->resource->getStream(), $flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Mailbox quota.
|
||||
*/
|
||||
public function getQuota(string $root = 'INBOX'): array
|
||||
{
|
||||
$errorMessage = null;
|
||||
$errorNumber = 0;
|
||||
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber): bool {
|
||||
$errorMessage = $message;
|
||||
$errorNumber = $nr;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$return = \imap_get_quotaroot($this->resource->getStream(), $root);
|
||||
|
||||
\restore_error_handler();
|
||||
|
||||
if (false === $return || null !== $errorMessage) {
|
||||
throw new ImapQuotaException(
|
||||
\sprintf(
|
||||
'IMAP Quota request failed for "%s"%s',
|
||||
$root,
|
||||
null !== $errorMessage ? ': ' . $errorMessage : ''
|
||||
),
|
||||
$errorNumber
|
||||
);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of mailboxes (also known as folders).
|
||||
*
|
||||
@@ -105,8 +129,6 @@ final class Connection implements ConnectionInterface
|
||||
* Check that a mailbox with the given name exists.
|
||||
*
|
||||
* @param string $name Mailbox name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasMailbox(string $name): bool
|
||||
{
|
||||
@@ -121,8 +143,6 @@ final class Connection implements ConnectionInterface
|
||||
* @param string $name Mailbox name
|
||||
*
|
||||
* @throws MailboxDoesNotExistException If mailbox does not exist
|
||||
*
|
||||
* @return MailboxInterface
|
||||
*/
|
||||
public function getMailbox(string $name): MailboxInterface
|
||||
{
|
||||
@@ -153,8 +173,6 @@ final class Connection implements ConnectionInterface
|
||||
* Check if the connection is still active.
|
||||
*
|
||||
* @throws InvalidResourceException If connection was closed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function ping(): bool
|
||||
{
|
||||
@@ -164,11 +182,7 @@ final class Connection implements ConnectionInterface
|
||||
/**
|
||||
* Create mailbox.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @throws CreateMailboxException
|
||||
*
|
||||
* @return MailboxInterface
|
||||
*/
|
||||
public function createMailbox(string $name): MailboxInterface
|
||||
{
|
||||
@@ -185,8 +199,6 @@ final class Connection implements ConnectionInterface
|
||||
/**
|
||||
* Create mailbox.
|
||||
*
|
||||
* @param MailboxInterface $mailbox
|
||||
*
|
||||
* @throws DeleteMailboxException
|
||||
*/
|
||||
public function deleteMailbox(MailboxInterface $mailbox): void
|
||||
|
@@ -11,34 +11,29 @@ interface ConnectionInterface extends \Countable
|
||||
{
|
||||
/**
|
||||
* Get IMAP resource.
|
||||
*
|
||||
* @return ImapResourceInterface
|
||||
*/
|
||||
public function getResource(): ImapResourceInterface;
|
||||
|
||||
/**
|
||||
* Delete all messages marked for deletion.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function expunge(): bool;
|
||||
|
||||
/**
|
||||
* Close connection.
|
||||
*
|
||||
* @param int $flag
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function close(int $flag = 0): bool;
|
||||
|
||||
/**
|
||||
* Check if the connection is still active.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function ping(): bool;
|
||||
|
||||
/**
|
||||
* Get Mailbox quota.
|
||||
*/
|
||||
public function getQuota(string $root = 'INBOX'): array;
|
||||
|
||||
/**
|
||||
* Get a list of mailboxes (also known as folders).
|
||||
*
|
||||
@@ -50,8 +45,6 @@ interface ConnectionInterface extends \Countable
|
||||
* Check that a mailbox with the given name exists.
|
||||
*
|
||||
* @param string $name Mailbox name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasMailbox(string $name): bool;
|
||||
|
||||
@@ -59,24 +52,16 @@ interface ConnectionInterface extends \Countable
|
||||
* Get a mailbox by its name.
|
||||
*
|
||||
* @param string $name Mailbox name
|
||||
*
|
||||
* @return MailboxInterface
|
||||
*/
|
||||
public function getMailbox(string $name): MailboxInterface;
|
||||
|
||||
/**
|
||||
* Create mailbox.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return MailboxInterface
|
||||
*/
|
||||
public function createMailbox(string $name): MailboxInterface;
|
||||
|
||||
/**
|
||||
* Create mailbox.
|
||||
*
|
||||
* @param MailboxInterface $mailbox
|
||||
* Delete mailbox.
|
||||
*/
|
||||
public function deleteMailbox(MailboxInterface $mailbox): void;
|
||||
}
|
||||
|
9
data/web/inc/lib/vendor/ddeboer/imap/src/Exception/ImapQuotaException.php
vendored
Normal file
9
data/web/inc/lib/vendor/ddeboer/imap/src/Exception/ImapQuotaException.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Ddeboer\Imap\Exception;
|
||||
|
||||
final class ImapQuotaException extends AbstractException
|
||||
{
|
||||
}
|
@@ -49,8 +49,6 @@ final class Mailbox implements MailboxInterface
|
||||
|
||||
/**
|
||||
* Get mailbox decoded name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
@@ -59,8 +57,6 @@ final class Mailbox implements MailboxInterface
|
||||
|
||||
/**
|
||||
* Get mailbox encoded path.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEncodedName(): string
|
||||
{
|
||||
@@ -72,8 +68,6 @@ final class Mailbox implements MailboxInterface
|
||||
|
||||
/**
|
||||
* Get mailbox encoded full name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullEncodedName(): string
|
||||
{
|
||||
@@ -82,8 +76,6 @@ final class Mailbox implements MailboxInterface
|
||||
|
||||
/**
|
||||
* Get mailbox attributes.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAttributes(): int
|
||||
{
|
||||
@@ -92,8 +84,6 @@ final class Mailbox implements MailboxInterface
|
||||
|
||||
/**
|
||||
* Get mailbox delimiter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter(): string
|
||||
{
|
||||
@@ -118,10 +108,6 @@ final class Mailbox implements MailboxInterface
|
||||
|
||||
/**
|
||||
* Get Mailbox status.
|
||||
*
|
||||
* @param null|int $flags
|
||||
*
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function getStatus(int $flags = null): \stdClass
|
||||
{
|
||||
@@ -139,8 +125,6 @@ final class Mailbox implements MailboxInterface
|
||||
*
|
||||
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
|
||||
* @param array|MessageIterator|string $numbers Message numbers
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setFlag(string $flag, $numbers): bool
|
||||
{
|
||||
@@ -152,8 +136,6 @@ final class Mailbox implements MailboxInterface
|
||||
*
|
||||
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
|
||||
* @param array|MessageIterator|string $numbers Message numbers
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function clearFlag(string $flag, $numbers): bool
|
||||
{
|
||||
@@ -164,8 +146,6 @@ final class Mailbox implements MailboxInterface
|
||||
* Get message ids.
|
||||
*
|
||||
* @param ConditionInterface $search Search expression (optional)
|
||||
*
|
||||
* @return MessageIteratorInterface
|
||||
*/
|
||||
public function getMessages(ConditionInterface $search = null, int $sortCriteria = null, bool $descending = false, string $charset = null): MessageIteratorInterface
|
||||
{
|
||||
@@ -217,8 +197,6 @@ final class Mailbox implements MailboxInterface
|
||||
* Get message iterator for a sequence.
|
||||
*
|
||||
* @param string $sequence Message numbers
|
||||
*
|
||||
* @return MessageIteratorInterface
|
||||
*/
|
||||
public function getMessageSequence(string $sequence): MessageIteratorInterface
|
||||
{
|
||||
@@ -242,8 +220,6 @@ final class Mailbox implements MailboxInterface
|
||||
* Get a message by message number.
|
||||
*
|
||||
* @param int $number Message number
|
||||
*
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function getMessage(int $number): MessageInterface
|
||||
{
|
||||
@@ -252,8 +228,6 @@ final class Mailbox implements MailboxInterface
|
||||
|
||||
/**
|
||||
* Get messages in this mailbox.
|
||||
*
|
||||
* @return MessageIteratorInterface
|
||||
*/
|
||||
public function getIterator(): MessageIteratorInterface
|
||||
{
|
||||
@@ -262,12 +236,6 @@ final class Mailbox implements MailboxInterface
|
||||
|
||||
/**
|
||||
* Add a message to the mailbox.
|
||||
*
|
||||
* @param string $message
|
||||
* @param null|string $options
|
||||
* @param null|DateTimeInterface $internalDate
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function addMessage(string $message, string $options = null, DateTimeInterface $internalDate = null): bool
|
||||
{
|
||||
@@ -288,12 +256,12 @@ final class Mailbox implements MailboxInterface
|
||||
|
||||
/**
|
||||
* Returns a tree of threaded message for the current Mailbox.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getThread(): array
|
||||
{
|
||||
\set_error_handler(static function () {});
|
||||
\set_error_handler(static function (): bool {
|
||||
return true;
|
||||
});
|
||||
|
||||
/** @var array|false $tree */
|
||||
$tree = \imap_thread($this->resource->getStream());
|
||||
@@ -337,8 +305,6 @@ final class Mailbox implements MailboxInterface
|
||||
* Prepare message ids for the use with bulk functions.
|
||||
*
|
||||
* @param array|MessageIterator|string $messageIds Message numbers
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function prepareMessageIds($messageIds): string
|
||||
{
|
||||
|
@@ -14,45 +14,31 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* Get mailbox decoded name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* Get mailbox encoded path.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEncodedName(): string;
|
||||
|
||||
/**
|
||||
* Get mailbox encoded full name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullEncodedName(): string;
|
||||
|
||||
/**
|
||||
* Get mailbox attributes.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAttributes(): int;
|
||||
|
||||
/**
|
||||
* Get mailbox delimiter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter(): string;
|
||||
|
||||
/**
|
||||
* Get Mailbox status.
|
||||
*
|
||||
* @param null|int $flags
|
||||
*
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function getStatus(int $flags = null): \stdClass;
|
||||
|
||||
@@ -61,8 +47,6 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
|
||||
*
|
||||
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
|
||||
* @param array|MessageIterator|string $numbers Message numbers
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setFlag(string $flag, $numbers): bool;
|
||||
|
||||
@@ -71,8 +55,6 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
|
||||
*
|
||||
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
|
||||
* @param array|MessageIterator|string $numbers Message numbers
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function clearFlag(string $flag, $numbers): bool;
|
||||
|
||||
@@ -80,8 +62,6 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
|
||||
* Get message ids.
|
||||
*
|
||||
* @param ConditionInterface $search Search expression (optional)
|
||||
*
|
||||
* @return MessageIteratorInterface
|
||||
*/
|
||||
public function getMessages(ConditionInterface $search = null, int $sortCriteria = null, bool $descending = false, string $charset = null): MessageIteratorInterface;
|
||||
|
||||
@@ -89,8 +69,6 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
|
||||
* Get message iterator for a sequence.
|
||||
*
|
||||
* @param string $sequence Message numbers
|
||||
*
|
||||
* @return MessageIteratorInterface
|
||||
*/
|
||||
public function getMessageSequence(string $sequence): MessageIteratorInterface;
|
||||
|
||||
@@ -98,33 +76,21 @@ interface MailboxInterface extends \Countable, \IteratorAggregate
|
||||
* Get a message by message number.
|
||||
*
|
||||
* @param int $number Message number
|
||||
*
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function getMessage(int $number): MessageInterface;
|
||||
|
||||
/**
|
||||
* Get messages in this mailbox.
|
||||
*
|
||||
* @return MessageIteratorInterface
|
||||
*/
|
||||
public function getIterator(): MessageIteratorInterface;
|
||||
|
||||
/**
|
||||
* Add a message to the mailbox.
|
||||
*
|
||||
* @param string $message
|
||||
* @param null|string $options
|
||||
* @param null|DateTimeInterface $internalDate
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function addMessage(string $message, string $options = null, DateTimeInterface $internalDate = null): bool;
|
||||
|
||||
/**
|
||||
* Returns a tree of threaded message for the current Mailbox.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getThread(): array;
|
||||
|
||||
|
@@ -73,9 +73,11 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
$errorMessage = null;
|
||||
$errorNumber = 0;
|
||||
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber) {
|
||||
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber): bool {
|
||||
$errorMessage = $message;
|
||||
$errorNumber = $nr;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$structure = \imap_fetchstructure(
|
||||
@@ -99,8 +101,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Ensure message exists.
|
||||
*
|
||||
* @param int $messageNumber
|
||||
*/
|
||||
protected function assertMessageExists(int $messageNumber): void
|
||||
{
|
||||
@@ -132,8 +132,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Get raw message headers.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawHeaders(): string
|
||||
{
|
||||
@@ -166,8 +164,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Get message headers.
|
||||
*
|
||||
* @return Message\Headers
|
||||
*/
|
||||
public function getHeaders(): Message\Headers
|
||||
{
|
||||
@@ -196,8 +192,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Get message recent flag value (from headers).
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function isRecent(): ?string
|
||||
{
|
||||
@@ -206,8 +200,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Get message unseen flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isUnseen(): bool
|
||||
{
|
||||
@@ -216,8 +208,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Get message flagged flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFlagged(): bool
|
||||
{
|
||||
@@ -226,8 +216,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Get message answered flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAnswered(): bool
|
||||
{
|
||||
@@ -236,8 +224,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Get message deleted flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDeleted(): bool
|
||||
{
|
||||
@@ -246,8 +232,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Get message draft flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDraft(): bool
|
||||
{
|
||||
@@ -256,8 +240,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Has the message been marked as read?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSeen(): bool
|
||||
{
|
||||
@@ -267,8 +249,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
/**
|
||||
* Mark message as seen.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated since version 1.1, to be removed in 2.0
|
||||
*/
|
||||
public function maskAsSeen(): bool
|
||||
@@ -280,8 +260,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
|
||||
/**
|
||||
* Mark message as seen.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function markAsSeen(): bool
|
||||
{
|
||||
@@ -291,8 +269,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
/**
|
||||
* Move message to another mailbox.
|
||||
*
|
||||
* @param MailboxInterface $mailbox
|
||||
*
|
||||
* @throws MessageCopyException
|
||||
*/
|
||||
public function copy(MailboxInterface $mailbox): void
|
||||
@@ -308,8 +284,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
/**
|
||||
* Move message to another mailbox.
|
||||
*
|
||||
* @param MailboxInterface $mailbox
|
||||
*
|
||||
* @throws MessageMoveException
|
||||
*/
|
||||
public function move(MailboxInterface $mailbox): void
|
||||
@@ -355,8 +329,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
* Set Flag Message.
|
||||
*
|
||||
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setFlag(string $flag): bool
|
||||
{
|
||||
@@ -371,8 +343,6 @@ final class Message extends Message\AbstractMessage implements MessageInterface
|
||||
* Clear Flag Message.
|
||||
*
|
||||
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function clearFlag(string $flag): bool
|
||||
{
|
||||
|
@@ -15,8 +15,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* Get message headers.
|
||||
*
|
||||
* @return Headers
|
||||
*/
|
||||
abstract public function getHeaders(): Headers;
|
||||
|
||||
@@ -24,8 +22,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
* Get message id.
|
||||
*
|
||||
* A unique message id in the form <...>
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getId(): ?string
|
||||
{
|
||||
@@ -34,8 +30,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* Get message sender (from headers).
|
||||
*
|
||||
* @return null|EmailAddress
|
||||
*/
|
||||
final public function getFrom(): ?EmailAddress
|
||||
{
|
||||
@@ -106,8 +100,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* Get date (from headers).
|
||||
*
|
||||
* @return null|\DateTimeImmutable
|
||||
*/
|
||||
final public function getDate(): ?\DateTimeImmutable
|
||||
{
|
||||
@@ -120,11 +112,13 @@ abstract class AbstractMessage extends AbstractPart
|
||||
$alteredValue = $dateHeader;
|
||||
$alteredValue = \str_replace(',', '', $alteredValue);
|
||||
$alteredValue = (string) \preg_replace('/^[a-zA-Z]+ ?/', '', $alteredValue);
|
||||
$alteredValue = (string) \preg_replace('/ +\(.*\)/', '', $alteredValue);
|
||||
$alteredValue = (string) \preg_replace('/\(.*\)/', '', $alteredValue);
|
||||
$alteredValue = (string) \preg_replace('/\bUT\b/', 'UTC', $alteredValue);
|
||||
if (0 === \preg_match('/\d\d:\d\d:\d\d.* [\+\-]\d\d:?\d\d/', $alteredValue)) {
|
||||
$alteredValue .= ' +0000';
|
||||
}
|
||||
// Handle numeric months
|
||||
$alteredValue = (string) \preg_replace('/^(\d\d) (\d\d) (\d\d(?:\d\d)?) /', '$3-$2-$1 ', $alteredValue);
|
||||
|
||||
try {
|
||||
$date = new \DateTimeImmutable($alteredValue);
|
||||
@@ -147,8 +141,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* Get message subject (from headers).
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getSubject(): ?string
|
||||
{
|
||||
@@ -157,8 +149,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* Get message In-Reply-To (from headers).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getInReplyTo(): array
|
||||
{
|
||||
@@ -169,8 +159,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* Get message References (from headers).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function getReferences(): array
|
||||
{
|
||||
@@ -181,8 +169,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* Get body HTML.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getBodyHtml(): ?string
|
||||
{
|
||||
@@ -203,8 +189,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* Get body text.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getBodyText(): ?string
|
||||
{
|
||||
@@ -237,11 +221,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
return $this->attachments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PartInterface $part
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function gatherAttachments(PartInterface $part): array
|
||||
{
|
||||
$attachments = [];
|
||||
@@ -259,8 +238,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* Does this message have attachments?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
final public function hasAttachments(): bool
|
||||
{
|
||||
@@ -269,8 +246,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
|
||||
/**
|
||||
* @param \stdClass[] $addresses
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function decodeEmailAddresses(array $addresses): array
|
||||
{
|
||||
@@ -284,11 +259,6 @@ abstract class AbstractMessage extends AbstractPart
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \stdClass $value
|
||||
*
|
||||
* @return EmailAddress
|
||||
*/
|
||||
private function decodeEmailAddress(\stdClass $value): EmailAddress
|
||||
{
|
||||
return new EmailAddress($value->mailbox, $value->host, $value->personal);
|
||||
|
@@ -157,8 +157,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Get message number (from headers).
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
final public function getNumber(): int
|
||||
{
|
||||
@@ -169,8 +167,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Ensure message exists.
|
||||
*
|
||||
* @param int $messageNumber
|
||||
*/
|
||||
protected function assertMessageExists(int $messageNumber): void
|
||||
{
|
||||
@@ -186,8 +182,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Part structure.
|
||||
*
|
||||
* @return \stdClass
|
||||
*/
|
||||
final public function getStructure(): \stdClass
|
||||
{
|
||||
@@ -205,8 +199,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Part parameters.
|
||||
*
|
||||
* @return Parameters
|
||||
*/
|
||||
final public function getParameters(): Parameters
|
||||
{
|
||||
@@ -217,8 +209,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Part charset.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getCharset(): ?string
|
||||
{
|
||||
@@ -229,8 +219,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Part type.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getType(): ?string
|
||||
{
|
||||
@@ -241,8 +229,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Part subtype.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getSubtype(): ?string
|
||||
{
|
||||
@@ -253,8 +239,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Part encoding.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getEncoding(): ?string
|
||||
{
|
||||
@@ -265,8 +249,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Part disposition.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getDisposition(): ?string
|
||||
{
|
||||
@@ -277,8 +259,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Part description.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getDescription(): ?string
|
||||
{
|
||||
@@ -301,8 +281,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Part lines.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
final public function getLines(): ?string
|
||||
{
|
||||
@@ -313,8 +291,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Get raw part content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getContent(): string
|
||||
{
|
||||
@@ -327,8 +303,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Get content part number.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getContentPartNumber(): string
|
||||
{
|
||||
@@ -337,8 +311,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Get part number.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getPartNumber(): string
|
||||
{
|
||||
@@ -347,8 +319,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Get decoded part content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function getDecodedContent(): string
|
||||
{
|
||||
@@ -382,10 +352,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Get raw message content.
|
||||
*
|
||||
* @param string $partNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final protected function doGetContent(string $partNumber): string
|
||||
{
|
||||
@@ -462,7 +428,7 @@ abstract class AbstractPart implements PartInterface
|
||||
/**
|
||||
* Move to next part.
|
||||
*
|
||||
* @return int
|
||||
* @return void
|
||||
*/
|
||||
final public function next()
|
||||
{
|
||||
@@ -472,7 +438,7 @@ abstract class AbstractPart implements PartInterface
|
||||
/**
|
||||
* Reset part key.
|
||||
*
|
||||
* @return int
|
||||
* @return void
|
||||
*/
|
||||
final public function rewind()
|
||||
{
|
||||
@@ -556,10 +522,6 @@ abstract class AbstractPart implements PartInterface
|
||||
|
||||
/**
|
||||
* Check if the given part is an attachment.
|
||||
*
|
||||
* @param \stdClass $part
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function isAttachment(\stdClass $part): bool
|
||||
{
|
||||
|
@@ -13,8 +13,6 @@ final class Attachment extends AbstractPart implements AttachmentInterface
|
||||
{
|
||||
/**
|
||||
* Get attachment filename.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getFilename(): ?string
|
||||
{
|
||||
@@ -39,8 +37,6 @@ final class Attachment extends AbstractPart implements AttachmentInterface
|
||||
|
||||
/**
|
||||
* Is this attachment also an Embedded Message?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmbeddedMessage(): bool
|
||||
{
|
||||
@@ -51,8 +47,6 @@ final class Attachment extends AbstractPart implements AttachmentInterface
|
||||
* Return embedded message.
|
||||
*
|
||||
* @throws NotEmbeddedMessageException
|
||||
*
|
||||
* @return EmbeddedMessageInterface
|
||||
*/
|
||||
public function getEmbeddedMessage(): EmbeddedMessageInterface
|
||||
{
|
||||
|
@@ -11,8 +11,6 @@ interface AttachmentInterface extends PartInterface
|
||||
{
|
||||
/**
|
||||
* Get attachment filename.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getFilename(): ?string;
|
||||
|
||||
@@ -25,15 +23,11 @@ interface AttachmentInterface extends PartInterface
|
||||
|
||||
/**
|
||||
* Is this attachment also an Embedded Message?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmbeddedMessage(): bool;
|
||||
|
||||
/**
|
||||
* Return embedded message.
|
||||
*
|
||||
* @return EmbeddedMessageInterface
|
||||
*/
|
||||
public function getEmbeddedMessage(): EmbeddedMessageInterface;
|
||||
}
|
||||
|
@@ -8,8 +8,6 @@ interface BasicMessageInterface extends PartInterface
|
||||
{
|
||||
/**
|
||||
* Get raw message headers.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawHeaders(): string;
|
||||
|
||||
@@ -22,8 +20,6 @@ interface BasicMessageInterface extends PartInterface
|
||||
|
||||
/**
|
||||
* Get message headers.
|
||||
*
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders(): Headers;
|
||||
|
||||
@@ -31,15 +27,11 @@ interface BasicMessageInterface extends PartInterface
|
||||
* Get message id.
|
||||
*
|
||||
* A unique message id in the form <...>
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getId(): ?string;
|
||||
|
||||
/**
|
||||
* Get message sender (from headers).
|
||||
*
|
||||
* @return null|EmailAddress
|
||||
*/
|
||||
public function getFrom(): ?EmailAddress;
|
||||
|
||||
@@ -87,8 +79,6 @@ interface BasicMessageInterface extends PartInterface
|
||||
|
||||
/**
|
||||
* Get date (from headers).
|
||||
*
|
||||
* @return null|\DateTimeImmutable
|
||||
*/
|
||||
public function getDate(): ?\DateTimeImmutable;
|
||||
|
||||
@@ -101,22 +91,16 @@ interface BasicMessageInterface extends PartInterface
|
||||
|
||||
/**
|
||||
* Get message subject (from headers).
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getSubject(): ?string;
|
||||
|
||||
/**
|
||||
* Get message In-Reply-To (from headers).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getInReplyTo(): array;
|
||||
|
||||
/**
|
||||
* Get message References (from headers).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getReferences(): array;
|
||||
|
||||
@@ -129,8 +113,6 @@ interface BasicMessageInterface extends PartInterface
|
||||
|
||||
/**
|
||||
* Get body text.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getBodyText(): ?string;
|
||||
|
||||
@@ -143,8 +125,6 @@ interface BasicMessageInterface extends PartInterface
|
||||
|
||||
/**
|
||||
* Does this message have attachments?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasAttachments(): bool;
|
||||
}
|
||||
|
@@ -29,11 +29,6 @@ final class EmailAddress
|
||||
*/
|
||||
private $address;
|
||||
|
||||
/**
|
||||
* @param string $mailbox
|
||||
* @param null|string $hostname
|
||||
* @param null|string $name
|
||||
*/
|
||||
public function __construct(string $mailbox, string $hostname = null, string $name = null)
|
||||
{
|
||||
$this->mailbox = $mailbox;
|
||||
@@ -55,8 +50,6 @@ final class EmailAddress
|
||||
|
||||
/**
|
||||
* Returns address with person name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullAddress(): string
|
||||
{
|
||||
@@ -68,9 +61,6 @@ final class EmailAddress
|
||||
return $address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMailbox(): string
|
||||
{
|
||||
return $this->mailbox;
|
||||
|
@@ -23,8 +23,6 @@ final class EmbeddedMessage extends AbstractMessage implements EmbeddedMessageIn
|
||||
|
||||
/**
|
||||
* Get message headers.
|
||||
*
|
||||
* @return Headers
|
||||
*/
|
||||
public function getHeaders(): Headers
|
||||
{
|
||||
@@ -37,8 +35,6 @@ final class EmbeddedMessage extends AbstractMessage implements EmbeddedMessageIn
|
||||
|
||||
/**
|
||||
* Get raw message headers.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawHeaders(): string
|
||||
{
|
||||
@@ -66,8 +62,6 @@ final class EmbeddedMessage extends AbstractMessage implements EmbeddedMessageIn
|
||||
|
||||
/**
|
||||
* Get content part number.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getContentPartNumber(): string
|
||||
{
|
||||
|
@@ -11,8 +11,6 @@ final class Headers extends Parameters
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \stdClass $headers
|
||||
*/
|
||||
public function __construct(\stdClass $headers)
|
||||
{
|
||||
@@ -29,8 +27,6 @@ final class Headers extends Parameters
|
||||
/**
|
||||
* Get header.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(string $key)
|
||||
@@ -41,8 +37,7 @@ final class Headers extends Parameters
|
||||
/**
|
||||
* Parse header.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
@@ -14,9 +14,6 @@ class Parameters extends \ArrayIterator
|
||||
'filename*' => 'filename',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param array $parameters
|
||||
*/
|
||||
public function __construct(array $parameters = [])
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -24,9 +21,6 @@ class Parameters extends \ArrayIterator
|
||||
$this->add($parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $parameters
|
||||
*/
|
||||
public function add(array $parameters = []): void
|
||||
{
|
||||
foreach ($parameters as $parameter) {
|
||||
@@ -40,8 +34,6 @@ class Parameters extends \ArrayIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(string $key)
|
||||
@@ -51,10 +43,6 @@ class Parameters extends \ArrayIterator
|
||||
|
||||
/**
|
||||
* Decode value.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final protected function decode(string $value): string
|
||||
{
|
||||
|
@@ -33,50 +33,36 @@ interface PartInterface extends \RecursiveIterator
|
||||
|
||||
/**
|
||||
* Get message number (from headers).
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNumber(): int;
|
||||
|
||||
/**
|
||||
* Part charset.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCharset(): ?string;
|
||||
|
||||
/**
|
||||
* Part type.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getType(): ?string;
|
||||
|
||||
/**
|
||||
* Part subtype.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getSubtype(): ?string;
|
||||
|
||||
/**
|
||||
* Part encoding.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getEncoding(): ?string;
|
||||
|
||||
/**
|
||||
* Part disposition.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getDisposition(): ?string;
|
||||
|
||||
/**
|
||||
* Part description.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getDescription(): ?string;
|
||||
|
||||
@@ -89,43 +75,31 @@ interface PartInterface extends \RecursiveIterator
|
||||
|
||||
/**
|
||||
* Part lines.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getLines(): ?string;
|
||||
|
||||
/**
|
||||
* Part parameters.
|
||||
*
|
||||
* @return Parameters
|
||||
*/
|
||||
public function getParameters(): Parameters;
|
||||
|
||||
/**
|
||||
* Get raw part content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContent(): string;
|
||||
|
||||
/**
|
||||
* Get decoded part content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDecodedContent(): string;
|
||||
|
||||
/**
|
||||
* Part structure.
|
||||
*
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function getStructure(): \stdClass;
|
||||
|
||||
/**
|
||||
* Get part number.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPartNumber(): string;
|
||||
|
||||
|
@@ -265,8 +265,6 @@ final class Transcoder
|
||||
*
|
||||
* @param string $text Text to decode
|
||||
* @param string $fromCharset Original charset
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function decode(string $text, string $fromCharset): string
|
||||
{
|
||||
@@ -288,7 +286,9 @@ final class Transcoder
|
||||
$fromCharset = self::$charsetAliases[$lowercaseFromCharset];
|
||||
}
|
||||
|
||||
\set_error_handler(static function () {});
|
||||
\set_error_handler(static function (): bool {
|
||||
return true;
|
||||
});
|
||||
|
||||
$iconvDecodedText = \iconv($fromCharset, 'UTF-8', $text);
|
||||
if (false === $iconvDecodedText) {
|
||||
@@ -303,9 +303,11 @@ final class Transcoder
|
||||
|
||||
$errorMessage = null;
|
||||
$errorNumber = 0;
|
||||
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber) {
|
||||
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber): bool {
|
||||
$errorMessage = $message;
|
||||
$errorNumber = $nr;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$decodedText = \mb_convert_encoding($text, 'UTF-8', $fromCharset);
|
||||
|
@@ -11,87 +11,63 @@ interface MessageInterface extends Message\BasicMessageInterface
|
||||
{
|
||||
/**
|
||||
* Get raw part content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContent(): string;
|
||||
|
||||
/**
|
||||
* Get message recent flag value (from headers).
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function isRecent(): ?string;
|
||||
|
||||
/**
|
||||
* Get message unseen flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isUnseen(): bool;
|
||||
|
||||
/**
|
||||
* Get message flagged flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFlagged(): bool;
|
||||
|
||||
/**
|
||||
* Get message answered flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAnswered(): bool;
|
||||
|
||||
/**
|
||||
* Get message deleted flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDeleted(): bool;
|
||||
|
||||
/**
|
||||
* Get message draft flag value (from headers).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDraft(): bool;
|
||||
|
||||
/**
|
||||
* Has the message been marked as read?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSeen(): bool;
|
||||
|
||||
/**
|
||||
* Mark message as seen.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated since version 1.1, to be removed in 2.0
|
||||
*/
|
||||
public function maskAsSeen(): bool;
|
||||
|
||||
/**
|
||||
* Mark message as seen.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function markAsSeen(): bool;
|
||||
|
||||
/**
|
||||
* Move message to another mailbox.
|
||||
*
|
||||
* @param MailboxInterface $mailbox
|
||||
*/
|
||||
public function copy(MailboxInterface $mailbox): void;
|
||||
|
||||
/**
|
||||
* Move message to another mailbox.
|
||||
*
|
||||
* @param MailboxInterface $mailbox
|
||||
*/
|
||||
public function move(MailboxInterface $mailbox): void;
|
||||
|
||||
@@ -109,8 +85,6 @@ interface MessageInterface extends Message\BasicMessageInterface
|
||||
* Set Flag Message.
|
||||
*
|
||||
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setFlag(string $flag): bool;
|
||||
|
||||
@@ -118,8 +92,6 @@ interface MessageInterface extends Message\BasicMessageInterface
|
||||
* Clear Flag Message.
|
||||
*
|
||||
* @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function clearFlag(string $flag): bool;
|
||||
}
|
||||
|
@@ -26,8 +26,6 @@ final class MessageIterator extends \ArrayIterator implements MessageIteratorInt
|
||||
|
||||
/**
|
||||
* Get current message.
|
||||
*
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function current(): MessageInterface
|
||||
{
|
||||
|
@@ -8,8 +8,6 @@ interface MessageIteratorInterface extends \Iterator
|
||||
{
|
||||
/**
|
||||
* Get current message.
|
||||
*
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function current(): MessageInterface;
|
||||
}
|
||||
|
@@ -38,8 +38,6 @@ abstract class AbstractDate implements ConditionInterface
|
||||
|
||||
/**
|
||||
* Converts the condition to a string that can be sent to the IMAP server.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function toString(): string
|
||||
{
|
||||
@@ -48,8 +46,6 @@ abstract class AbstractDate implements ConditionInterface
|
||||
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getKeyword(): string;
|
||||
}
|
||||
|
@@ -29,8 +29,6 @@ abstract class AbstractText implements ConditionInterface
|
||||
|
||||
/**
|
||||
* Converts the condition to a string that can be sent to the IMAP server.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public function toString(): string
|
||||
{
|
||||
@@ -39,8 +37,6 @@ abstract class AbstractText implements ConditionInterface
|
||||
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getKeyword(): string;
|
||||
}
|
||||
|
@@ -11,8 +11,6 @@ interface ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Converts the condition to a string that can be sent to the IMAP server.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string;
|
||||
}
|
||||
|
@@ -14,8 +14,6 @@ final class Before extends AbstractDate
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class On extends AbstractDate
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Since extends AbstractDate
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -15,8 +15,6 @@ final class Bcc extends AbstractText
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -15,8 +15,6 @@ final class Cc extends AbstractText
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class From extends AbstractText
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -15,8 +15,6 @@ final class To extends AbstractText
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Answered implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Flagged implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Recent implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Seen implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Unanswered implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Unflagged implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Unseen implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class All implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -38,12 +38,10 @@ final class OrConditions implements ConditionInterface
|
||||
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
$conditions = \array_map(static function (ConditionInterface $condition) {
|
||||
$conditions = \array_map(static function (ConditionInterface $condition): string {
|
||||
return $condition->toString();
|
||||
}, $this->conditions);
|
||||
|
||||
|
@@ -24,9 +24,6 @@ final class RawExpression implements ConditionInterface
|
||||
$this->expression = $expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
return $this->expression;
|
||||
|
@@ -14,8 +14,6 @@ final class Deleted implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -13,8 +13,6 @@ final class NewMessage implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -13,8 +13,6 @@ final class Old implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Undeleted implements ConditionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Body extends AbstractText
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Keyword extends AbstractText
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Subject extends AbstractText
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Text extends AbstractText
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ final class Unkeyword extends AbstractText
|
||||
{
|
||||
/**
|
||||
* Returns the keyword that the condition represents.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKeyword(): string
|
||||
{
|
||||
|
@@ -22,8 +22,6 @@ final class SearchExpression implements ConditionInterface
|
||||
* Adds a new condition to the expression.
|
||||
*
|
||||
* @param ConditionInterface $condition the condition to be added
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function addCondition(ConditionInterface $condition): self
|
||||
{
|
||||
@@ -34,12 +32,10 @@ final class SearchExpression implements ConditionInterface
|
||||
|
||||
/**
|
||||
* Converts the expression to a string that can be sent to the IMAP server.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString(): string
|
||||
{
|
||||
$conditions = \array_map(static function (ConditionInterface $condition) {
|
||||
$conditions = \array_map(static function (ConditionInterface $condition): string {
|
||||
return $condition->toString();
|
||||
}, $this->conditions);
|
||||
|
||||
|
@@ -80,16 +80,16 @@ final class Server implements ServerInterface
|
||||
* @param string $password Password
|
||||
*
|
||||
* @throws AuthenticationFailedException
|
||||
*
|
||||
* @return ConnectionInterface
|
||||
*/
|
||||
public function authenticate(string $username, string $password): ConnectionInterface
|
||||
{
|
||||
$errorMessage = null;
|
||||
$errorNumber = 0;
|
||||
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber) {
|
||||
\set_error_handler(static function ($nr, $message) use (&$errorMessage, &$errorNumber): bool {
|
||||
$errorMessage = $message;
|
||||
$errorNumber = $nr;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$resource = \imap_open(
|
||||
@@ -133,8 +133,6 @@ final class Server implements ServerInterface
|
||||
|
||||
/**
|
||||
* Glues hostname, port and flags and returns result.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getServerString(): string
|
||||
{
|
||||
|
@@ -14,8 +14,6 @@ interface ServerInterface
|
||||
*
|
||||
* @param string $username Username
|
||||
* @param string $password Password
|
||||
*
|
||||
* @return ConnectionInterface
|
||||
*/
|
||||
public function authenticate(string $username, string $password): ConnectionInterface;
|
||||
}
|
||||
|
Reference in New Issue
Block a user