Profile   B
last analyzed

Complexity

Total Complexity 46

Size/Duplication

Total Lines 278
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Importance

Changes 0
Metric Value
wmc 46
cbo 0
dl 0
loc 278
rs 8.72
c 0
b 0
f 0

46 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 4 1
A getName() 0 4 1
A setName() 0 4 1
A getPresetName() 0 4 1
A setPresetName() 0 4 1
A getExtname() 0 4 1
A setExtname() 0 4 1
A getWidth() 0 4 1
A setWidth() 0 4 1
A getHeight() 0 4 1
A setHeight() 0 4 1
A getUpscale() 0 4 1
A setUpscale() 0 4 1
A getAspectMode() 0 4 1
A setAspectMode() 0 4 1
A getTwoPass() 0 4 1
A setTwoPass() 0 4 1
A getVideoBitrate() 0 4 1
A setVideoBitrate() 0 4 1
A getFps() 0 4 1
A setFps() 0 4 1
A getKeyframeInterval() 0 4 1
A setKeyframeInterval() 0 4 1
A getKeyframeRate() 0 4 1
A setKeyframeRate() 0 4 1
A getAudioBitrate() 0 4 1
A setAudioBitrate() 0 4 1
A getAudioSampleRate() 0 4 1
A setAudioSampleRate() 0 4 1
A getAudioChannels() 0 4 1
A setAudioChannels() 0 4 1
A getClipLength() 0 4 1
A setClipLength() 0 4 1
A getClipOffset() 0 4 1
A setClipOffset() 0 4 1
A getFrameCount() 0 4 1
A setFrameCount() 0 4 1
A getCommand() 0 4 1
A setCommand() 0 4 1
A getCreatedAt() 0 4 1
A setCreatedAt() 0 4 1
A getUpdatedAt() 0 4 1
A setUpdatedAt() 0 4 1

How to fix   Complexity   

Complex Class

Complex classes like Profile often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Profile, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
/*
4
 * This file is part of the XabbuhPandaClient package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Xabbuh\PandaClient\Model;
13
14
/**
15
 * Model representing a profile configuration.
16
 *
17
 * @author Christian Flothmann <[email protected]>
18
 */
