Skip to content

Commit 0adafd3

Browse files
committed
Merge pull request #42 from npluis/master
Added different temperature types
2 parents 7b712ea + f16bd1a commit 0adafd3

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

Cmfcmf/OpenWeatherMap/Forecast.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(\SimpleXMLElement $xml, $units)
5656

5757
$xml->temperature['value'] = ($xml->temperature['max'] + $xml->temperature['min']) / 2;
5858

59-
$this->temperature = new Temperature(new Unit($xml->temperature['value'], $temperatureUnit), new Unit($xml->temperature['min'], $temperatureUnit), new Unit($xml->temperature['max'], $temperatureUnit));
59+
$this->temperature = new Temperature(new Unit($xml->temperature['value'], $temperatureUnit), new Unit($xml->temperature['min'], $temperatureUnit), new Unit($xml->temperature['max'], $temperatureUnit), new Unit($xml->temperature['day'], $temperatureUnit), new Unit($xml->temperature['morn'], $temperatureUnit),new Unit($xml->temperature['eve'], $temperatureUnit), new Unit($xml->temperature['night'], $temperatureUnit));
6060
$this->humidity = new Unit($xml->humidity['value'], $xml->humidity['unit']);
6161
$this->pressure = new Unit($xml->pressure['value'], $xml->pressure['unit']);
6262

Cmfcmf/OpenWeatherMap/Util/Temperature.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,25 @@ class Temperature
3636
* @var Unit The maximal temperature.
3737
*/
3838
public $max;
39-
39+
/**
40+
* @var Unit The day temperature.
41+
*/
42+
public $day;
43+
44+
/**
45+
* @var Unit The morning temperature.
46+
*/
47+
public $morning;
48+
49+
/**
50+
* @var Unit The evening temperature.
51+
*/
52+
public $evening;
53+
54+
/**
55+
* @var Unit The night temperature.
56+
*/
57+
public $night;
4058
/**
4159
* Returns the current temperature as formatted string.
4260
*
@@ -93,13 +111,22 @@ public function getFormatted()
93111
* @param Unit $now The current temperature.
94112
* @param Unit $min The minimal temperature.
95113
* @param Unit $max The maximal temperature.
114+
* @param Unit day The day temperature.
115+
* @param Unit $morning The morning temperature.
116+
* @param Unit $evening The evening temperature.
117+
* @param Unit $night The night temperature.
96118
*
97119
* @internal
98120
*/
99-
public function __construct(Unit $now, Unit $min, Unit $max)
121+
public function __construct(Unit $now, Unit $min, Unit $max, Unit $day, Unit $morning, Unit $evening, Unit $night)
100122
{
101123
$this->now = $now;
102124
$this->min = $min;
103125
$this->max = $max;
126+
$this->day = $day;
127+
$this->morning = $morning;
128+
$this->evening = $evening;
129+
$this->night = $night;
130+
104131
}
105132
}

0 commit comments

Comments
 (0)