-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from cmfcmf/uv-index
Add UV Index API support
- Loading branch information
Showing
17 changed files
with
428 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.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 before using this class: | ||
* | ||
* @see http://www.OpenWeatherMap.org | ||
* @see http://www.OpenWeatherMap.org/terms | ||
* @see http://openweathermap.org/appid | ||
*/ | ||
|
||
namespace Cmfcmf\OpenWeatherMap; | ||
|
||
use Cmfcmf\OpenWeatherMap\Util\Location; | ||
|
||
/** | ||
* UVIndex class used to hold the uv index for a given date, time and location. | ||
*/ | ||
class UVIndex | ||
{ | ||
/** | ||
* @var \DateTime | ||
*/ | ||
public $time; | ||
|
||
/** | ||
* @var Location | ||
*/ | ||
public $location; | ||
|
||
/** | ||
* @var float | ||
*/ | ||
public $uvIndex; | ||
|
||
/** | ||
* Create a new current uv index object. | ||
* | ||
* @param object $data | ||
* | ||
* @internal | ||
*/ | ||
public function __construct($data) | ||
{ | ||
$this->time = new \DateTime($data->time); | ||
$this->location = new Location($data->location->latitude, $data->location->longitude); | ||
$this->uvIndex = (float)$data->data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.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 before using this class: | ||
* | ||
* @see http://www.OpenWeatherMap.org | ||
* @see http://www.OpenWeatherMap.org/terms | ||
* @see http://openweathermap.org/appid | ||
*/ | ||
|
||
namespace Cmfcmf\OpenWeatherMap\Util; | ||
|
||
/** | ||
* The city class representing a city object. | ||
*/ | ||
class Location | ||
{ | ||
/** | ||
* @var float The latitude of the city. | ||
*/ | ||
public $lat; | ||
|
||
/** | ||
* @var float The longitude of the city. | ||
*/ | ||
public $lon; | ||
|
||
/** | ||
* Create a new location object. | ||
* | ||
* @param float $lat The latitude of the city. | ||
* @param float $lon The longitude of the city. | ||
* | ||
* @internal | ||
*/ | ||
public function __construct($lat = null, $lon = null) | ||
{ | ||
$this->lat = isset($lat) ? (float)$lat : null; | ||
$this->lon = isset($lon) ? (float)$lon : null; | ||
} | ||
} |
Oops, something went wrong.