Completed
Pull Request — master (#97)
by lee
02:26 queued 14s
created

CurrentUvi   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 27
rs 10
c 1
b 0
f 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
1
<?php
2
/**
3
 * OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
4
 *
5
 * @license MIT
6
 *
7
 * Please see the LICENSE file distributed with this source code for further
8
 * information regarding copyright and licensing.
9
 *
10
 * Please visit the following links to read about the usage policies and the license of
11
 * OpenWeatherMap before using this class:
12
 *
13
 * @see http://www.OpenWeatherMap.org
14
 * @see http://www.OpenWeatherMap.org/terms
15
 * @see http://openweathermap.org/appid
16
 */
17
18
namespace Cmfcmf\OpenWeatherMap;
19
20
use Cmfcmf\OpenWeatherMap\Util\Uvi;
21
22
/**
23
 * Weather class used to hold the current weather data.
24
 */
25
class CurrentUvi
26
{
27
    /**
28
     * The city object.
29
     *
30
     * @var Util\Uvi
31
     */
32
    public $uvi;
33
34
    /**
35
     * Create a new uvi object.
36
     *
37
     * @param mixed  $data
38
     *
39
     * @internal
40
     */
41
    public function __construct($data)
42
    {
43
        // generate the object from response JSON.
44
        // ($time, $latitude, $longitude, $data)
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
45
        if (empty($data->message) && empty($data->code)) {
46
            $this->uvi = new Uvi($data->time, $data->location->latitude, $data->location->longitude, $data->data);
47
        } else {
48
            $this->uvi = null;
49
        }
50
    }
51
}
52