Passed
Push — master ( a0eabd...66d82e )
by Zaahid
03:20
created

MultipleIdHeader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 25
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIds() 0 11 3
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
/**
10
 * Represents an In-Reply-To or Reference header, which contain lists of
11
 * MessageIDs, and provides a getIds function that returns an array of the IDs
12
 * in the header.
13
 * 
14
 * @author Zaahid Bateson
15
 */
16
class MultipleIdHeader extends GenericHeader
17
{
18
    /**
19
     * Strips out leading and trailing less than and greater than ('<', '>')
20
     * chars to return just the ID portions of the header.
21
     *
22
     * An empty array may be returned if the header's value is empty.
23
     *
24
     * For example, a header value of '<[email protected]>
25
     * <[email protected]>' would return the
26
     * array [ '[email protected]', '[email protected]' ].
27
     * 
28
     * @return string[]
29
     */
30 3
    public function getIds()
31
    {
32 3
        $value = $this->getValue();
33 3
        if ($value === null) {
0 ignored issues
show
introduced by
The condition $value === null is always false.
Loading history...
34 1
            return [];
35
        }
36 2
        $ret = preg_split('/>\s*</', preg_replace('/^<|>$/', '', $value));
37 2
        if ($ret === false) {
38
            return [];
39
        }
40 2
        return $ret;
41
    }
42
}
43