Profile   A
last analyzed

Complexity

Total Complexity 42

Size/Duplication

Total Lines 479
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 479
rs 9.0399
c 0
b 0
f 0
wmc 42
lcom 0
cbo 1

42 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllow() 0 4 1
A setAllow() 0 4 1
A getAccount() 0 4 1
A setAccount() 0 4 1
A getEmail() 0 4 1
A setEmail() 0 4 1
A getLnick() 0 4 1
A setLnick() 0 4 1
A setBirthday() 0 4 1
A getBirthday() 0 4 1
A setOccupation() 0 4 1
A getOccupation() 0 4 1
A setPhone() 0 4 1
A getPhone() 0 4 1
A setCollege() 0 4 1
A getCollege() 0 4 1
A setConstel() 0 4 1
A getConstel() 0 4 1
A setBlood() 0 4 1
A getBlood() 0 4 1
A setHomepage() 0 4 1
A getHomepage() 0 4 1
A setStat() 0 4 1
A getStat() 0 4 1
A setVipInfo() 0 4 1
A getVipInfo() 0 4 1
A setCountry() 0 4 1
A getCountry() 0 4 1
A setProvince() 0 4 1
A getProvince() 0 4 1
A setCity() 0 4 1
A getCity() 0 4 1
A setPersonal() 0 4 1
A getPersonal() 0 4 1
A setNick() 0 4 1
A getNick() 0 4 1
A setShengXiao() 0 4 1
A getShengXiao() 0 4 1
A setGender() 0 4 1
A getGender() 0 4 1
A setMobile() 0 4 1
A getMobile() 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. 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 Profile, and based on these observations, apply Extract Interface, too.

1
<?php
2
/*
3
 * This file is part of the slince/smartqq package.
4
 *
5
 * (c) Slince <[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 Slince\SmartQQ\Entity;
12
13
class Profile extends User
14
{
15
    /**
16
     * @var int
17
     */
18
    protected $allow;
19
20
    /**
21
     * QQ号.
22
     *
23
     * @var int
24
     */
25
    protected $account;
26
27
    /**
28
     * 邮箱.
29
     *
30
     * @var string
31
     */
32
    protected $email;
33
34
    /**
35
     * 个性签名.
36
     *
37
     * @var string
38
     */
39
    protected $lnick;
40
41
    /**
42
     * 生日.
43
     *
44
     * @var Birthday
45
     */
46
    protected $birthday;
47
48
    /**
49
     * 未知.
50
     *
51
     * @var string
52
     */
53
    protected $occupation;
54
55
    /**
56
     * 电话.
57
     *
58
     * @var string
59
     */
60
    protected $phone;
61
62
    /**
63
     * 学院.
64
     *
65
     * @var string
66
     */
67
    protected $college;
68
69
    /**
70
     * 未知.
71
     *
72
     * @var int
73
     */
74
    protected $constel;
75
76
    /**
77
     * @var int
78
     */
79
    protected $blood;
80
81
    /**
82
     * 主页.
83
     *
84
     * @var string
85
     */
86
    protected $homepage;
87
88
    /**
89
     * 未知.
90
     *
91
     * @var int
92
     */
93
    protected $stat;
94
95
    /**
96
     * vip_info.
97
     *
98
     * @var int
99
     */
100
    protected $vipInfo;
101
102
    /**
103
     * 国家.
104
     *
105
     * @var string
106
     */
107
    protected $country;
108
109
    /**
110
     * 省
111
     *
112
     * @var string
113
     */
114
    protected $province;
115
116
    /**
117
     * 城市
118
     *
119
     * @var string
120
     */
121
    protected $city;
122
123
    /**
124
     * 简介.
125
     *
126
     * @var string
127
     */
128
    protected $personal;
129
130
    /**
131
     * @var string
132
     */
133
    protected $nick;
134
135
    /**
136
     * 生肖.
137
     *
138
     * @var int
139
     */
140
    protected $shengXiao;
141
142
    /**
143
     * female|male.
144
     *
145
     * @var string
146
     */
147
    protected $gender;
148
149
    /**
150
     * 手机号.
151
     *
152
     * @var string
153
     */
154
    protected $mobile;
155
156
    /**
157
     * @return int
158
     */
159
    public function getAllow()
160
    {
161
        return $this->allow;
162
    }
163
164
    /**
165
     * @param int $allow
166
     */
167
    public function setAllow($allow)
168
    {
169
        $this->allow = $allow;
170
    }
171
172
    /**
173
     * @return int
174
     */
175
    public function getAccount()
176
    {
177
        return $this->account;
178
    }
179
180
    /**
181
     * @param int $account
182
     */
183
    public function setAccount($account)
184
    {
185
        $this->account = $account;
186
    }
187
188
    /**
189
     * @return string
190
     */
191
    public function getEmail()
192
    {
193
        return $this->email;
194
    }
195
196
    /**
197
     * @param string $email
198
     */
199
    public function setEmail($email)
