Completed
Push — master ( d150b0...618877 )
by Artem
02:21
created

UserA   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 152
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 6 6 1
A getPhotoName() 4 4 1
A setPhotoName() 6 6 1
A getPhotoFile() 4 4 1
A setPhotoFile() 6 6 1
A getCoverName() 4 4 1
A setCoverName() 6 6 1
A getCoverFile() 4 4 1
A setCoverFile() 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
 * This file is part of the FreshVichUploaderSerializationBundle
4
 *
5
 * (c) Artem Genvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Fresh\VichUploaderSerializationBundle\Tests\Fixtures;
12
13
use Doctrine\ORM\Mapping as ORM;
14
use Fresh\VichUploaderSerializationBundle\Annotation as Fresh;
15
use JMS\Serializer\Annotation as JMS;
16
use Symfony\Component\HttpFoundation\File\File;
17
use Vich\UploaderBundle\Mapping\Annotation as Vich;
18
19
/**
20
 * UserA Entity
21
 *
22
 * @ORM\Table(name="users")
23
 * @ORM\Entity()
24
 *
25
 * @JMS\ExclusionPolicy("all")
26
 *
27
 * @Vich\Uploadable
28
 * @Fresh\VichSerializableClass
29
 */
30 View Code Duplication
class UserA
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...
31
{
32
    /**
33
     * @var string $photoName Photo name
34
     *
35
     * @ORM\Column(type="string", length=255)
36
     *
37
     * @JMS\Expose
38
     * @JMS\SerializedName("photo")
39
     *
40
     * @Fresh\VichSerializableField("photoFile")
41
     */
42
    private $photoName;
43
44
    /**
45
     * @var File $photoFile Photo file
46
     *
47
     * @JMS\Exclude
48
     *
49
     * @Vich\UploadableField(mapping="user_photo_mapping", fileNameProperty="photoName")
50
     */
51
    private $photoFile;
52
53
    /**
54
     * @var string $coverName Cover name
55
     *
56
     * @ORM\Column(type="string", length=255)
57
     *
58
     * @JMS\Expose
59
     * @JMS\SerializedName("cover")
60
     *
61
     * @Fresh\VichSerializableField("coverFile")
62
     */
63
    private $coverName;
64
65
    /**
66
     * @var File $coverFile Cover file
67
     *
68
     * @JMS\Exclude
69
     *
70
     * @Vich\UploadableField(mapping="user_cover_mapping", fileNameProperty="coverName")
71
     */
72
    private $coverFile;
73
74
    /**
75
     * To string
76
     *
77
     * @return string
78
     */
79
    public function __toString()
80
    {
81
        $result = 'New User';
82
83
        return $result;
84
    }
85
86
    /**
87
     * Get photo name
88
     *
89
     * @return string Photo name
90
     */
91
    public function getPhotoName()
92
    {
93
        return $this->photoName;
94
    }
95
96
    /**
97
     * Set photo name
98
     *
99
     * @param string $photoName Photo name
100
     *
101
     * @return $this
102
     */
103
    public function setPhotoName($photoName)
104
    {
105
        $this->photoName = $photoName;
106
107
        return $this;
108
    }
109
110
    /**
111
     * Get photo file
112
     *
113
     * @return File Photo file
114
     */
115
    public function getPhotoFile()
116
    {
117
        return $this->photoFile;
118
    }
119
120
    /**
121
     * Set photo file
122
     *
123
     * @param File $photoFile Photo file
124
     *
125
     * @return $this
126
     */
127
    public function setPhotoFile(File $photoFile)
128
    {
129
        $this->photoFile = $photoFile;
130
131
        return $this;
132
    }
133
134
    /**
135
     * Get cover name
136
     *
137
     * @return string Cover name
138
     */
139
    public function getCoverName()
140
    {
141
        return $this->coverName;
142
    }
143
144
    /**
145
     * Set cover name
146
     *
147
     * @param string $coverName Cover name
148
     *
149
     * @return $this
150
     */
151
    public function setCoverName($coverName)
152
    {
153
        $this->coverName = $coverName;
154
155
        return $this;
156
    }
157
158
    /**
159
     * Get cover file
160
     *
161
     * @return File Cover file
162
     */
163
    public function getCoverFile()
164
    {
165
        return $this->coverFile;
166
    }
167
168
    /**
169
     * Set cover file
170
     *
171
     * @param File $coverFile Cover file
172
     *
173
     * @return $this
174
     */
175
    public function setCoverFile(File $coverFile)
176
    {
177
        $this->coverFile = $coverFile;
178
179
        return $this;
180
    }
181
}
182