-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHourData.php
More file actions
46 lines (34 loc) · 1.01 KB
/
HourData.php
File metadata and controls
46 lines (34 loc) · 1.01 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
<?php
namespace ProgrammatorDev\OpenWeatherMap\Entity\OneCall;
use ProgrammatorDev\OpenWeatherMap\Entity\BaseWeather;
class HourData extends BaseWeather
{
private float $temperature;
private float $temperatureFeelsLike;
private ?int $visibility;
private int $precipitationProbability;
public function __construct(array $data)
{
parent::__construct($data);
$this->temperature = $data['temp'];
$this->temperatureFeelsLike = $data['feels_like'];
$this->visibility = $data['visibility'] ?? null;
$this->precipitationProbability = round($data['pop'] * 100);
}
public function getTemperature(): float
{
return $this->temperature;
}
public function getTemperatureFeelsLike(): float
{
return $this->temperatureFeelsLike;
}
public function getVisibility(): ?int
{
return $this->visibility;
}
public function getPrecipitationProbability(): int
{
return $this->precipitationProbability;
}
}