200
    {
201
        $this->email = $email;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function getLnick()
208
    {
209
        return $this->lnick;
210
    }
211
212
    /**
213
     * @param string $lnick
214
     */
215
    public function setLnick($lnick)
216
    {
217
        $this->lnick = $lnick;
218
    }
219
220
    /**
221
     * @param Birthday $birthday
222
     */
223
    public function setBirthday(Birthday $birthday)
224
    {
225
        $this->birthday = $birthday;
226
    }
227
228
    /**
229
     * @return Birthday
230
     */
231
    public function getBirthday()
232
    {
233
        return $this->birthday;
234
    }
235
236
    /**
237
     * @param string $occupation
238
     */
239
    public function setOccupation($occupation)
240
    {
241
        $this->occupation = $occupation;
242
    }
243
244
    /**
245
     * @return string
246
     */
247
    public function getOccupation()
248
    {
249
        return $this->occupation;
250
    }
251
252
    /**
253
     * @param string $phone
254
     */
255
    public function setPhone($phone)
256
    {
257
        $this->phone = $phone;
258
    }
259
260
    /**
261
     * @return string
262
     */
263
    public function getPhone()
264
    {
265
        return $this->phone;
266
    }
267
268
    /**
269
     * @param string $college
270
     */
271
    public function setCollege($college)
272
    {
273
        $this->college = $college;
274
    }
275
276
    /**
277
     * @return string
278
     */
279
    public function getCollege()
280
    {
281
        return $this->college;
282
    }
283
284
    /**
285
     * @param int $constel
286
     */
287
    public function setConstel($constel)
288
    {
289
        $this->constel = $constel;
290
    }
291
292
    /**
293
     * @return int
294
     */
295
    public function getConstel()
296
    {
297
        return $this->constel;
298
    }
299
300
    /**
301
     * @param int $blood
302
     */
303
    public function setBlood($blood)
304
    {
305
        $this->blood = $blood;
306
    }
307
308
    /**
309
     * @return int
310
     */
311
    public function getBlood()
312
    {
313
        return $this->blood;
314
    }
315
316
    /**
317
     * @param string $homepage
318
     */
319
    public function setHomepage($homepage)
320
    {
321
        $this->homepage = $homepage;
322
    }
323
324
    /**
325
     * @return string
326
     */
327
    public function getHomepage()
328
    {
329
        return $this->homepage;
330
    }
331
332
    /**
333
     * @param int $stat
334
     */
335
    public function setStat($stat)
336
    {
337
        $this->stat = $stat;
338
    }
339
340
    /**
341
     * @return int
342
     */
343
    public function getStat()
344
    {
345
        return $this->stat;
346
    }
347
348
    /**
349
     * @param int $vipInfo
350
     */
351
    public function setVipInfo($vipInfo)
352
    {
353
        $this->vipInfo = $vipInfo;
354
    }
355
356
    /**
357
     * @return int
358
     */
359
    public function getVipInfo()
360
    {
361
        return $this->vipInfo;
362
    }
363
364
    /**
365
     * @param string $country
366
     */
367
    public function setCountry($country)
368
    {
369
        $this->country = $country;
370
    }
371
372
    /**
373
     * @return string
374
     */
375
    public function getCountry()
376
    {
377
        return $this->country;
378
    }
379
380
    /**
381
     * @param string $province
382
     */
383
    public function setProvince($province)
384
    {
385
        $this->province = $province;
386
    }
387
388
    /**
389
     * @return string
390
     */
391
    public function getProvince()
392
    {
393
        return $this->province;
394
    }
395
396
    /**
397
     * @param string $city
398
     */
399
    public function setCity($city)
400
    {
401
        $this->city = $city;
402
    }
403
404
    /**
405
     * @return string
406
     */
407
    public function getCity()
408
    {
409
        return $this->city;
410
    }
411
412
    /**
413
     * @param string $personal
414
     */
415
    public function setPersonal($personal)
416
    {
417
        $this->personal = $personal;
418
    }
419
420
    /**
421
     * @return string
422
     */
423
    public function getPersonal()
424
    {
425
        return $this->personal;
426
    }
427
428
    /**
429
     * @param string $nick
430
     */
431
    public function setNick($nick)
432
    {
433
        $this->nick = $nick;
434
    }
435
436
    /**
437
     * @return string
438
     */
439
    public function getNick()
440
    {
441
        return $this->nick;
442
    }
443
444
    /**
445
     * @param int $shengXiao
446
     */
447
    public function setShengXiao($shengXiao)
448
    {
449
        $this->shengXiao = $shengXiao;
450
    }
451
452
    /**
453
     * @return int
454
     */
455
    public function getShengXiao()
456
    {
457
        return $this->shengXiao;
458
    }
459
460
    /**
461
     * @param string $gender
462
     */
463
    public function setGender($gender)
464
    {
465
        $this->gender = $gender;
466
    }
467
468
    /**
469
     * @return string
470
     */
471
    public function getGender()
472
    {
473
        return $this->gender;
474
    }
475
476
    /**
477
     * @param string $mobile
478
     */
479
    public function setMobile($mobile)
480
    {
481
        $this->mobile = $mobile;
482
    }
483
484
    /**
485
     * @return string
486
     */
487
    public function getMobile()
488
    {
489
        return $this->mobile;
490
    }
491
}
492