1 | <?php |
||
25 | class ParameterConsumer extends GenericConsumer |
||
26 | { |
||
27 | /** |
||
28 | * Returns semi-colon and equals char as token separators. |
||
29 | * |
||
30 | * @return string[] |
||
31 | */ |
||
32 | 9 | protected function getTokenSeparators() |
|
36 | |||
37 | /** |
||
38 | * Creates and returns a \ZBateson\MailMimeParser\Header\Part\Token out of |
||
39 | * the passed string token and returns it, unless the token is an escaped |
||
40 | * literal, in which case a LiteralPart is returned. |
||
41 | * |
||
42 | * @param string $token |
||
43 | * @param bool $isLiteral |
||
44 | * @return \ZBateson\MailMimeParser\Header\Part\HeaderPart |
||
45 | */ |
||
46 | 9 | protected function getPartForToken($token, $isLiteral) |
|
53 | |||
54 | /** |
||
55 | * Adds the passed parameter with the given name and value to a |
||
56 | * SplitParameterToken, at the passed index. If one with the given name |
||
57 | * doesn't exist, it is created. |
||
58 | * |
||
59 | * @param ArrayObject $splitParts |
||
60 | * @param string $name |
||
61 | * @param string $value |
||
62 | * @param int $index |
||
63 | * @param boolean $isEncoded |
||
64 | */ |
||
65 | 6 | private function addToSplitPart(ArrayObject $splitParts, $name, $value, $index, $isEncoded) |
|
75 | |||
76 | /** |
||
77 | * Instantiates and returns either a MimeLiteralPart if $strName is empty, |
||
78 | * a SplitParameterToken if the parameter is a split parameter and is the |
||
79 | * first in a series, null if it's a split parameter but is not the first |
||
80 | * part in its series, or a ParameterPart is returned otherwise. |
||
81 | * |
||
82 | * If the part is a SplitParameterToken, it's added to the passed |
||
83 | * $splitParts as well with its name as a key. |
||
84 | * |
||
85 | * @param string $strName |
||
86 | * @param string $strValue |
||
87 | * @param ArrayObject $splitParts |
||
88 | * @return MimeLiteralPart|SplitParameterToken|ParameterPart |
||
89 | */ |
||
90 | 9 | private function getPartFor($strName, $strValue, ArrayObject $splitParts) |
|
105 | |||
106 | /** |
||
107 | * Handles parameter separator tokens during final processing. |
||
108 | * |
||
109 | * If the end token is found, a new HeaderPart is assigned to the passed |
||
110 | * $combined array. If an '=' character is found, $strCat is assigned to |
||
111 | * $strName and emptied. |
||
112 | * |
||
113 | * Returns true if the token was processed, and false otherwise. |
||
114 | * |
||
115 | * @param string $tokenValue |
||
116 | * @param array $combined |
||
117 | * @param string $strName |
||
118 | * @param string $strCat |
||
119 | * @return boolean |
||
120 | */ |
||
121 | 9 | private function processTokenPart( |
|
140 | |||
141 | /** |
||
142 | * Loops over parts in the passed array, creating ParameterParts out of any |
||
143 | * parsed SplitParameterTokens, replacing them in the array. |
||
144 | * |
||
145 | * The method then calls filterIgnoreSpaces to filter out empty elements in |
||
146 | * the combined array and returns an array. |
||
147 | * |
||
148 | * @param ArrayObject $combined |
||
149 | * @return HeaderPart[]|array |
||
150 | */ |
||
151 | 9 | private function finalizeParameterParts(ArrayObject $combined) |
|
164 | |||
165 | /** |
||
166 | * Post processing involves creating Part\LiteralPart or Part\ParameterPart |
||
167 | * objects out of created Token and LiteralParts. |
||
168 | * |
||
169 | * @param HeaderPart[] $parts |
||
170 | * @return HeaderPart[]|array |
||
171 | */ |
||
172 | 9 | protected function processParts(array $parts) |
|
188 | } |
||
189 |