1
|
|
|
<?php |
2
|
|
|
namespace SamIT\React\Smtp; |
3
|
|
|
|
4
|
|
|
interface MessageInterface extends \Psr\Http\Message\MessageInterface { |
5
|
|
|
/** |
6
|
|
|
* Retrieves all message header values. |
7
|
|
|
* |
8
|
|
|
* The keys represent the header name as it will be sent over the wire, and |
9
|
|
|
* each value is a string associated with the header. |
10
|
|
|
* |
11
|
|
|
* // Represent the headers as a string |
12
|
|
|
* foreach ($message->getHeaders() as $index => [$name, $value]) { |
13
|
|
|
* echo $name . ": " . $value; |
14
|
|
|
* } |
15
|
|
|
* |
16
|
|
|
* While header names are not case-sensitive, getHeaders() must preserve the |
17
|
|
|
* exact case in which headers were originally specified. It must also preserve the order of headers, appending |
18
|
|
|
* new ones to the end. This is especially important when signing schemes like DKIM are in use. |
19
|
|
|
* |
20
|
|
|
* @return array Returns an array of the message's headers. Each |
21
|
|
|
* key a header index, and each value MUST be an array of name, value pairs for that header. |
22
|
|
|
*/ |
23
|
|
|
public function getHeaders(); |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* This function will throw an exception since replacing headers is will mangle SMTP messages. |
27
|
|
|
* @throws \Exception |
28
|
|
|
*/ |
29
|
|
|
public function withHeader($name, $value); |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* This function will throw an exception since removing headers is will mangle SMTP messages. |
33
|
|
|
* @throws \Exception |
34
|
|
|
*/ |
35
|
|
|
public function withoutHeader($name); |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* This function will throw an exception since removing headers is will mangle SMTP messages. |
39
|
|
|
* @throws \Exception |
40
|
|
|
*/ |
41
|
|
|
public function getHeaderLine($name); |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @inheritdoc |
45
|
|
|
*/ |
46
|
|
|
public function withAddedHeader($name, $value); |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Retrieves a message header value by the given case-insensitive name. |
50
|
|
|
* |
51
|
|
|
* This method returns an array of all the header values of the given |
52
|
|
|
* case-insensitive header name. |
53
|
|
|
* |
54
|
|
|
* If the header does not appear in the message, this method MUST return an |
55
|
|
|
* empty array. |
56
|
|
|
* |
57
|
|
|
* @param string $name Case-insensitive header field name. |
58
|
|
|
* @return string[] An array of string values as provided for the given |
59
|
|
|
* header. If the header does not appear in the message, this method MUST |
60
|
|
|
* return an empty array. The keys are the names of the header. |
61
|
|
|
*/ |
62
|
|
|
public function getHeader($name); |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Return an instance with the provided value replacing the original recipient(s). |
66
|
|
|
* |
67
|
|
|
* This method MUST be implemented in such a way as to retain the |
68
|
|
|
* immutability of the message, and MUST return an instance that has the |
69
|
|
|
* new and/or updated header and value. |
70
|
|
|
* |
71
|
|
|
* @return self |
72
|
|
|
* @param string $email |
73
|
|
|
* @param string $name |
74
|
|
|
* @throws \InvalidArgumentException for invalid email. |
75
|
|
|
*/ |
76
|
|
|
public function withRecipient($email, $name = null); |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Return an instance with the provided values replacing the original recipient(s). |
80
|
|
|
* |
81
|
|
|
* This method MUST be implemented in such a way as to retain the |
82
|
|
|
* immutability of the message, and MUST return an instance that has the |
83
|
|
|
* new and/or updated header and value. |
84
|
|
|
* |
85
|
|
|
* @return self |
86
|
|
|
* @param array $recipients Array of email => name pairs. |
87
|
|
|
* @throws \InvalidArgumentException for invalid email. |
88
|
|
|
*/ |
89
|
|
|
public function withRecipients(array $recipients); |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Return an instance with the provided recipients added to the original recipient(s). |
93
|
|
|
* |
94
|
|
|
* This method MUST be implemented in such a way as to retain the |
95
|
|
|
* immutability of the message, and MUST return an instance that has the |
96
|
|
|
* new and/or updated header and value. |
97
|
|
|
* |
98
|
|
|
* @return self |
99
|
|
|
* @param array $recipients Array of email => name pairs. |
|
|
|
|
100
|
|
|
* @throws \InvalidArgumentException for invalid email. |
101
|
|
|
*/ |
102
|
|
|
public function withAddedRecipient($email, $name = null); |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Return an instance with the provided recipients added to the original recipient(s). |
106
|
|
|
* |
107
|
|
|
* This method MUST be implemented in such a way as to retain the |
108
|
|
|
* immutability of the message, and MUST return an instance that has the |
109
|
|
|
* new and/or updated header and value. |
110
|
|
|
* |
111
|
|
|
* @return self |
112
|
|
|
* @param array $recipients Array of email => name pairs. |
113
|
|
|
* @throws \InvalidArgumentException for invalid email. |
114
|
|
|
*/ |
115
|
|
|
public function withAddedRecipients(array $recipients); |
116
|
|
|
} |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.