1 | <?php |
||
34 | class AddressConsumer extends AbstractConsumer |
||
35 | { |
||
36 | /** |
||
37 | * Returns the following as sub-consumers: |
||
38 | * - \ZBateson\MailMimeParser\Header\Consumer\AddressGroupConsumer |
||
39 | * - \ZBateson\MailMimeParser\Header\Consumer\CommentConsumer |
||
40 | * - \ZBateson\MailMimeParser\Header\Consumer\QuotedStringConsumer |
||
41 | * |
||
42 | * @return AbstractConsumer[] the sub-consumers |
||
43 | */ |
||
44 | protected function getSubConsumers() |
||
52 | |||
53 | /** |
||
54 | * Overridden to return patterns matching the beginning part of an address |
||
55 | * in a name/address part ("<" and ">" chars), end tokens ("," and ";"), and |
||
56 | * whitespace. |
||
57 | * |
||
58 | * @return string[] the patterns |
||
59 | */ |
||
60 | public function getTokenSeparators() |
||
64 | |||
65 | /** |
||
66 | * Returns true for commas and semi-colons. |
||
67 | * |
||
68 | * Although the semi-colon is not strictly the end token of an |
||
69 | * AddressConsumer, it could end a parent AddressGroupConsumer. I can't |
||
70 | * think of a valid scenario where this would be an issue, but additional |
||
71 | * thought may be needed (and documented here). |
||
72 | * |
||
73 | * @param string $token |
||
74 | * @return boolean false |
||
75 | */ |
||
76 | protected function isEndToken($token) |
||
80 | |||
81 | /** |
||
82 | * AddressConsumer is "greedy", so this always returns true. |
||
83 | * |
||
84 | * @param string $token |
||
85 | * @return boolean false |
||
86 | */ |
||
87 | protected function isStartToken($token) |
||
91 | |||
92 | /** |
||
93 | * Checks if the passed part represents the beginning or end of an address |
||
94 | * part (less than/greater than characters) and either appends the value of |
||
95 | * the part to the passed $strValue, or sets up $strName |
||
96 | * |
||
97 | * @param HeaderPart $part |
||
98 | * @param string $strName |
||
99 | * @param string $strValue |
||
100 | */ |
||
101 | private function processSinglePart(HeaderPart $part, &$strName, &$strValue) |
||
115 | |||
116 | /** |
||
117 | * Performs final processing on parsed parts. |
||
118 | * |
||
119 | * AddressConsumer's implementation looks for tokens representing the |
||
120 | * beginning of an address part, to create a Part\AddressPart out of a |
||
121 | * name/address pair, or assign the name part to a parsed Part\AddressGroupPart |
||
122 | * returned from its AddressGroupConsumer sub-consumer. |
||
123 | * |
||
124 | * The returned array consists of a single element - either a |
||
125 | * Part\AddressPart or a Part\AddressGroupPart. |
||
126 | * |
||
127 | * @param \ZBateson\MailMimeParser\Header\Part\HeaderPart[] $parts |
||
128 | * @return \ZBateson\MailMimeParser\Header\Part\HeaderPart[]|array |
||
129 | */ |
||
130 | protected function processParts(array $parts) |
||
147 | } |
||
148 |