Completed
Push — uv-index ( 9af66d )
by Christian
02:24
created

UVIndex   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 31
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
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\Location;
21
22
/**
23
 * UVIndex class used to hold the uv index for a given date, time and location.
24
 */
25
class UVIndex
26
{
27
    /**
28
     * @var \DateTime
29
     */
30
    public $time;
31
32
    /**
33
     * @var Location
34
     */
35
    public $location;
36
37
    /**
38
     * @var float
39
     */
40
    public $uvIndex;
41
42
    /**
43
     * Create a new current uv index object.
44
     *
45
     * @param object $data
46
     *
47
     * @internal
48
     */
49 2
    public function __construct($data)
50
    {
51 2
        $this->time = new \DateTime($data->time);
52 2
        $this->location = new Location($data->location->longitude, $data->location->latitude);
53 2
        $this->uvIndex = (float)$data->data;
54 2
    }
55
}
56