19
class Profile implements ModelInterface
20
{
21
    private $id;
22
23
    private $title;
24
25
    private $name;
26
27
    private $presetName;
28
29
    private $extname;
30
31
    private $width;
32
33
    private $height;
34
35
    private $upscale;
36
37
    private $aspectMode;
38
39
    private $twoPass;
40
41
    private $videoBitrate;
42
43
    private $fps;
44
45
    private $keyframeInterval;
46
47
    private $keyframeRate;
48
49
    private $audioBitrate;
50
51
    private $audioSampleRate;
52
53
    private $audioChannels;
54
55
    private $clipLength;
56
57
    private $clipOffset;
58
59
    private $frameCount;
60
61
    private $command;
62
63
    private $createdAt;
64
65
    private $updatedAt;
66
67
    public function getId()
68
    {
69
        return $this->id;
70
    }
71
72
    public function setId($id)
73
    {
74
        $this->id = $id;
75
    }
76
77
    public function getTitle()
78
    {
79
        return $this->title;
80
    }
81
82
    public function setTitle($title)
83
    {
84
        $this->title = $title;
85
    }
86
87
    public function getName()
88
    {
89
        return $this->name;
90
    }
91
92
    public function setName($name)
93
    {
94
        $this->name = $name;
95
    }
96
97
    public function getPresetName()
98
    {
99
        return $this->presetName;
100
    }
101
102
    public function setPresetName($presetName)
103
    {
104
        $this->presetName = $presetName;
105
    }
106
107
    public function getExtname()
108
    {
109
        return $this->extname;
110
    }
111
112
    public function setExtname($extname)
113
    {
114
        $this->extname = $extname;
115
    }
116
117
    public function getWidth()
118
    {
119
        return $this->width;
120
    }
121
122
    public function setWidth($width)
123
    {
124
        $this->width = $width;
125
    }
126
127
    public function getHeight()
128
    {
129
        return $this->height;
130
    }
131
132
    public function setHeight($height)
133
    {
134
        $this->height = $height;
135
    }
136
137
    public function getUpscale()
138
    {
139
        return $this->upscale;
140
    }
141
142
    public function setUpscale($upscale)
143
    {
144
        $this->upscale = $upscale;
145
    }
146
147
    public function getAspectMode()
148
    {
149
        return $this->aspectMode;
150
    }
151
152
    public function setAspectMode($aspectMode)
153
    {
154
        $this->aspectMode = $aspectMode;
155
    }
156
157
    public function getTwoPass()
158
    {
159
        return $this->twoPass;
160
    }
161
162
    public function setTwoPass($twoPass)
163
    {
164
        $this->twoPass = $twoPass;
165
    }
166
167
    public function getVideoBitrate()
168
    {
169
        return $this->videoBitrate;
170
    }
171
172
    public function setVideoBitrate($videoBitrate)
173
    {
174
        $this->videoBitrate = $videoBitrate;
175
    }
176
177
    public function getFps()
178
    {
179
        return $this->fps;
180
    }
181
182
    public function setFps($fps)
183
    {
184
        $this->fps = $fps;
185
    }
186
187
    public function getKeyframeInterval()
188
    {
189
        return $this->keyframeInterval;
190
    }
191
192
    public function setKeyframeInterval($keyframeInterval)
193
    {
194
        $this->keyframeInterval = $keyframeInterval;
195
    }
196
197
    public function getKeyframeRate()
198
    {
199
        return $this->keyframeRate;
200
    }
201
202
    public function setKeyframeRate($keyframeRate)
203
    {
204
        $this->keyframeRate = $keyframeRate;
205
    }
206
207
    public function getAudioBitrate()
208
    {
209
        return $this->audioBitrate;
210
    }
211
212
    public function setAudioBitrate($audioBitrate)
213
    {
214
        $this->audioBitrate = $audioBitrate;
215
    }
216
217
    public function getAudioSampleRate()
218
    {
219
        return $this->audioSampleRate;
220
    }
221
222
    public function setAudioSampleRate($audioSampleRate)
223
    {
224
        $this->audioSampleRate = $audioSampleRate;
225
    }
226
227
    public function getAudioChannels()
228
    {
229
        return $this->audioChannels;
230
    }
231
232
    public function setAudioChannels($audioChannels)
233
    {
234
        $this->audioChannels = $audioChannels;
235
    }
236
237
    public function getClipLength()
238
    {
239
        return $this->clipLength;
240
    }
241
242
    public function setClipLength($clipLength)
243
    {
244
        $this->clipLength = $clipLength;
245
    }
246
247
    public function getClipOffset()
248
    {
249
        return $this->clipOffset;
250
    }
251
252
    public function setClipOffset($clipOffset)
253
    {
254
        $this->clipOffset = $clipOffset;
255
    }
256
257
    public function getFrameCount()
258
    {
259
        return $this->frameCount;
260
    }
261
262
    public function setFrameCount($frameCount)
263
    {
264
        $this->frameCount = $frameCount;
265
    }
266
267
    public function getCommand()
268
    {
269
        return $this->command;
270
    }
271
272
    public function setCommand($command)
273
    {
274
        $this->command = $command;
275
    }
276
277
    public function getCreatedAt()
278
    {
279
        return $this->createdAt;
280
    }
281
282
    public function setCreatedAt($createdAt)
283
    {
284
        $this->createdAt = $createdAt;
285
    }
286
287
    public function getUpdatedAt()
288
    {
289
        return $this->updatedAt;
290
    }
291
292
    public function setUpdatedAt($updatedAt)
293
    {
294
        $this->updatedAt = $updatedAt;
295
    }
296
}
297