Message   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 61
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 61
loc 61
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getContentType() 4 4 1
A getBody() 4 4 1
A getParameters() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php declare(strict_types = 1);
2
3
namespace JDR\Mailer\Part;
4
5 View Code Duplication
class Message implements EmailPart
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
    /**
8
     * @var string
9
     */
10
    private $contentType;
11
12
    /**
13
     * @var string
14
     */
15
    private $body;
16
17
    /**
18
     * @var string[]
19
     */
20
    private $parameters;
21
22
    /**
23
     * Constructor.
24
     *
25
     * @param string $contentType
26
     * @param string $body
27
     * @param string[] $parameters
28
     */
29 11
    public function __construct(string $contentType, string $body, array $parameters = [])
30
    {
31 11
        $this->contentType = $contentType;
32 11
        $this->body = $body;
33 11
        $this->parameters = $parameters;
34 11
    }
35
36
    /**
37
     * Get content type of the message.
38
     *
39
     * @return string
40
     */
41 5
    public function getContentType(): string
42
    {
43 5
        return $this->contentType;
44
    }
45
46
    /**
47
     * Get body of the message.
48
     *
49
     * @return string
50
     */
51 5
    public function getBody(): string
52
    {
53 5
        return $this->body;
54
    }
55
56
    /**
57
     * Get parameters of the message.
58
     *
59
     * @return string[]
60
     */
61 7
    public function getParameters(): array
62
    {
63 7
        return $this->parameters;
64
    }
65
}
66