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

IdHeader::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
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;
8
9
use ZBateson\MailMimeParser\Header\Consumer\ConsumerService;
10
11
/**
12
 * Represents a Content-ID, Message-ID, In-Reply-To or References header.
13
 *
14
 * For a multi-id header like In-Reply-To or References, all IDs can be
15
 * retrieved by calling ``` getIds() ```.  Otherwise, to retrieve the first (or
16
 * only) ID call ``` getValue() ```.
17
 * 
18
 * @author Zaahid Bateson
19
 */
20
class IdHeader extends GenericHeader
21
{
22
    /**
23
     * Returns an IdBaseConsumer.
24
     *
25
     * @param ConsumerService $consumerService
26
     * @return \ZBateson\MailMimeParser\Header\Consumer\AbstractConsumer
27
     */
28 6
    protected function getConsumer(ConsumerService $consumerService)
29
    {
30 6
        return $consumerService->getIdBaseConsumer();
31
    }
32
33
    /**
34
     * Synonym for getValue().
35
     *
36
     * @return string|null
37
     */
38
    public function getId()
39
    {
40
        return $this->getValue();
41
    }
42
43
    /**
44
     * Returns all IDs parsed for a multi-id header like References or
45
     * In-Reply-To.
46
     * 
47
     * @return string[]
48
     */
49 4
    public function getIds()
50
    {
51 4
        return $this->parts;
52
    }
53
}
54