Completed
Push — master ( bd8043...d919b4 )
by Francesco
05:20
created

UploadJobStatus   B

Complexity

Total Complexity 48

Size/Duplication

Total Lines 414
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 48
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 414
rs 8.4864

48 Methods

Rating   Name   Duplication   Size   Complexity  
A getPhase() 0 4 1
A setPhase() 0 4 1
A getStartTime() 0 4 1
A setStartTime() 0 4 1
A getUploadedTime() 0 4 1
A setUploadedTime() 0 4 1
A getValidatedTime() 0 4 1
A setValidatedTime() 0 4 1
A getCompletedTime() 0 4 1
A setCompletedTime() 0 4 1
A getErrorCode() 0 4 1
A setErrorCode() 0 4 1
A getTimeToProcess() 0 4 1
A setTimeToProcess() 0 4 1
A getPercentComplete() 0 4 1
A setPercentComplete() 0 4 1
A getNumValid() 0 4 1
A setNumValid() 0 4 1
A getNumValidUser() 0 4 1
A setNumValidUser() 0 4 1
A getNumInvalidFormat() 0 4 1
A setNumInvalidFormat() 0 4 1
A getNumInvalidUser() 0 4 1
A setNumInvalidUser() 0 4 1
A getNumInvalidSegment() 0 4 1
A setNumInvalidSegment() 0 4 1
A getNumUnauthSegment() 0 4 1
A setNumUnauthSegment() 0 4 1
A getNumPastExpiration() 0 4 1
A setNumPastExpiration() 0 4 1
A getNumInactiveSegment() 0 4 1
A setNumInactiveSegment() 0 4 1
A getNumOtherError() 0 4 1
A setNumOtherError() 0 4 1
A getErrorLogLines() 0 4 1
A setErrorLogLines() 0 4 1
A getSegmentLogLines() 0 4 1
A setSegmentLogLines() 0 4 1
A getId() 0 4 1
A setId() 0 4 1
A getJobId() 0 4 1
A setJobId() 0 4 1
A getMemberId() 0 4 1
A setMemberId() 0 4 1
A getCreatedOn() 0 4 1
A setCreatedOn() 0 4 1
A getLastModified() 0 4 1
A setLastModified() 0 4 1

How to fix   Complexity   

Complex Class

Complex classes like UploadJobStatus 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 UploadJobStatus, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace Audiens\AppnexusClient\entity;
4
5
/**
6
 * Class UploadJobStatus
7
 */
