GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

User   A
last analyzed

Complexity

Total Complexity 42

Size/Duplication

Total Lines 548
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 42
lcom 0
cbo 1
dl 0
loc 548
ccs 70
cts 84
cp 0.8333
rs 9.0399
c 0
b 0
f 0

42 Methods

Rating   Name   Duplication   Size   Complexity  
A id() 0 4 1
A idStr() 0 4 1
A name() 0 4 1
A screenName() 0 4 1
A location() 0 4 1
A profileLocation() 0 4 1
A description() 0 4 1
A url() 0 4 1
A protected() 0 4 1
A followersCount() 0 4 1
A friendsCount() 0 4 1
A listedCount() 0 4 1
A createdAt() 0 4 1
A favouritesCount() 0 4 1
A utcOffset() 0 4 1
A timeZone() 0 4 1
A geoEnabled() 0 4 1
A verified() 0 4 1
A statusesCount() 0 4 1
A lang() 0 4 1
A status() 0 4 1
A contributorsEnabled() 0 4 1
A isTranslator() 0 4 1
A isTranslatorEnabled() 0 4 1
A profileBackgroundColor() 0 4 1
A profileBackgroundImageUrl() 0 4 1
A profileBackgroundImageUrlHttps() 0 4 1
A profileBackgroundTile() 0 4 1
A profileImageUrl() 0 4 1
A profileImageUrlHttps() 0 4 1
A profileBannerUrl() 0 4 1
A profileLinkColor() 0 4 1
A profileSidebarBorderColor() 0 4 1
A profileSidebarFillColor() 0 4 1
A profileTextColor() 0 4 1
A profileUseBackgroundImage() 0 4 1
A hasExtendedProfile() 0 4 1
A defaultProfile() 0 4 1
A defaultProfileImage() 0 4 1
A following() 0 4 1
A followRequestSent() 0 4 1
A notifications() 0 4 1

How to fix   Complexity   

Complex Class

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

1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Twitter\Resource;
4
5
use ApiClients\Foundation\Hydrator\Annotation\EmptyResource;
6
use ApiClients\Foundation\Resource\AbstractResource;
7
use DateTime;
8
9
/**
10
 * @EmptyResource("EmptyUser")
11
 */
