Video   B
last analyzed

Complexity

Total Complexity 42

Size/Duplication

Total Lines 444
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 42
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 444
ccs 0
cts 168
cp 0
rs 8.2951

42 Methods

Rating   Name   Duplication   Size   Complexity  
A getBroadcastType() 0 4 1
A setBroadcastType() 0 4 1
A getBroadcastId() 0 4 1
A setBroadcastId() 0 4 1
A getRecordedAt() 0 4 1
A setRecordedAt() 0 4 1
A getCreatedAt() 0 4 1
A setCreatedAt() 0 4 1
A getResolutions() 0 4 1
A setResolutions() 0 4 1
A getDescription() 0 4 1
A setDescription() 0 4 1
A getThumbnails() 0 4 1
A setThumbnails() 0 4 1
A getTagList() 0 4 1
A setTagList() 0 4 1
A getDeleteAt() 0 4 1
A setDeleteAt() 0 4 1
A getVodType() 0 4 1
A setVodType() 0 4 1
A isIsMuted() 0 4 1
A setIsMuted() 0 4 1
A getPreview() 0 4 1
A setPreview() 0 4 1
A getChannel() 0 4 1
A setChannel() 0 4 1
A getLength() 0 4 1
A setLength() 0 4 1
A getStatus() 0 4 1
A setStatus() 0 4 1
A getViews() 0 4 1
A setViews() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 4 1
A getGame() 0 4 1
A setGame() 0 4 1
A getUrl() 0 4 1
A setUrl() 0 4 1
A getFps() 0 4 1
A setFps() 0 4 1
A getId() 0 4 1
A setId() 0 4 1

How to fix   Complexity   

Complex Class

Complex classes like Video 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

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 Video, and based on these observations, apply Extract Interface, too.

