Example #1
0
 /**
  * Get formatted headers.
  *
  * @param   array  $headers    Headers.
  * @return  string
  */
 public static function formatHeaders(array $headers)
 {
     $out = null;
     foreach ($headers as $header => $value) {
         $value = preg_replace_callback('#(?<value>[^<]+)(?<tail><[^>]+>)#', function (array $matches) {
             return Encoder\QuotedPrintable::encode($matches['value'], true) . $matches['tail'];
         }, $value);
         $out .= $header . ': ' . $value . CRLF;
     }
     return $out;
 }
Example #2
0
 public function case_encode_rfc2047_sections_4_and_5()
 {
     $this->given($decoded = '😄!', $encoded = '=?utf-8?Q?=F0=9F=98=84!?=')->when($result = SUT::encode($decoded, true))->then->string($result)->isEqualTo($encoded);
 }