12
abstract class User extends AbstractResource implements UserInterface
13
{
14
    /**
15
     * @var int
16
     */
17
    protected $id;
18
19
    /**
20
     * @var string
21
     */
22
    protected $id_str;
23
24
    /**
25
     * @var string
26
     */
27
    protected $name;
28
29
    /**
30
     * @var string
31
     */
32
    protected $screen_name;
33
34
    /**
35
     * @var string
36
     */
37
    protected $location;
38
39
    /**
40
     * @var string
41
     */
42
    //protected $profile_location;
43
44
    /**
45
     * @var string
46
     */
47
    protected $description;
48
49
    /**
50
     * @var string
51
     */
52
    protected $url;
53
54
    /**
55
     * @var bool
56
     */
57
    protected $protected;
58
59
    /**
60
     * @var int
61
     */
62
    protected $followers_count;
63
64
    /**
65
     * @var int
66
     */
67
    protected $friends_count;
68
69
    /**
70
     * @var int
71
     */
72
    protected $listed_count;
73
74
    /**
75
     * @var DateTime
76
     */
77
    protected $created_at;
78
79
    /**
80
     * @var int
81
     */
82
    protected $favourites_count;
83
84
    /**
85
     * @var int
86
     */
87
    protected $utc_offset;
88
89
    /**
90
     * @var string
91
     */
92
    protected $time_zone;
93
94
    /**
95
     * @var bool
96
     */
97
    protected $geo_enabled;
98
99
    /**
100
     * @var bool
101
     */
102
    protected $verified;
103
104
    /**
105
     * @var int
106
     */
107
    protected $statuses_count;
108
109
    /**
110
     * @var string
111
     */
112
    protected $lang;
113
114
    /**
115
     * @var array
116
     */
117
    //protected $status;
118
119
    /**
120
     * @var bool
121
     */
122
    protected $contributors_enabled;
123
124
    /**
125
     * @var bool
126
     */
127
    //protected $is_translator;
128
129
    /**
130
     * @var bool
131
     */
132
    //protected $is_translator_enabled;
133
134
    /**
135
     * @var string
136
     */
137
    protected $profile_background_color;
138
139
    /**
140
     * @var string
141
     */
142
    protected $profile_background_image_url;
143
144
    /**
145
     * @var string
146
     */
147
    protected $profile_background_image_url_https;
148
149
    /**
150
     * @var bool
151
     */
152
    protected $profile_background_tile;
153
154
    /**
155
     * @var string
156
     */
157
    protected $profile_image_url;
158
159
    /**
160
     * @var string
161
     */
162
    protected $profile_image_url_https;
163
164
    /**
165
     * @var string
166
     */
167
    //protected $profile_banner_url;
168
169
    /**
170
     * @var string
171
     */
172
    protected $profile_link_color;
173
174
    /**
175
     * @var string
176
     */
177
    protected $profile_sidebar_border_color;
178
179
    /**
180
     * @var string
181
     */
182
    protected $profile_sidebar_fill_color;
183
184
    /**
185
     * @var string
186
     */
187
    protected $profile_text_color;
188
189
    /**
190
     * @var bool
191
     */
192
    protected $profile_use_background_image;
193
194
    /**
195
     * @var bool
196
     */
197
    //protected $has_extended_profile;
198
199
    /**
200
     * @var bool
201
     */
202
    protected $default_profile;
203
204
    /**
205
     * @var bool
206
     */
207
    protected $default_profile_image;
208
209
    /**
210
     * @var bool
211
     */
212
    protected $following;
213
214
    /**
215
     * @var bool
216
     */
217
    protected $follow_request_sent;
218
219
    /**
220
     * @var bool
221
     */
222
    protected $notifications;
223
224
    /**
225
     * @return int
226
     */
227 4
    public function id(): int
228
    {
229 4
        return $this->id;
230
    }
231
232
    /**
233
     * @return string
234
     */
235 4
    public function idStr(): string
236
    {
237 4
        return $this->id_str;
238
    }
239
240
    /**
241
     * @return string
242
     */
243 4
    public function name(): string
244
    {
245 4
        return $this->name;
246
    }
247
248
    /**
249
     * @return string
250
     */
251 4
    public function screenName(): string
252
    {
253 4
        return $this->screen_name;
254
    }
255
256
    /**
257
     * @return string
258
     */
259 4
    public function location(): string
260
    {
261 4
        return $this->location;
262
    }
263
264
    /**
265
     * @return string
266
     */
267
    public function profileLocation(): string
268
    {
269
        return $this->profile_location;
0 ignored issues
show
Bug introduced by
The property profile_location does not seem to exist. Did you mean location?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
270
    }
271
272
    /**
273
     * @return string
274
     */
275 4
    public function description(): string
276
    {
277 4
        return $this->description;
278
    }
279
280
    /**
281
     * @return string
282
     */
283 4
    public function url(): string
284
    {
285 4
        return $this->url;
286
    }
287
288
    /**
289
     * @return bool
290
     */
291 4
    public function protected(): bool
292
    {
293 4
        return $this->protected;
294
    }
295
296
    /**
297
     * @return int
298
     */
299 4
    public function followersCount(): int
300
    {
301 4
        return $this->followers_count;
302
    }
303
304
    /**
305
     * @return int
306
     */
307 4
    public function friendsCount(): int
308
    {
309 4
        return $this->friends_count;
310
    }
311
312
    /**
313
     * @return int
314
     */
315 4
    public function listedCount(): int
316
    {
317 4
        return $this->listed_count;
318
    }
319
320
    /**
321
     * @return DateTime
322
     */
323
    public function createdAt(): DateTime
324
    {
325
        return $this->created_at;
326
    }
327
328
    /**
329
     * @return int
330
     */
331 4
    public function favouritesCount(): int
332
    {
333 4
        return $this->favourites_count;
334
    }
335
336
    /**
337
     * @return int
338
     */
339 4
    public function utcOffset(): int
340
    {
341 4
        return $this->utc_offset;
342
    }
343
344
    /**
345
     * @return string
346
     */
347 4
    public function timeZone(): string
348
    {
349 4
        return $this->time_zone;
350
    }
351
352
    /**
353
     * @return bool
354
     */
355 4
    public function geoEnabled(): bool
356
    {
357 4
        return $this->geo_enabled;
358
    }
359
360
    /**
361
     * @return bool
362
     */
363 4
    public function verified(): bool
364
    {
365 4
        return $this->verified;
366
    }
367
368
    /**
369
     * @return int
370
     */
371 4
    public function statusesCount(): int
372
    {
373 4
        return $this->statuses_count;
374
    }
375
376
    /**
377
     * @return string
378
     */
379 4
    public function lang(): string
380
    {
381 4
        return $this->lang;
382
    }
383
384
    /**
385
     * @return array
386
     */
387
    public function status(): array
388
    {
389
        return $this->status;
0 ignored issues
show
Bug introduced by
The property status does not seem to exist. Did you mean statuses_count?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
390
    }
391
392
    /**
393
     * @return bool
394
     */
395 4
    public function contributorsEnabled(): bool
396
    {
397 4
        return $this->contributors_enabled;
398
    }
399
400
    /**
401
     * @return bool
402
     */
403
    public function isTranslator(): bool
404
    {
405
        return $this->is_translator;
0 ignored issues
show
Bug introduced by
The property is_translator does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
406
    }
407
408
    /**
409
     * @return bool
410
     */
411
    public function isTranslatorEnabled(): bool
412
    {
413
        return $this->is_translator_enabled;
0 ignored issues
show
Bug introduced by
The property is_translator_enabled does not seem to exist. Did you mean is_translator?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
414
    }
415
416
    /**
417
     * @return string
418
     */
419 4
    public function profileBackgroundColor(): string
420
    {
421 4
        return $this->profile_background_color;
422
    }
423
424
    /**
425
     * @return string
426
     */
427 4
    public function profileBackgroundImageUrl(): string
428
    {
429 4
        return $this->profile_background_image_url;
430
    }
431
432
    /**
433
     * @return string
434
     */
435 4
    public function profileBackgroundImageUrlHttps(): string
436
    {
437 4
        return $this->profile_background_image_url_https;
438
    }
439
440
    /**
441
     * @return bool
442
     */
443 4
    public function profileBackgroundTile(): bool
444
    {
445 4
        return $this->profile_background_tile;
446
    }
447
448
    /**
449
     * @return string
450
     */
451 4
    public function profileImageUrl(): string
452
    {
453 4
        return $this->profile_image_url;
454
    }
455
456
    /**
457
     * @return string
458
     */
459 4
    public function profileImageUrlHttps(): string
460
    {
461 4
        return $this->profile_image_url_https;
462
    }
463
464
    /**
465
     * @return string
466
     */
467
    public function profileBannerUrl(): string
468
    {
469
        return $this->profile_banner_url;
0 ignored issues
show
Bug introduced by
The property profile_banner_url does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
470
    }
471
472
    /**
473
     * @return string
474
     */
475 4
    public function profileLinkColor(): string
476
    {
477 4
        return $this->profile_link_color;
478
    }
479
480
    /**
481
     * @return string
482
     */
483 4
    public function profileSidebarBorderColor(): string
484
    {
485 4
        return $this->profile_sidebar_border_color;
486
    }
487
488
    /**
489
     * @return string
490
     */
491 4
    public function profileSidebarFillColor(): string
492
    {
493 4
        return $this->profile_sidebar_fill_color;
494
    }
495
496
    /**
497
     * @return string
498
     */
499 4
    public function profileTextColor(): string
500
    {
501 4
        return $this->profile_text_color;
502
    }
503
504
    /**
505
     * @return bool
506
     */
507 4
    public function profileUseBackgroundImage(): bool
508
    {
509 4
        return $this->profile_use_background_image;
510
    }
511
512
    /**
513
     * @return bool
514
     */
515
    public function hasExtendedProfile(): bool
516
    {
517
        return $this->has_extended_profile;
0 ignored issues
show
Bug introduced by
The property has_extended_profile does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
518
    }
519
520
    /**
521
     * @return bool
522
     */
523 4
    public function defaultProfile(): bool
524
    {
525 4
        return $this->default_profile;
526
    }
527
528
    /**
529
     * @return bool
530
     */
531 4
    public function defaultProfileImage(): bool
532
    {
533 4
        return $this->default_profile_image;
534
    }
535
536
    /**
537
     * @return bool
538
     */
539 4
    public function following(): bool
540
    {
541 4
        return $this->following;
542
    }
543
544
    /**
545
     * @return bool
546
     */
547 4
    public function followRequestSent(): bool
548
    {
549 4
        return $this->follow_request_sent;
550
    }
551
552
    /**
553
     * @return bool
554
     */
555 4
    public function notifications(): bool
556
    {
557 4
        return $this->notifications;
558
    }
559
}
560