Item   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 107
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 0
cbo 0
dl 107
loc 107
ccs 17
cts 17
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 8 8 1
A getName() 4 4 1
A getData() 4 4 1
A getSource() 4 4 1
A getImage() 4 4 1
A getDescription() 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
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
8
 */
9
10
namespace AnimeDb\Bundle\CatalogBundle\Plugin\Fill\Refiller;
11
12
/**
13
 * Element search results.
14
 *
15
 * @author  Peter Gribanov <[email protected]>
16
 */
17 View Code Duplication
class Item
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...
18
{
19
    /**
20
     * Name.
21
     *
22
     * @var string
23
     */
24
    protected $name = '';
25
26
    /**
27
     * Data for refill item.
28
     *
29
     * @var array
30
     */
31
    protected $data = [];
32
33
    /**
34
     * Source.
35
     *
36
     * Can set the source to source item to avoid the next search for this item
37
     *
38
     * @var string
39
     */
40
    protected $source = '';
41
42
    /**
43
     * Image.
44
     *
45
     * @var string
46
     */
47
    protected $image = '';
48
49
    /**
50
     * Description.
51
     *
52
     * @var string
53
     */
54
    protected $description = '';
55
56
    /**
57
     * Construct.
58
     *
59
     * @param string $name
60
     * @param array $data
61
     * @param string $source
62
     * @param string|null $image
63
     * @param string|null $description
64
     */
65 1
    public function __construct($name, array $data, $source, $image = '', $description = '')
66
    {
67 1
        $this->name = $name;
68 1
        $this->data = $data;
69 1
        $this->source = $source;
70 1
        $this->image = $image;
71 1
        $this->description = $description;
72 1
    }
73
74
    /**
75
     * Get name.
76
     *
77
     * @return string
78
     */
79 1
    public function getName()
80
    {
81 1
        return $this->name;
82
    }
83
84
    /**
85
     * Get data for refill item.
86
     *
87
     * @return array
88
     */
89 1
    public function getData()
90
    {
91 1
        return $this->data;
92
    }
93
94
    /**
95
     * Get source.
96
     *
97
     * @return string
98
     */
99 1
    public function getSource()
100
    {
101 1
        return $this->source;
102
    }
103
104
    /**
105
     * Get image.
106
     *
107
     * @return string
108
     */
109 1
    public function getImage()
110
    {
111 1
        return $this->image;
112
    }
113
114
    /**
115
     * Get description.
116
     *
117
     * @return string
118
     */
119 1
    public function getDescription()
120
    {
121 1
        return $this->description;
122
    }
123
}
124