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.

Condition   C
last analyzed

Complexity

Total Complexity 56

Size/Duplication

Total Lines 730
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 56
lcom 0
cbo 1
dl 0
loc 730
ccs 0
cts 112
cp 0
rs 5.39
c 0
b 0
f 0

56 Methods

Rating   Name   Duplication   Size   Complexity  
A image() 0 4 1
A displayLocation() 0 4 1
A observationLocation() 0 4 1
A estimated() 0 4 1
A stationId() 0 4 1
A observationTime() 0 4 1
A observationTimeRfc822() 0 4 1
A observationEpoch() 0 4 1
A localTimeRfc822() 0 4 1
A localEpoch() 0 4 1
A localTzShort() 0 4 1
A localTzLong() 0 4 1
A localTzOffset() 0 4 1
A weather() 0 4 1
A temperatureString() 0 4 1
A tempF() 0 4 1
A tempC() 0 4 1
A relativeHumidity() 0 4 1
A windString() 0 4 1
A windDir() 0 4 1
A windDegrees() 0 4 1
A windMph() 0 4 1
A windGustMph() 0 4 1
A windKph() 0 4 1
A windGustKph() 0 4 1
A pressureMb() 0 4 1
A pressureIn() 0 4 1
A pressureTrend() 0 4 1
A dewpointString() 0 4 1
A dewpointF() 0 4 1
A dewpointC() 0 4 1
A heatIndexString() 0 4 1
A heatIndexF() 0 4 1
A heatIndexC() 0 4 1
A windchillString() 0 4 1
A windchillF() 0 4 1
A windchillC() 0 4 1
A feelslikeString() 0 4 1
A feelslikeF() 0 4 1
A feelslikeC() 0 4 1
A visibilityMi() 0 4 1
A visibilityKm() 0 4 1
A solarradiation() 0 4 1
A uV() 0 4 1
A precip1hrString() 0 4 1
A precip1hrIn() 0 4 1
A precip1hrMetric() 0 4 1
A precipTodayString() 0 4 1
A precipTodayIn() 0 4 1
A precipTodayMetric() 0 4 1
A icon() 0 4 1
A iconUrl() 0 4 1
A forecastUrl() 0 4 1
A historyUrl() 0 4 1
A obUrl() 0 4 1
A nowcast() 0 4 1

How to fix   Complexity   

Complex Class

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

1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\WeatherUnderground\Resource;
4
5
use ApiClients\Foundation\Hydrator\Annotation\EmptyResource;
6
use ApiClients\Foundation\Hydrator\Annotation\Nested;
7
use ApiClients\Foundation\Resource\AbstractResource;
8
9
/**
10
 * @Nested(
11
 *     image="Image",
12
 *     display_location="Location",
13
 *     observation_location="Location"
14
 * )
15
 * @EmptyResource("EmptyCondition")
16
 */
