Completed
Pull Request — master (#138)
by Christian
01:27
created

PrecisionPressureValueAirPollution::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 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\Unit;
22
23
class PrecisionPressureValueAirPollution extends BaseAirPollution
24
{
25
26
    /**
27
     * @var object[]
28
     */
29
    public $values;
30
31
    public function __construct($json)
32
    {
33
        parent::__construct($json);
34
35
        $this->values = [];
36
        foreach ($json->data as $data) {
37
            $this->values[] = [
38
                "value" => new Unit($data->value, "g/m³", "", $data->precision),
39
                "pressure" => new Unit($data->pressure, "hPa"),
40
            ];
41
        }
42
    }
43
}
44