Passed
Push — master ( 46ed75...ca2387 )
by Zaahid
03:33
created

ReceivedDateConsumerService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 3
c 0
b 0
f 0
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
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
8
namespace ZBateson\MailMimeParser\Header\Consumer\Received;
9
10
use ZBateson\MailMimeParser\Header\Consumer\DateConsumerService;
11
12
/**
13
 * Parses the date portion of a Received header into a DatePart.
14
 *
15
 * The only difference between DateConsumerService and
16
 * ReceivedDateConsumerService is the addition of a start token, ';', and a
17
 * token separator (also ';').
18
 *
19
 * @author Zaahid Bateson
20
 */
21
class ReceivedDateConsumerService extends DateConsumerService
22
{
23
    /**
24
     * Returns true if the token is a ';'
25
     */
26 6
    protected function isStartToken(string $token) : bool
27
    {
28 6
        return ($token === ';');
29
    }
30
31
    /**
32
     * Returns an array containing ';'.
33
     *
34
     * @return string[] an array of regex pattern matchers
35
     */
36 12
    protected function getTokenSeparators() : array
37
    {
38 12
        return [';'];
39
    }
40
}
41