1
<?php
2
namespace Redbox\Twitch\Entity;
3
4
class Video
5
{
6
    /**
7
     * @var string
8
     */
9
    protected $broadcast_type;
10
11
    /**
12
     * @var string
13
     */
14
    protected $broadcast_id;
15
16
    /**
17
     * @var string
18
     */
19
    protected $recorded_at;
20
21
    /**
22
     * @var string
23
     */
24
    protected $created_at;
25
26
    /**
27
     * @var stdClass
28
     */
29
    protected $resolutions;
30
31
    /**
32
     * @var string
33
     */
34
    protected $description;
35
36
    /**
37
     * @var array
38
     */
39
    protected $thumbnails;
40
41
    /**
42
     * @var string
43
     */
44
    protected $tag_list;
45
46
    /**
47
     * @var string
48
     */
49
    protected $delete_at;
50
51
    /**
52
     * @var string
53
     */
54
    protected $vod_type;
55
56
    /**
57
     * @var bool
58
     */
59
    protected $is_muted;
60
61
    /**
62
     * @var string
63
     */
64
    protected $preview;
65
66
    /**
67
     * @var string
68
     */
69
    protected $channel;
70
71
    /**
72
     * @var string
73
     */
74
    protected $length;
75
76
    /**
77
     * @var string
78
     */
79
    protected $status;
80
81
    /**
82
     * @var string
83
     */
84
    protected $views;
85
86
    /**
87
     * @var string
88
     */
89
    protected $title;
90
91
    /**
92
     * @var string
93
     */
94
    protected $game;
95
96
    /**
97
     * @var string
98
     */
99
    protected $url;
100
101
    /**
102
     * @var stdClass
103
     */
104
    protected $fps;
105
106
    /**
107
     * @var string $id
108
     */
109
    protected $id;
110
111
    /**
112
     * @return string
113
     */
114
    public function getBroadcastType()
115
    {
116
        return $this->broadcast_type;
117
    }
118
119
    /**
120
     * @param string $broadcast_type
121
     */
122
    public function setBroadcastType($broadcast_type)
123
    {
124
        $this->broadcast_type = $broadcast_type;
125
    }
126
127
    /**
128
     * @return string
129
     */
130
    public function getBroadcastId()
131
    {
132
        return $this->broadcast_id;
133
    }
134
135
    /**
136
     * @param string $broadcast_id
137
     */
138
    public function setBroadcastId($broadcast_id)
139
    {
140
        $this->broadcast_id = $broadcast_id;
141
    }
142
143
    /**
144
     * @return string
145
     */
146
    public function getRecordedAt()
147
    {
148
        return $this->recorded_at;
149
    }
150
151
    /**
152
     * @param string $recorded_at
153
     */
154
    public function setRecordedAt($recorded_at)
155
    {
156
        $this->recorded_at = $recorded_at;
157
    }
158
159
    /**
160
     * @return string
161
     */
162
    public function getCreatedAt()
163
    {
164
        return $this->created_at;
165
    }
166
167
    /**
168
     * @param string $created_at
169
     */
170
    public function setCreatedAt($created_at)
171
    {
172
        $this->created_at = $created_at;
173
    }
174
175
    /**
176
     * @return stdClass
177
     */
178
    public function getResolutions()
179
    {
180
        return $this->resolutions;
181
    }
182
183
    /**
184
     * @param stdClass $resolutions
185
     */
186
    public function setResolutions($resolutions)
187
    {
188
        $this->resolutions = $resolutions;
189
    }
190
191
    /**
192
     * @return string
193
     */
194
    public function getDescription()
195
    {
196
        return $this->description;
197
    }
198
199
    /**
200
     * @param string $description
201
     */
202
    public function setDescription($description)
203
    {
204
        $this->description = $description;
205
    }
206
207
    /**
208
     * @return array
209
     */
210
    public function getThumbnails()
211
    {
212
        return $this->thumbnails;
213
    }
214
215
    /**
216
     * @param array $thumbnails
217
     */
218
    public function setThumbnails($thumbnails)
219
    {
220
        $this->thumbnails = $thumbnails;
221
    }
222
223
    /**
224
     * @return string
225
     */
226
    public function getTagList()
227
    {
228
        return $this->tag_list;
229
    }
230
231
    /**
232
     * @param string $tag_list
233
     */
234
    public function setTagList($tag_list)
235
    {
236
        $this->tag_list = $tag_list;
237
    }
238
239
    /**
240
     * @return string
241
     */
242
    public function getDeleteAt()
243
    {
244
        return $this->delete_at;
245
    }
246
247
    /**
248
     * @param string $delete_at
249
     */
250
    public function setDeleteAt($delete_at)
251
    {
252
        $this->delete_at = $delete_at;
253
    }
254
255
    /**
256
     * @return string
257
     */
258
    public function getVodType()
259
    {
260
        return $this->vod_type;
261
    }
262
263
    /**
264
     * @param string $vod_type
265
     */
266
    public function setVodType($vod_type)
267
    {
268
        $this->vod_type = $vod_type;
269
    }
270
271
    /**
272
     * @return boolean
273
     */
274
    public function isIsMuted()
275
    {
276
        return $this->is_muted;
277
    }
278
279
    /**
280
     * @param boolean $is_muted
281
     */
282
    public function setIsMuted($is_muted)
283
    {
284
        $this->is_muted = $is_muted;
285
    }
286
287
    /**
288
     * @return string
289
     */
290
    public function getPreview()
291
    {
292
        return $this->preview;
293
    }
294
295
    /**
296
     * @param string $preview
297
     */
298
    public function setPreview($preview)
299
    {
300
        $this->preview = $preview;
301
    }
302
303
    /**
304
     * @return string
305
     */
306
    public function getChannel()
307
    {
308
        return $this->channel;
309
    }
310
311
    /**
312
     * @param string $channel
313
     */
314
    public function setChannel($channel)
315
    {
316
        $this->channel = $channel;
317
    }
318
319
    /**
320
     * @return string
321
     */
322
    public function getLength()
323
    {
324
        return $this->length;
325
    }
326
327
    /**
328
     * @param string $length
329
     */
330
    public function setLength($length)
331
    {
332
        $this->length = $length;
333
    }
334
335
    /**
336
     * @return string
337
     */
338
    public function getStatus()
339
    {
340
        return $this->status;
341
    }
342
343
    /**
344
     * @param string $status
345
     */
346
    public function setStatus($status)
347
    {
348
        $this->status = $status;
349
    }
350
351
    /**
352
     * @return string
353
     */
354
    public function getViews()
355
    {
356
        return $this->views;
357
    }
358
359
    /**
360
     * @param string $views
361
     */
362
    public function setViews($views)
363
    {
364
        $this->views = $views;
365
    }
366
367
    /**
368
     * @return string
369
     */
370
    public function getTitle()
371
    {
372
        return $this->title;
373
    }
374
375
    /**
376
     * @param string $title
377
     */
378
    public function setTitle($title)
379
    {
380
        $this->title = $title;
381
    }
382
383
    /**
384
     * @return string
385
     */
386
    public function getGame()
387
    {
388
        return $this->game;
389
    }
390
391
    /**
392
     * @param string $game
393
     */
394
    public function setGame($game)
395
    {
396
        $this->game = $game;
397
    }
398
399
    /**
400
     * @return string
401
     */
402
    public function getUrl()
403
    {
404
        return $this->url;
405
    }
406
407
    /**
408
     * @param string $url
409
     */
410
    public function setUrl($url)
411
    {
412
        $this->url = $url;
413
    }
414
415
    /**
416
     * @return stdClass
417
     */
418
    public function getFps()
419
    {
420
        return $this->fps;
421
    }
422
423
    /**
424
     * @param stdClass $fps
425
     */
426
    public function setFps($fps)
427
    {
428
        $this->fps = $fps;
429
    }
430
431
    /**
432
     * @return string
433
     */
434
    public function getId()
435
    {
436
        return $this->id;
437
    }
438
439
    /**
440
     * @param string $id
441
     */
442
    public function setId($id)
443
    {
444
        $this->id = $id;
445
    }
446
447
}