-
-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathTemperature.php
More file actions
134 lines (119 loc) · 3.22 KB
/
Temperature.php
File metadata and controls
134 lines (119 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
/*
* OpenWeatherMap-PHP-API — A PHP API to parse weather data from https://OpenWeatherMap.org.
*
* @license MIT
*
* Please see the LICENSE file distributed with this source code for further
* information regarding copyright and licensing.
*
* Please visit the following links to read about the usage policies and the license of
* OpenWeatherMap data before using this library:
*
* @see https://OpenWeatherMap.org/price
* @see https://OpenWeatherMap.org/terms
* @see https://OpenWeatherMap.org/appid
*/
namespace Cmfcmf\OpenWeatherMap\Util;
/**
* The temperature class representing a temperature object.
*/
class Temperature
{
/**
* @var Unit The current temperature.
*/
public $now;
/**
* @var Unit The minimal temperature.
*/
public $min;
/**
* @var Unit The maximal temperature.
*/
public $max;
/**
* @var Unit The day temperature. Might not be null.
*/
public $day;
/**
* @var Unit The morning temperature. Might not be null.
*/
public $morning;
/**
* @var Unit The evening temperature. Might not be null.
*/
public $evening;
/**
* @var Unit The night temperature. Might not be null.
*/
public $night;
/**
* Returns the current temperature as formatted string.
*
* @return string The current temperature as a formatted string.
*/
public function __toString()
{
return $this->now->__toString();
}
/**
* Returns the current temperature's unit.
*
* @return string The current temperature's unit.
*/
public function getUnit()
{
return $this->now->getUnit();
}
/**
* Returns the current temperature.
*
* @return string The current temperature.
*/
public function getValue()
{
return $this->now->getValue();
}
/**
* Returns the current temperature's description.
*
* @return string The current temperature's description.
*/
public function getDescription()
{
return $this->now->getDescription();
}
/**
* Returns the current temperature as formatted string.
*
* @return string The current temperature as formatted string.
*/
public function getFormatted()
{
return $this->now->getFormatted();
}
/**
* Create a new temperature object.
*
* @param Unit $now The current temperature.
* @param Unit $min The minimal temperature.
* @param Unit $max The maximal temperature.
* @param Unit|null $day The day temperature. Might not be null.
* @param Unit|null $morning The morning temperature. Might not be null.
* @param Unit|null $evening The evening temperature. Might not be null.
* @param Unit|null $night The night temperature. Might not be null.
*
* @internal
*/
public function __construct(Unit $now, Unit $min, Unit $max, ?Unit $day = null, ?Unit $morning = null, ?Unit $evening = null, ?Unit $night = null)
{
$this->now = $now;
$this->min = $min;
$this->max = $max;
$this->day = $day;
$this->morning = $morning;
$this->evening = $evening;
$this->night = $night;
}
}