17
abstract class Condition extends AbstractResource implements ConditionInterface
18
{
19
    /**
20
     * @var Image
21
     */
22
    protected $image;
23
24
    /**
25
     * @var Location
26
     */
27
    protected $display_location;
28
29
    /**
30
     * @var Location
31
     */
32
    protected $observation_location;
33
34
    /**
35
     * @var array
36
     */
37
    protected $estimated;
38
39
    /**
40
     * @var string
41
     */
42
    protected $station_id;
43
44
    /**
45
     * @var string
46
     */
47
    protected $observation_time;
48
49
    /**
50
     * @var string
51
     */
52
    protected $observation_time_rfc822;
53
54
    /**
55
     * @var string
56
     */
57
    protected $observation_epoch;
58
59
    /**
60
     * @var string
61
     */
62
    protected $local_time_rfc822;
63
64
    /**
65
     * @var string
66
     */
67
    protected $local_epoch;
68
69
    /**
70
     * @var string
71
     */
72
    protected $local_tz_short;
73
74
    /**
75
     * @var string
76
     */
77
    protected $local_tz_long;
78
79
    /**
80
     * @var string
81
     */
82
    protected $local_tz_offset;
83
84
    /**
85
     * @var string
86
     */
87
    protected $weather;
88
89
    /**
90
     * @var string
91
     */
92
    protected $temperature_string;
93
94
    /**
95
     * @var float
96
     */
97
    protected $temp_f;
98
99
    /**
100
     * @var float
101
     */
102
    protected $temp_c;
103
104
    /**
105
     * @var string
106
     */
107
    protected $relative_humidity;
108
109
    /**
110
     * @var string
111
     */
112
    protected $wind_string;
113
114
    /**
115
     * @var string
116
     */
117
    protected $wind_dir;
118
119
    /**
120
     * @var string
121
     */
122
    protected $wind_degrees;
123
124
    /**
125
     * @var string
126
     */
127
    protected $wind_mph;
128
129
    /**
130
     * @var string
131
     */
132
    protected $wind_gust_mph;
133
134
    /**
135
     * @var string
136
     */
137
    protected $wind_kph;
138
139
    /**
140
     * @var string
141
     */
142
    protected $wind_gust_kph;
143
144
    /**
145
     * @var string
146
     */
147
    protected $pressure_mb;
148
149
    /**
150
     * @var string
151
     */
152
    protected $pressure_in;
153
154
    /**
155
     * @var string
156
     */
157
    protected $pressure_trend;
158
159
    /**
160
     * @var string
161
     */
162
    protected $dewpoint_string;
163
164
    /**
165
     * @var int
166
     */
167
    protected $dewpoint_f;
168
169
    /**
170
     * @var int
171
     */
172
    protected $dewpoint_c;
173
174
    /**
175
     * @var string
176
     */
177
    protected $heat_index_string;
178
179
    /**
180
     * @var string
181
     */
182
    protected $heat_index_f;
183
184
    /**
185
     * @var string
186
     */
187
    protected $heat_index_c;
188
189
    /**
190
     * @var string
191
     */
192
    protected $windchill_string;
193
194
    /**
195
     * @var string
196
     */
197
    protected $windchill_f;
198
199
    /**
200
     * @var string
201
     */
202
    protected $windchill_c;
203
204
    /**
205
     * @var string
206
     */
207
    protected $feelslike_string;
208
209
    /**
210
     * @var string
211
     */
212
    protected $feelslike_f;
213
214
    /**
215
     * @var string
216
     */
217
    protected $feelslike_c;
218
219
    /**
220
     * @var string
221
     */
222
    protected $visibility_mi;
223
224
    /**
225
     * @var string
226
     */
227
    protected $visibility_km;
228
229
    /**
230
     * @var string
231
     */
232
    protected $solarradiation;
233
234
    /**
235
     * @var string
236
     */
237
    protected $UV;
238
239
    /**
240
     * @var string
241
     */
242
    protected $precip_1hr_string;
243
244
    /**
245
     * @var string
246
     */
247
    protected $precip_1hr_in;
248
249
    /**
250
     * @var string
251
     */
252
    protected $precip_1hr_metric;
253
254
    /**
255
     * @var string
256
     */
257
    protected $precip_today_string;
258
259
    /**
260
     * @var string
261
     */
262
    protected $precip_today_in;
263
264
    /**
265
     * @var string
266
     */
267
    protected $precip_today_metric;
268
269
    /**
270
     * @var string
271
     */
272
    protected $icon;
273
274
    /**
275
     * @var string
276
     */
277
    protected $icon_url;
278
279
    /**
280
     * @var string
281
     */
282
    protected $forecast_url;
283
284
    /**
285
     * @var string
286
     */
287
    protected $history_url;
288
289
    /**
290
     * @var string
291
     */
292
    protected $ob_url;
293
294
    /**
295
     * @var string
296
     */
297
    protected $nowcast;
298
299
    /**
300
     * @return Image
301
     */
302
    public function image() : Image
303
    {
304
        return $this->image;
305
    }
306
307
    /**
308
     * @return Location
309
     */
310
    public function displayLocation() : Location
311
    {
312
        return $this->display_location;
313
    }
314
315
    /**
316
     * @return Location
317
     */
318
    public function observationLocation() : Location
319
    {
320
        return $this->observation_location;
321
    }
322
323
    /**
324
     * @return array
325
     */
326
    public function estimated() : array
327
    {
328
        return $this->estimated;
329
    }
330
331
    /**
332
     * @return string
333
     */
334
    public function stationId() : string
335
    {
336
        return $this->station_id;
337
    }
338
339
    /**
340
     * @return string
341
     */
342
    public function observationTime() : string
343
    {
344
        return $this->observation_time;
345
    }
346
347
    /**
348
     * @return string
349
     */
350
    public function observationTimeRfc822() : string
351
    {
352
        return $this->observation_time_rfc822;
353
    }
354
355
    /**
356
     * @return string
357
     */
358
    public function observationEpoch() : string
359
    {
360
        return $this->observation_epoch;
361
    }
362
363
    /**
364
     * @return string
365
     */
366
    public function localTimeRfc822() : string
367
    {
368
        return $this->local_time_rfc822;
369
    }
370
371
    /**
372
     * @return string
373
     */
374
    public function localEpoch() : string
375
    {
376
        return $this->local_epoch;
377
    }
378
379
    /**
380
     * @return string
381
     */
382
    public function localTzShort() : string
383
    {
384
        return $this->local_tz_short;
385
    }
386
387
    /**
388
     * @return string
389
     */
390
    public function localTzLong() : string
391
    {
392
        return $this->local_tz_long;
393
    }
394
395
    /**
396
     * @return string
397
     */
398
    public function localTzOffset() : string
399
    {
400
        return $this->local_tz_offset;
401
    }
402
403
    /**
404
     * @return string
405
     */
406
    public function weather() : string
407
    {
408
        return $this->weather;
409
    }
410
411
    /**
412
     * @return string
413
     */
414
    public function temperatureString() : string
415
    {
416
        return $this->temperature_string;
417
    }
418
419
    /**
420
     * @return float
421
     */
422
    public function tempF() : float
423
    {
424
        return $this->temp_f;
425
    }
426
427
    /**
428
     * @return float
429
     */
430
    public function tempC() : float
431
    {
432
        return $this->temp_c;
433
    }
434
435
    /**
436
     * @return string
437
     */
438
    public function relativeHumidity() : string
439
    {
440
        return $this->relative_humidity;
441
    }
442
443
    /**
444
     * @return string
445
     */
446
    public function windString() : string
447
    {
448
        return $this->wind_string;
449
    }
450
451
    /**
452
     * @return string
453
     */
454
    public function windDir() : string
455
    {
456
        return $this->wind_dir;
457
    }
458
459
    /**
460
     * @return string
461
     */
462
    public function windDegrees() : string
463
    {
464
        return $this->wind_degrees;
465
    }
466
467
    /**
468
     * @return string
469
     */
470
    public function windMph() : string
471
    {
472
        return $this->wind_mph;
473
    }
474
475
    /**
476
     * @return string
477
     */
478
    public function windGustMph() : string
479
    {
480
        return $this->wind_gust_mph;
481
    }
482
483
    /**
484
     * @return string
485
     */
486
    public function windKph() : string
487
    {
488
        return $this->wind_kph;
489
    }
490
491
    /**
492
     * @return string
493
     */
494
    public function windGustKph() : string
495
    {
496
        return $this->wind_gust_kph;
497
    }
498
499
    /**
500
     * @return string
501
     */
502
    public function pressureMb() : string
503
    {
504
        return $this->pressure_mb;
505
    }
506
507
    /**
508
     * @return string
509
     */
510
    public function pressureIn() : string
511
    {
512
        return $this->pressure_in;
513
    }
514
515
    /**
516
     * @return string
517
     */
518
    public function pressureTrend() : string
519
    {
520
        return $this->pressure_trend;
521
    }
522
523
    /**
524
     * @return string
525
     */
526
    public function dewpointString() : string
527
    {
528
        return $this->dewpoint_string;
529
    }
530
531
    /**
532
     * @return int
533
     */
534
    public function dewpointF() : int
535
    {
536
        return $this->dewpoint_f;
537
    }
538
539
    /**
540
     * @return int
541
     */
542
    public function dewpointC() : int
543
    {
544
        return $this->dewpoint_c;
545
    }
546
547
    /**
548
     * @return string
549
     */
550
    public function heatIndexString() : string
551
    {
552
        return $this->heat_index_string;
553
    }
554
555
    /**
556
     * @return string
557
     */
558
    public function heatIndexF() : string
559
    {
560
        return $this->heat_index_f;
561
    }
562
563
    /**
564
     * @return string
565
     */
566
    public function heatIndexC() : string
567
    {
568
        return $this->heat_index_c;
569
    }
570
571
    /**
572
     * @return string
573
     */
574
    public function windchillString() : string
575
    {
576
        return $this->windchill_string;
577
    }
578
579
    /**
580
     * @return string
581
     */
582
    public function windchillF() : string
583
    {
584
        return $this->windchill_f;
585
    }
586
587
    /**
588
     * @return string
589
     */
590
    public function windchillC() : string
591
    {
592
        return $this->windchill_c;
593
    }
594
595
    /**
596
     * @return string
597
     */
598
    public function feelslikeString() : string
599
    {
600
        return $this->feelslike_string;
601
    }
602
603
    /**
604
     * @return string
605
     */
606
    public function feelslikeF() : string
607
    {
608
        return $this->feelslike_f;
609
    }
610
611
    /**
612
     * @return string
613
     */
614
    public function feelslikeC() : string
615
    {
616
        return $this->feelslike_c;
617
    }
618
619
    /**
620
     * @return string
621
     */
622
    public function visibilityMi() : string
623
    {
624
        return $this->visibility_mi;
625
    }
626
627
    /**
628
     * @return string
629
     */
630
    public function visibilityKm() : string
631
    {
632
        return $this->visibility_km;
633
    }
634
635
    /**
636
     * @return string
637
     */
638
    public function solarradiation() : string
639
    {
640
        return $this->solarradiation;
641
    }
642
643
    /**
644
     * @return string
645
     */
646
    public function uV() : string
647
    {
648
        return $this->UV;
649
    }
650
651
    /**
652
     * @return string
653
     */
654
    public function precip1hrString() : string
655
    {
656
        return $this->precip_1hr_string;
657
    }
658
659
    /**
660
     * @return string
661
     */
662
    public function precip1hrIn() : string
663
    {
664
        return $this->precip_1hr_in;
665
    }
666
667
    /**
668
     * @return string
669
     */
670
    public function precip1hrMetric() : string
671
    {
672
        return $this->precip_1hr_metric;
673
    }
674
675
    /**
676
     * @return string
677
     */
678
    public function precipTodayString() : string
679
    {
680
        return $this->precip_today_string;
681
    }
682
683
    /**
684
     * @return string
685
     */
686
    public function precipTodayIn() : string
687
    {
688
        return $this->precip_today_in;
689
    }
690
691
    /**
692
     * @return string
693
     */
694
    public function precipTodayMetric() : string
695
    {
696
        return $this->precip_today_metric;
697
    }
698
699
    /**
700
     * @return string
701
     */
702
    public function icon() : string
703
    {
704
        return $this->icon;
705
    }
706
707
    /**
708
     * @return string
709
     */
710
    public function iconUrl() : string
711
    {
712
        return $this->icon_url;
713
    }
714
715
    /**
716
     * @return string
717
     */
718
    public function forecastUrl() : string
719
    {
720
        return $this->forecast_url;
721
    }
722
723
    /**
724
     * @return string
725
     */
726
    public function historyUrl() : string
727
    {
728
        return $this->history_url;
729
    }
730
731
    /**
732
     * @return string
733
     */
734
    public function obUrl() : string
735
    {
736
        return $this->ob_url;
737
    }
738
739
    /**
740
     * @return string
741
     */
742
    public function nowcast() : string
743
    {
744
        return $this->nowcast;
745
    }
746
}
747