Passed
Push — master ( 74d1f8...8d5e60 )
by Zaahid
03:07
created

IdConsumer::processParts()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 10
c 0
b 0
f 0
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
namespace ZBateson\MailMimeParser\Header\Consumer;
8
9
/**
10
 * Parses a single ID from an ID header.  Begins consuming on a '<' char, and
11
 * ends on a '>' char.
12
 *
13
 * @author Zaahid Bateson
14
 */
15
class IdConsumer extends GenericConsumer
16
{
17
    /**
18
     * Overridden to return patterns matching the beginning part of an ID ('<'
19
     * and '>' chars).
20
     * 
21
     * @return string[] the patterns
22
     */
23 3
    public function getTokenSeparators()
24
    {
25 3
        return ['\s+', '<', '>'];
26
    }
27
    
28
    /**
29
     * Returns true for '>'.
30
     */
31 3
    protected function isEndToken($token)
32
    {
33 3
        return ($token === '>');
34
    }
35
    
36
    /**
37
     * Returns true for '<'.
38
     * 
39
     * @param string $token
40
     * @return boolean false
41
     */
42
    protected function isStartToken($token)
43
    {
44
        return ($token === '<');
45
    }
46
}
47