Completed
Pull Request — master (#433)
by Paul
11:06 queued 04:27
created

ArticleTranslation   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 106
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
c 1
b 0
f 1
lcom 0
cbo 1
dl 106
loc 106
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 4 4 1
A setName() 6 6 1
A setSlug() 6 6 1
A getSlug() 4 4 1
A getDescription() 4 4 1
A setDescription() 6 6 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 Victoire\Bundle\BlogBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
use JMS\Serializer\Annotation as Serializer;
8
use Victoire\Bundle\CoreBundle\Annotations as VIC;
9
use Symfony\Component\Validator\Constraints as Assert;
10
use Knp\DoctrineBehaviors\Model\Translatable\Translation;
11
12
/**
13
 * Victoire ViewTranslation
14
 *
15
 * @ORM\Entity()
16
 * @ORM\Table(name="vic_article_translations")
17
 */
18 View Code Duplication
class ArticleTranslation
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...
19
{
20
    use Translation;
21
22
    /**
23
     * @var string
24
     *
25
     * @Assert\NotBlank()
26
     * @ORM\Column(name="name", type="string", length=255)
27
     * @Serializer\Groups({"search"})
28
     * @VIC\BusinessProperty({"textable", "businessParameter", "seoable"})
29
     */
30
    protected $name;
31
32
    /**
33
     * @var string
34
     *
35
     * @Gedmo\Slug(handlers={
36
     *     @Gedmo\SlugHandler(class="Victoire\Bundle\BusinessEntityBundle\Handler\TwigSlugHandler"
37
     * )},fields={"name"}, updatable=false, unique=false)
38
     * @ORM\Column(name="slug", type="string", length=255)
39
     * @VIC\BusinessProperty("businessParameter")
40
     */
41
    protected $slug;
42
43
    /**
44
     * @var string
45
     *
46
     * @ORM\Column(name="description", type="text", nullable=true)
47
     * @VIC\BusinessProperty({"textable", "seoable"})
48
     */
49
    private $description;
50
51
    /**
52
     * Get name.
53
     *
54
     * @return string
55
     */
56
    public function getName()
57
    {
58
        return $this->name;
59
    }
60
61
    /**
62
     * Set name.
63
     *
64
     * @param string $name
65
     *
66
     * @return View
67
     */
68
    public function setName($name)
69
    {
70
        $this->name = $name;
71
72
        return $this;
73
    }
74
75
    /**
76
     * Set slug.
77
     *
78
     * @param string $slug
79
     *
80
     * @return View
81
     */
82
    public function setSlug($slug)
83
    {
84
        $this->slug = $slug;
85
86
        return $this;
87
    }
88
89
    /**
90
     * Get slug.
91
     *
92
     * @return string
93
     */
94
    public function getSlug()
95
    {
96
        return $this->slug;
97
    }
98
99
    /**
100
     * Get description.
101
     *
102
     * @return string
103
     */
104
    public function getDescription()
105
    {
106
        return $this->description;
107
    }
108
109
    /**
110
     * Set category.
111
     *
112
     * @param string $category
0 ignored issues
show
Bug introduced by
There is no parameter named $category. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
113
     *
114
     * @return Article
115
     */
116
    public function setDescription($description)
117
    {
118
        $this->description = $description;
119
120
        return $this;
121
    }
122
123
}
124