]> git.mxchange.org Git - friendica-addons.git/blob - curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Temperature.php
added composer.json and needed libs
[friendica-addons.git] / curweather / vendor / cmfcmf / openweathermap-php-api / Cmfcmf / OpenWeatherMap / Util / Temperature.php
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\Util;
19
20 /**
21  * The temperature class representing a temperature object.
22  */
23 class Temperature
24 {
25     /**
26      * @var Unit The current temperature.
27      */
28     public $now;
29
30     /**
31      * @var Unit The minimal temperature.
32      */
33     public $min;
34
35     /**
36      * @var Unit The maximal temperature.
37      */
38     public $max;
39
40     /**
41      * Returns the current temperature as formatted string.
42      *
43      * @return string The current temperature as a formatted string.
44      */
45     public function __toString()
46     {
47         return $this->now->__toString();
48     }
49
50     /**
51      * Returns the current temperature's unit.
52      *
53      * @return string The current temperature's unit.
54      */
55     public function getUnit()
56     {
57         return $this->now->getUnit();
58     }
59
60     /**
61      * Returns the current temperature.
62      *
63      * @return string The current temperature.
64      */
65     public function getValue()
66     {
67         return $this->now->getValue();
68     }
69
70     /**
71      * Returns the current temperature's description.
72      *
73      * @return string The current temperature's description.
74      */
75     public function getDescription()
76     {
77         return $this->now->getDescription();
78     }
79
80     /**
81      * Returns the current temperature as formatted string.
82      *
83      * @return string The current temperature as formatted string.
84      */
85     public function getFormatted()
86     {
87         return $this->now->getFormatted();
88     }
89
90     /**
91      * Create a new temperature object.
92      *
93      * @param Unit $now The current temperature.
94      * @param Unit $min The minimal temperature.
95      * @param Unit $max The maximal temperature.
96      *
97      * @internal
98      */
99     public function __construct(Unit $now, Unit $min, Unit $max)
100     {
101         $this->now = $now;
102         $this->min = $min;
103         $this->max = $max;
104     }
105 }