8
class UploadJobStatus
9
{
10
11
    use HydratableTrait;
12
13
    protected $phase;
14
    protected $start_time;
15
    protected $uploaded_time;
16
    protected $validated_time;
17
    protected $completed_time;
18
    protected $error_code;
19
    protected $time_to_process;
20
    protected $percent_complete;
21
    protected $num_valid;
22
    protected $num_valid_user;
23
    protected $num_invalid_format;
24
    protected $num_invalid_user;
25
    protected $num_invalid_segment;
26
    protected $num_unauth_segment;
27
    protected $num_past_expiration;
28
    protected $num_inactive_segment;
29
    protected $num_other_error;
30
    protected $error_log_lines;
31
    protected $segment_log_lines;
32
    protected $id;
33
    protected $job_id;
34
    protected $member_id;
35
    protected $created_on;
36
    protected $last_modified;
37
38
    /**
39
     * @return mixed
40
     */
41
    public function getPhase()
42
    {
43
        return $this->phase;
44
    }
45
46
    /**
47
     * @param mixed $phase
48
     */
49
    public function setPhase($phase)
50
    {
51
        $this->phase = $phase;
52
    }
53
54
    /**
55
     * @return mixed
56
     */
57
    public function getStartTime()
58
    {
59
        return $this->start_time;
60
    }
61
62
    /**
63
     * @param mixed $start_time
64
     */
65
    public function setStartTime($start_time)
66
    {
67
        $this->start_time = $start_time;
68
    }
69
70
    /**
71
     * @return mixed
72
     */
73
    public function getUploadedTime()
74
    {
75
        return $this->uploaded_time;
76
    }
77
78
    /**
79
     * @param mixed $uploaded_time
80
     */
81
    public function setUploadedTime($uploaded_time)
82
    {
83
        $this->uploaded_time = $uploaded_time;
84
    }
85
86
    /**
87
     * @return mixed
88
     */
89
    public function getValidatedTime()
90
    {
91
        return $this->validated_time;
92
    }
93
94
    /**
95
     * @param mixed $validated_time
96
     */
97
    public function setValidatedTime($validated_time)
98
    {
99
        $this->validated_time = $validated_time;
100
    }
101
102
    /**
103
     * @return mixed
104
     */
105
    public function getCompletedTime()
106
    {
107
        return $this->completed_time;
108
    }
109
110
    /**
111
     * @param mixed $completed_time
112
     */
113
    public function setCompletedTime($completed_time)
114
    {
115
        $this->completed_time = $completed_time;
116
    }
117
118
    /**
119
     * @return mixed
120
     */
121
    public function getErrorCode()
122
    {
123
        return $this->error_code;
124
    }
125
126
    /**
127
     * @param mixed $error_code
128
     */
129
    public function setErrorCode($error_code)
130
    {
131
        $this->error_code = $error_code;
132
    }
133
134
    /**
135
     * @return mixed
136
     */
137
    public function getTimeToProcess()
138
    {
139
        return $this->time_to_process;
140
    }
141
142
    /**
143
     * @param mixed $time_to_process
144
     */
145
    public function setTimeToProcess($time_to_process)
146
    {
147
        $this->time_to_process = $time_to_process;
148
    }
149
150
    /**
151
     * @return mixed
152
     */
153
    public function getPercentComplete()
154
    {
155
        return $this->percent_complete;
156
    }
157
158
    /**
159
     * @param mixed $percent_complete
160
     */
161
    public function setPercentComplete($percent_complete)
162
    {
163
        $this->percent_complete = $percent_complete;
164
    }
165
166
    /**
167
     * @return mixed
168
     */
169
    public function getNumValid()
170
    {
171
        return $this->num_valid;
172
    }
173
174
    /**
175
     * @param mixed $num_valid
176
     */
177
    public function setNumValid($num_valid)
178
    {
179
        $this->num_valid = $num_valid;
180
    }
181
182
    /**
183
     * @return mixed
184
     */
185
    public function getNumValidUser()
186
    {
187
        return $this->num_valid_user;
188
    }
189
190
    /**
191
     * @param mixed $num_valid_user
192
     */
193
    public function setNumValidUser($num_valid_user)
194
    {
195
        $this->num_valid_user = $num_valid_user;
196
    }
197
198
    /**
199
     * @return mixed
200
     */
201
    public function getNumInvalidFormat()
202
    {
203
        return $this->num_invalid_format;
204
    }
205
206
    /**
207
     * @param mixed $num_invalid_format
208
     */
209
    public function setNumInvalidFormat($num_invalid_format)
210
    {
211
        $this->num_invalid_format = $num_invalid_format;
212
    }
213
214
    /**
215
     * @return mixed
216
     */
217
    public function getNumInvalidUser()
218
    {
219
        return $this->num_invalid_user;
220
    }
221
222
    /**
223
     * @param mixed $num_invalid_user
224
     */
225
    public function setNumInvalidUser($num_invalid_user)
226
    {
227
        $this->num_invalid_user = $num_invalid_user;
228
    }
229
230
    /**
231
     * @return mixed
232
     */
233
    public function getNumInvalidSegment()
234
    {
235
        return $this->num_invalid_segment;
236
    }
237
238
    /**
239
     * @param mixed $num_invalid_segment
240
     */
241
    public function setNumInvalidSegment($num_invalid_segment)
242
    {
243
        $this->num_invalid_segment = $num_invalid_segment;
244
    }
245
246
    /**
247
     * @return mixed
248
     */
249
    public function getNumUnauthSegment()
250
    {
251
        return $this->num_unauth_segment;
252
    }
253
254
    /**
255
     * @param mixed $num_unauth_segment
256
     */
257
    public function setNumUnauthSegment($num_unauth_segment)
258
    {
259
        $this->num_unauth_segment = $num_unauth_segment;
260
    }
261
262
    /**
263
     * @return mixed
264
     */
265
    public function getNumPastExpiration()
266
    {
267
        return $this->num_past_expiration;
268
    }
269
270
    /**
271
     * @param mixed $num_past_expiration
272
     */
273
    public function setNumPastExpiration($num_past_expiration)
274
    {
275
        $this->num_past_expiration = $num_past_expiration;
276
    }
277
278
    /**
279
     * @return mixed
280
     */
281
    public function getNumInactiveSegment()
282
    {
283
        return $this->num_inactive_segment;
284
    }
285
286
    /**
287
     * @param mixed $num_inactive_segment
288
     */
289
    public function setNumInactiveSegment($num_inactive_segment)
290
    {
291
        $this->num_inactive_segment = $num_inactive_segment;
292
    }
293
294
    /**
295
     * @return mixed
296
     */
297
    public function getNumOtherError()
298
    {
299
        return $this->num_other_error;
300
    }
301
302
    /**
303
     * @param mixed $num_other_error
304
     */
305
    public function setNumOtherError($num_other_error)
306
    {
307
        $this->num_other_error = $num_other_error;
308
    }
309
310
    /**
311
     * @return mixed
312
     */
313
    public function getErrorLogLines()
314
    {
315
        return $this->error_log_lines;
316
    }
317
318
    /**
319
     * @param mixed $error_log_lines
320
     */
321
    public function setErrorLogLines($error_log_lines)
322
    {
323
        $this->error_log_lines = $error_log_lines;
324
    }
325
326
    /**
327
     * @return mixed
328
     */
329
    public function getSegmentLogLines()
330
    {
331
        return $this->segment_log_lines;
332
    }
333
334
    /**
335
     * @param mixed $segment_log_lines
336
     */
337
    public function setSegmentLogLines($segment_log_lines)
338
    {
339
        $this->segment_log_lines = $segment_log_lines;
340
    }
341
342
    /**
343
     * @return mixed
344
     */
345
    public function getId()
346
    {
347
        return $this->id;
348
    }
349
350
    /**
351
     * @param mixed $id
352
     */
353
    public function setId($id)
354
    {
355
        $this->id = $id;
356
    }
357
358
    /**
359
     * @return mixed
360
     */
361
    public function getJobId()
362
    {
363
        return $this->job_id;
364
    }
365
366
    /**
367
     * @param mixed $job_id
368
     */
369
    public function setJobId($job_id)
370
    {
371
        $this->job_id = $job_id;
372
    }
373
374
    /**
375
     * @return mixed
376
     */
377
    public function getMemberId()
378
    {
379
        return $this->member_id;
380
    }
381
382
    /**
383
     * @param mixed $member_id
384
     */
385
    public function setMemberId($member_id)
386
    {
387
        $this->member_id = $member_id;
388
    }
389
390
    /**
391
     * @return mixed
392
     */
393
    public function getCreatedOn()
394
    {
395
        return $this->created_on;
396
    }
397
398
    /**
399
     * @param mixed $created_on
400
     */
401
    public function setCreatedOn($created_on)
402
    {
403
        $this->created_on = $created_on;
404
    }
405
406
    /**
407
     * @return mixed
408
     */
409
    public function getLastModified()
410
    {
411
        return $this->last_modified;
412
    }
413
414
    /**
415
     * @param mixed $last_modified
416
     */
417
    public function setLastModified($last_modified)
418
    {
419
        $this->last_modified = $last_modified;
420
    }
421
}
422