-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from DirectoryTree/message-interface
Unify common message methods in `MessageInterface`
- Loading branch information
Showing
3 changed files
with
123 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?php | ||
|
||
namespace DirectoryTree\ImapEngine; | ||
|
||
use Carbon\Carbon; | ||
use Stringable; | ||
use ZBateson\MailMimeParser\Header\IHeader; | ||
use ZBateson\MailMimeParser\Message as MailMimeMessage; | ||
|
||
interface MessageInterface extends Stringable | ||
{ | ||
/** | ||
* Get the message date and time. | ||
*/ | ||
public function date(): ?Carbon; | ||
|
||
/** | ||
* Get the message's subject. | ||
*/ | ||
public function subject(): ?string; | ||
|
||
/** | ||
* Get the 'From' address. | ||
*/ | ||
public function from(): ?Address; | ||
|
||
/** | ||
* Get the 'Sender' address. | ||
*/ | ||
public function sender(): ?Address; | ||
|
||
/** | ||
* Get the message's 'Message-ID'. | ||
*/ | ||
public function messageId(): ?string; | ||
|
||
/** | ||
* Get the 'Reply-To' address. | ||
*/ | ||
public function replyTo(): ?Address; | ||
|
||
/** | ||
* Get the 'In-Reply-To' address. | ||
*/ | ||
public function inReplyTo(): ?Address; | ||
|
||
/** | ||
* Get the 'To' addresses. | ||
* | ||
* @return Address[] | ||
*/ | ||
public function to(): array; | ||
|
||
/** | ||
* Get the 'CC' addresses. | ||
* | ||
* @return Address[] | ||
*/ | ||
public function cc(): array; | ||
|
||
/** | ||
* Get the 'BCC' addresses. | ||
* | ||
* @return Address[] | ||
*/ | ||
public function bcc(): array; | ||
|
||
/** | ||
* Get the message's attachments. | ||
* | ||
* @return Attachment[] | ||
*/ | ||
public function attachments(): array; | ||
|
||
/** | ||
* Determine if the message has attachments. | ||
*/ | ||
public function hasAttachments(): bool; | ||
|
||
/** | ||
* Get the count of attachments. | ||
*/ | ||
public function attachmentCount(): int; | ||
|
||
/** | ||
* Get addresses from the given header. | ||
* | ||
* @return Address[] | ||
*/ | ||
public function addresses(string $header): array; | ||
|
||
/** | ||
* Get the message's HTML content. | ||
*/ | ||
public function html(): ?string; | ||
|
||
/** | ||
* Get the message's text content. | ||
*/ | ||
public function text(): ?string; | ||
|
||
/** | ||
* Get all headers from the message. | ||
*/ | ||
public function headers(): array; | ||
|
||
/** | ||
* Get a header from the message. | ||
*/ | ||
public function header(string $name, int $offset = 0): ?IHeader; | ||
|
||
/** | ||
* Parse the message into a MailMimeMessage instance. | ||
*/ | ||
public function parse(): MailMimeMessage; | ||
|
||
/** | ||
* Get the string representation of the message. | ||
*/ | ||
public function __toString(): string; | ||
} |