OutboxTransportOperation   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 70
Duplicated Lines 12.86 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 9
loc 70
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 1
A getMessageId() 0 4 1
A getOptions() 0 4 1
A getBody() 0 4 1
A getHeaders() 0 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
2
namespace PSB\Core\Outbox;
3
4
5
use PSB\Core\Util\Guard;
6
7
class OutboxTransportOperation
8
{
9
    /**
10
     * @var string
11
     */
12
    private $messageId;
13
14
    /**
15
     * @var array
16
     */
17
    private $options;
18
19
    /**
20
     * @var string
21
     */
22
    private $body;
23
24
    /**
25
     * @var array
26
     */
27
    private $headers;
28
29
    /**
30
     * @param string $messageId
31
     * @param array  $options
32
     * @param string $body
33
     * @param array  $headers
34
     */
35 10 View Code Duplication
    public function __construct($messageId, array $options, $body, array $headers)
36
    {
37 10
        Guard::againstNullAndEmpty('messageId', $messageId);
38
39 9
        $this->messageId = $messageId;
40 9
        $this->options = $options;
41 9
        $this->body = $body;
42 9
        $this->headers = $headers;
43 9
    }
44
45
    /**
46
     * @return string
47
     */
48 3
    public function getMessageId()
49
    {
50 3
        return $this->messageId;
51
    }
52
53
    /**
54
     * @return array
55
     */
56 3
    public function getOptions()
57
    {
58 3
        return $this->options;
59
    }
60
61
    /**
62
     * @return string
63
     */
64 3
    public function getBody()
65
    {
66 3
        return $this->body;
67
    }
68
69
    /**
70
     * @return array
71
     */
72 3
    public function getHeaders()
73
    {
74 3
        return $this->headers;
75
    }
76
}
77