59 $this->_paramEncoder = $paramEncoder;
61 $this->_tokenRe =
'(?:[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+)';
72 return self::TYPE_PARAMETERIZED;
81 parent::setCharset($charset);
82 if (isset($this->_paramEncoder))
84 $this->_paramEncoder->charsetChanged($charset);
105 return array_key_exists($parameter, $params)
106 ? $params[$parameter]
117 $this->_params = $parameters;
135 $body = parent::getFieldBody();
136 foreach ($this->_params as $name => $value)
138 if (!is_null($value))
158 $tokens = parent::toTokens(parent::getFieldBody());
161 foreach ($this->_params as $name => $value)
163 if (!is_null($value))
166 $tokens[count($tokens)-1] .=
';';
192 $firstLineOffset = 0;
195 if (!preg_match(
'/^' . $this->_tokenRe .
'$/D', $value))
199 if (!preg_match(
'/^' . $this->
getGrammar(
'text') .
'*$/D', $value))
203 $maxValueLength = $this->
getMaxLineLength() - strlen($name .
'*N*="";') - 1;
204 $firstLineOffset = strlen(
211 if ($encoded || strlen($value) > $maxValueLength)
213 if (isset($this->_paramEncoder))
215 $value = $this->_paramEncoder->encodeString(
216 $origValue, $firstLineOffset, $maxValueLength
226 $valueLines = isset($this->_paramEncoder) ? explode(
"\r\n", $value) : array($value);
229 if (count($valueLines) > 1)
231 $paramLines = array();
232 foreach ($valueLines as
$i => $line)
234 $paramLines[] = $name .
'*' .
$i .
237 return implode(
";\r\n ", $paramLines);
242 $valueLines[0], $encoded,
true
257 if (!preg_match(
'/^' . $this->_tokenRe .
'$/D', $value))
259 $value =
'"' . $value .
'"';
271 return $prepend . $value;