public function getFieldValue($format = HeaderInterface::FORMAT_RAW) { if (HeaderInterface::FORMAT_ENCODED === $format) { return HeaderWrap::wrap($this->subject, $this); } return $this->subject; }
/** * Get the header value * * @return string */ public function getFieldValue() { $encoding = $this->getEncoding(); if ($encoding == 'ASCII') { return HeaderWrap::wrap($this->subject, $this); } return HeaderWrap::mimeEncodeValue($this->subject, $encoding, true); }
/** * @group ZF2-258 */ public function testWrapUnstructuredHeaderMime() { $string = str_repeat('foobarblahblahblah baz bat', 3); $header = $this->getMock('Zend\\Mail\\Header\\UnstructuredInterface'); $header->expects($this->any())->method('getEncoding')->will($this->returnValue('UTF-8')); $expected = "=?UTF-8?Q?foobarblahblahblah=20baz=20batfoobarblahblahblah=20baz=20?=\r\n" . " =?UTF-8?Q?batfoobarblahblahblah=20baz=20bat?="; $test = HeaderWrap::wrap($string, $header); $this->assertEquals($expected, $test); $this->assertEquals($string, iconv_mime_decode($test, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8')); }
public function getFieldValue($format = HeaderInterface::FORMAT_RAW) { $prepared = $this->type; if (empty($this->parameters)) { return $prepared; } $values = [$prepared]; foreach ($this->parameters as $attribute => $value) { if (HeaderInterface::FORMAT_ENCODED === $format && !Mime::isPrintable($value)) { $this->encoding = 'UTF-8'; $value = HeaderWrap::wrap($value, $this); $this->encoding = 'ASCII'; } $values[] = sprintf('%s="%s"', $attribute, $value); } return implode(';' . Headers::FOLDING, $values); }