Passed
Branch php8-testing (0e47ea)
by Zaahid
03:09
created

IdConsumer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 30
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isEndToken() 0 3 1
A getTokenSeparators() 0 3 1
A isStartToken() 0 3 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
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 13
    public function getTokenSeparators()
24
    {
25 13
        return ['\s+', '<', '>'];
26
    }
27
    
28
    /**
29
     * Returns true for '>'.
30
     */
31 13
    protected function isEndToken($token)
32
    {
33 13
        return ($token === '>');
34
    }
35
    
36
    /**
37
     * Returns true for '<'.
38
     * 
39
     * @param string $token
40
     * @return boolean false
41
     */
42 10
    protected function isStartToken($token)
43
    {
44 10
        return ($token === '<');
45
    }
46
}
47