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

History   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 77
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 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\Temperature;
21
use Cmfcmf\OpenWeatherMap\Util\Unit;
22
use Cmfcmf\OpenWeatherMap\Util\Weather;
23
use Cmfcmf\OpenWeatherMap\Util\Wind;
24
25
/**
26
 * Class WeatherHistory.
27
 */
28
class History
29
{
30
    /**
31
     * The city object.
32
     *
33
     * @var Util\City
34
     */
35
    public $city;
36
37
    /**
38
     * The temperature object.
39
     *
40
     * @var Util\Temperature
41
     */
42
    public $temperature;
43
44
    /**
45
     * @var Util\Unit
46
     */
47
    public $humidity;
48
49
    /**
50
     * @var Util\Unit
51
     */
52
    public $pressure;
53
54
    /**
55
     * @var Util\Wind
56
     */
57
    public $wind;
58
59
    /**
60
     * @var Util\Unit
61
     */
62
    public $clouds;
63
64
    /**
65
     * @var Util\Unit
66
     */
67
    public $precipitation;
68
69
    /**
70
     * @var Util\Weather
71
     */
72
    public $weather;
73
74
    /**
75
     * @var \DateTime The time of the history.
76
     */
77
    public $time;
78
79
    /**
80
     * @param $city
81
     * @param $weather
82
     * @param $temperature
83
     * @param $pressure
84
     * @param $humidity
85
     * @param $clouds
86
     * @param $rain
87
     * @param $wind
88
     * @param $time
89
     *
90
     * @internal
91
     */
92 6
    public function __construct($city, $weather, $temperature, $pressure, $humidity, $clouds, $rain, $wind, $time)
93
    {
94 6
        $this->city = $city;
95 6
        $this->weather = new Weather($weather['id'], $weather['description'], $weather['icon']);
96 6
        $this->temperature = new Temperature(new Unit($temperature['now'] - 273.15, "\xB0C"), new Unit($temperature['min'] - 273.15, "\xB0C"), new Unit($temperature['max'] - 273.15, "\xB0C"));
97 6
        $this->pressure = new Unit($pressure, 'kPa');
98 6
        $this->humidity = new Unit($humidity, '%');
99 6
        $this->clouds = new Unit($clouds, '%');
100 6
        $this->precipitation = new Unit($rain['val'], $rain['unit']);
101 6
        $this->wind = new Wind(new Unit($wind['speed']), new Unit($wind['deg']));
102 6
        $this->time = $time;
103 6
    }
104
}
105