Completed
Push — master ( 3abb65...67d89a )
by Christian
17s
created

BaseAirPollution   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php
2
3
/*
4
 * OpenWeatherMap-PHP-API — A PHP API to parse weather data from https://OpenWeatherMap.org.
5
 *
6
 * @license MIT
7
 *
8
 * Please see the LICENSE file distributed with this source code for further
9
 * information regarding copyright and licensing.
10
 *
11
 * Please visit the following links to read about the usage policies and the license of
12
 * OpenWeatherMap data before using this library:
13
 *
14
 * @see https://OpenWeatherMap.org/price
15
 * @see https://OpenWeatherMap.org/terms
16
 * @see https://OpenWeatherMap.org/appid
17
 */
18
19
namespace Cmfcmf\OpenWeatherMap\AirPollution;
20
21
use Cmfcmf\OpenWeatherMap\Util\Location;
22
23
abstract class BaseAirPollution
24
{
25
    /**
26
     * @var \DateTime
27
     */
28
    public $time;
29
30
    /**
31
     * @var Location
32
     */
33
    public $location;
34
35
    /**
36
     * @param object $json
37
     *
38
     * @throws \Exception
39
     * @internal
40
     */
41
    public function __construct($json)
42
    {
43
        $this->time = new \DateTime($json->time, new \DateTimeZone('UTC'));
44
        $this->location = new Location($json->location->latitude, $json->location->longitude);
45
    }
46
}
47