zbateson /
mail-mime-parser
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * This file is part of the ZBateson\MailMimeParser project. |
||
| 4 | * |
||
| 5 | * @license http://opensource.org/licenses/bsd-license.php BSD |
||
| 6 | */ |
||
| 7 | |||
| 8 | namespace ZBateson\MailMimeParser\Header\Consumer; |
||
| 9 | |||
| 10 | use ZBateson\MailMimeParser\Header\Part\MimeToken; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Provides a getTokenSplitPattern for consumers that could have quoted parts |
||
| 14 | * that are mime-header-encoded. |
||
| 15 | * |
||
| 16 | * @author Zaahid Bateson |
||
| 17 | */ |
||
| 18 | trait QuotedStringMimeLiteralPartTokenSplitPatternTrait |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * Overridden to use a specialized regex for finding mime-encoded parts |
||
| 22 | * (RFC 2047). |
||
| 23 | * |
||
| 24 | * Some implementations seem to place mime-encoded parts within quoted |
||
| 25 | * parameters, and split the mime-encoded parts across multiple split |
||
| 26 | * parameters. The specialized regex doesn't allow double quotes inside a |
||
| 27 | * mime encoded part, so it can be "continued" in another parameter. |
||
| 28 | * |
||
| 29 | * @return string the regex pattern |
||
| 30 | */ |
||
| 31 | 20 | protected function getTokenSplitPattern() : string |
|
| 32 | { |
||
| 33 | 20 | $sChars = \implode('|', $this->getAllTokenSeparators()); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 34 | 20 | $mimePartPattern = MimeToken::MIME_PART_PATTERN_NO_QUOTES; |
|
| 35 | 20 | return '~(' . $mimePartPattern . '|\\\\\r\n|\\\\.|' . $sChars . ')~ms'; |
|
| 36 | } |
||
| 37 | } |
||
| 38 |