Completed
Pull Request — master (#47)
by Julien
03:47
created

Section   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 76
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setId() 4 4 1
A getId() 4 4 1
A getIri() 4 4 1
A setIri() 6 6 1
A setTitle() 4 4 1
A getTitle() 4 4 1
A addArticle() 4 4 1
A getArticleList() 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
namespace Mapado\RestClientSdk\Tests\Model\Issue46;
4
5
use Mapado\RestClientSdk\Mapping\Annotations as Rest;
6
7
/**
8
 * @Rest\Entity(key="sections")
9
 */
10 View Code Duplication
class Section
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...
11
{
12
    /**
13
     * @Rest\Id
14
     * @Rest\Attribute(name="@id", type="string")
15
     */
16
    private $iri;
17
18
    /**
19
     * @Rest\Attribute(name="id", type="string")
20
     */
21
    private $id;
22
23
    /**
24
     * @Rest\Attribute(name="title", type="string")
25
     */
26
    private $title;
27
28
    /**
29
     * @Rest\OneToMany(name="articleList", targetEntity="Article")
30
     */
31
    private $articleList = [];
32
33
    public function setId($id)
34
    {
35
        $this->id = $id;
36
    }
37
38
    public function getId()
39
    {
40
        return $this->id;
41
    }
42
43
    /**
44
     * Getter for iri
45
     *
46
     * @return string
47
     */
48
    public function getIri()
49
    {
50
        return $this->iri;
51
    }
52
53
    /**
54
     * Setter for iri
55
     *
56
     * @param string $iri
57
     * @return Section
58
     */
59
    public function setIri($iri)
60
    {
61
        $this->iri = $iri;
62
63
        return $this;
64
    }
65
66
    public function setTitle($title)
67
    {
68
        $this->title = $title;
69
    }
70
71
    public function getTitle()
72
    {
73
        return $this->title;
74
    }
75
76
    public function addArticle(Article $article)
77
    {
78
        $this->articleList[] = $article;
79
    }
80
81
    public function getArticleList()
82
    {
83
        return $this->articleList;
84
    }
85
}
86