Completed
Pull Request — master (#15)
by Nick
07:21 queued 02:21
created

Decision   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 76
Duplicated Lines 13.16 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 8
c 0
b 0
f 0
lcom 1
cbo 2
dl 10
loc 76
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getSlotId() 0 4 1
A getSlotName() 0 4 1
A getContentList() 10 10 2
A getPolicy() 0 4 1
A getRuleId() 0 4 1
A getRuleName() 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
3
namespace Acquia\LiftClient\Entity;
4
5
class Decision extends Entity
6
{
7
    /**
8
     * @param array $array
9
     */
10
    public function __construct(array $array = [])
11
    {
12
        parent::__construct($array);
13
    }
14
15
    /**
16
     * Gets the 'slot_id' parameter.
17
     *
18
     * @return string
19
     */
20
    public function getSlotId()
21
    {
22
        return $this->getEntityValue('slot_id', '');
23
    }
24
25
    /**
26
     * Gets the 'slot_name' parameter.
27
     *
28
     * @return string
29
     */
30
    public function getSlotName()
31
    {
32
        return $this->getEntityValue('slot_name', '');
33
    }
34
35
    /**
36
     * Gets the 'content' parameter.
37
     *
38
     * @return string
39
     */
40 View Code Duplication
    public function getContentList()
41
    {
42
        $contentList = $this->getEntityValue('content', '');
43
        $ret = [];
44
        foreach ($contentList as $content) {
45
            $ret[] = new Content($content);
46
        }
47
48
        return $ret;
49
    }
50
51
    /**
52
     * Gets the 'policy' parameter.
53
     *
54
     * @return string
55
     */
56
    public function getPolicy()
57
    {
58
        return $this->getEntityValue('policy', '');
59
    }
60
61
    /**
62
     * Gets the 'rule_id' parameter.
63
     *
64
     * @return string
65
     */
66
    public function getRuleId()
67
    {
68
        return $this->getEntityValue('rule_id', '');
69
    }
70
71
    /**
72
     * Gets the 'rule_id' parameter.
73
     *
74
     * @return string
75
     */
76
    public function getRuleName()
77
    {
78
        return $this->getEntityValue('rule_name', '');
79
    }
80
}
81