Test Failed
Push — master ( e258e4...a626ba )
by Zaahid
15:25
created

QuotedStringMimeLiteralPartTokenSplitPatternTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 0
f 0
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getTokenSplitPattern() 0 5 1
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
 * 
14
 *
15
 * @author Zaahid Bateson
16
 */
17
trait QuotedStringMimeLiteralPartTokenSplitPatternTrait
18
{
19
    /**
20
     * Overridden to use a specialized regex for finding mime-encoded parts
21
     * (RFC 2047).
22
     *
23
     * Some implementations seem to place mime-encoded parts within quoted
24
     * parameters, and split the mime-encoded parts across multiple split
25
     * parameters.  The specialized regex doesn't allow double quotes inside a
26
     * mime encoded part, so it can be "continued" in another parameter.
27
     *
28
     * @return string the regex pattern
29
     */
30
    protected function getTokenSplitPattern() : string
31
    {
32
        $sChars = \implode('|', $this->getAllTokenSeparators());
0 ignored issues
show
Bug introduced by
It seems like getAllTokenSeparators() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
        $sChars = \implode('|', $this->/** @scrutinizer ignore-call */ getAllTokenSeparators());
Loading history...
33
        $mimePartPattern = MimeToken::MIME_PART_PATTERN_NO_QUOTES;
34
        return '~(' . $mimePartPattern . '|\\\\\r\n|\\\\.|' . $sChars . ')~ms';
35
    }
36
}
37