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

GenericHeader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 3
eloc 5
c 0
b 0
f 0
dl 0
loc 16
ccs 5
cts 6
cp 0.8333
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getValue() 0 6 2
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;
9
10
use ZBateson\MailMimeParser\Header\Consumer\GenericConsumerMimeLiteralPartService;
11
12
/**
13
 * Reads a generic header.
14
 *
15
 * Header's may contain mime-encoded parts, quoted parts, and comments.  The
16
 * string value is the combined value of all its parts.
17
 *
18
 * @author Zaahid Bateson
19
 */
20
class GenericHeader extends AbstractHeader
21
{
22 102
    public function __construct(
23
        GenericConsumerMimeLiteralPartService $consumerService,
24
        string $name,
25
        string $value
26
    ) {
27 102
        parent::__construct($consumerService, $name, $value);
28
    }
29
30 99
    public function getValue() : ?string
31
    {
32 99
        if (!empty($this->parts)) {
33 99
            return \implode('', \array_map(function($p) { return $p->getValue(); }, $this->parts));
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Coding Style introduced by
Opening brace must be the last content on the line
Loading history...
Coding Style introduced by
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
34
        }
35
        return null;
36
    }
37
}
38