AbstractMedium   A
last analyzed

Complexity

Total Complexity 40

Size/Duplication

Total Lines 242
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 0

Importance

Changes 0
Metric Value
wmc 40
cbo 0
dl 0
loc 242
rs 9.2
c 0
b 0
f 0

40 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 4 1
A getMimeType() 0 4 1
A setMimeType() 0 4 1
A getPath() 0 4 1
A setPath() 0 4 1
A getExtname() 0 4 1
A setExtname() 0 4 1
A getDuration() 0 4 1
A setDuration() 0 4 1
A getWidth() 0 4 1
A setWidth() 0 4 1
A getHeight() 0 4 1
A setHeight() 0 4 1
A getFileSize() 0 4 1
A setFileSize() 0 4 1
A getVideoBitrate() 0 4 1
A setVideoBitrate() 0 4 1
A getAudioBitrate() 0 4 1
A setAudioBitrate() 0 4 1
A getAudioCodec() 0 4 1
A setAudioCodec() 0 4 1
A getVideoCodec() 0 4 1
A setVideoCodec() 0 4 1
A getFps() 0 4 1
A setFps() 0 4 1
A getAudioChannels() 0 4 1
A setAudioChannels() 0 4 1
A getAudioSampleRate() 0 4 1
A setAudioSampleRate() 0 4 1
A getStatus() 0 4 1
A setStatus() 0 4 1
A getErrorMessage() 0 4 1
A setErrorMessage() 0 4 1
A getErrorClass() 0 4 1
A setErrorClass() 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 AbstractMedium 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 AbstractMedium, 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
 * Base class for video related model classes (see {@link Encoding} and
16
 * {@link Video}).
17
 *
18
 * @author Christian Flothmann <[email protected]>
19
 */
20
abstract class AbstractMedium implements ModelInterface
21
{
22
    protected $id;
23
24
    protected $mimeType;
25
26
    protected $path;
27
28
    protected $extname;
29
30
    protected $duration;
31
32
    protected $width;
33
34
    protected $height;
35
36
    protected $fileSize;
37
38
    protected $videoBitrate;
39
40
    protected $audioBitrate;
41
42
    protected $audioCodec;
43
44
    protected $videoCodec;
45
46
    protected $fps;
47
48
    protected $audioChannels;
49
50
    protected $audioSampleRate;
51
52
    protected $status;
53
54
    protected $errorMessage;
55
56
    protected $errorClass;
57
58
    protected $createdAt;
59
60
    protected $updatedAt;
61
62
    public function getId()
63
    {
64
        return $this->id;
65
    }
66
67
    public function setId($id)
68
    {
69
        $this->id = $id;
70
    }
71
72
    public function getMimeType()
73
    {
74
        return $this->mimeType;
75
    }
76
77
    public function setMimeType($mimeType)
78
    {
79
        $this->mimeType = $mimeType;
80
    }
81
82
    public function getPath()
83
    {
84
        return $this->path;
85
    }
86
87
    public function setPath($path)
88
    {
89
        $this->path = $path;
90
    }
91
92
    public function getExtname()
93
    {
94
        return $this->extname;
95
    }
96
97
    public function setExtname($extname)
98
    {
99
        $this->extname = $extname;
100
    }
101
102
    public function getDuration()
103
    {
104
        return $this->duration;
105
    }
106
107
    public function setDuration($duration)
108
    {
109
        $this->duration = $duration;
110
    }
111
112
    public function getWidth()
113
    {
114
        return $this->width;
115
    }
116
117
    public function setWidth($width)
118
    {
119
        $this->width = $width;
120
    }
121
122
    public function getHeight()
123
    {
124
        return $this->height;
125
    }
126
127
    public function setHeight($height)
128
    {
129
        $this->height = $height;
130
    }
131
132
    public function getFileSize()
133
    {
134
        return $this->fileSize;
135
    }
136
137
    public function setFileSize($fileSize)
138
    {
139
        $this->fileSize = $fileSize;
140
    }
141
142
    public function getVideoBitrate()
143
    {
144
        return $this->videoBitrate;
145
    }
146
147
    public function setVideoBitrate($videoBitrate)
148
    {
149
        $this->videoBitrate = $videoBitrate;
150
    }
151
152
    public function getAudioBitrate()
153
    {
154
        return $this->audioBitrate;
155
    }
156
157
    public function setAudioBitrate($audioBitrate)
158
    {
159
        $this->audioBitrate = $audioBitrate;
160
    }
161
162
    public function getAudioCodec()
163
    {
164
        return $this->audioCodec;
165
    }
166
167
    public function setAudioCodec($audioCodec)
168
    {
169
        $this->audioCodec = $audioCodec;
170
    }
171
172
    public function getVideoCodec()
173
    {
174
        return $this->videoCodec;
175
    }
176
177
    public function setVideoCodec($videoCodec)
178
    {
179
        $this->videoCodec = $videoCodec;
180
    }
181
182
    public function getFps()
183
    {
184
        return $this->fps;
185
    }
186
187
    public function setFps($fps)
188
    {
189
        $this->fps = $fps;
190
    }
191
192
    public function getAudioChannels()
193
    {
194
        return $this->audioChannels;
195
    }
196
197
    public function setAudioChannels($audioChannels)
198
    {
199
        $this->audioChannels = $audioChannels;
200
    }
201
202
    public function getAudioSampleRate()
203
    {
204
        return $this->audioSampleRate;
205
    }
206
207
    public function setAudioSampleRate($audioSampleRate)
208
    {
209
        $this->audioSampleRate = $audioSampleRate;
210
    }
211
212
    public function getStatus()
213
    {
214
        return $this->status;
215
    }
216
217
    public function setStatus($status)
218
    {
219
        $this->status = $status;
220
    }
221
222
    public function getErrorMessage()
223
    {
224
        return $this->errorMessage;
225
    }
226
227
    public function setErrorMessage($errorMessage)
228
    {
229
        $this->errorMessage = $errorMessage;
230
    }
231
232
    public function getErrorClass()
233
    {
234
        return $this->errorClass;
235
    }
236
237
    public function setErrorClass($errorClass)
238
    {
239
        $this->errorClass = $errorClass;
240
    }
241
242
    public function getCreatedAt()
243
    {
244
        return $this->createdAt;
245
    }
246
247
    public function setCreatedAt($createdAt)
248
    {
249
        $this->createdAt = $createdAt;
250
    }
251
252
    public function getUpdatedAt()
253
    {
254
        return $this->updatedAt;
255
    }
256
257
    public function setUpdatedAt($updatedAt)
258
    {
259
        $this->updatedAt = $updatedAt;
260
    }
261
}
262