1+ <?php
2+
3+ namespace ProgrammatorDev \OpenWeatherMap \Entity \Assistant ;
4+
5+ use ProgrammatorDev \OpenWeatherMap \Entity \BaseWeather ;
6+
7+ class WeatherData extends BaseWeather
8+ {
9+ private string $ locationName ;
10+
11+ private float $ temperature ;
12+
13+ private float $ temperatureFeelsLike ;
14+
15+ private int $ visibility ;
16+
17+ private \DateTimeImmutable $ sunriseAt ;
18+
19+ private \DateTimeImmutable $ sunsetAt ;
20+
21+ public function __construct (string $ location , array $ data )
22+ {
23+ parent ::__construct ($ data );
24+
25+ $ this ->locationName = $ location ;
26+ $ this ->temperature = $ data ['temp ' ];
27+ $ this ->temperatureFeelsLike = $ data ['feels_like ' ];
28+ $ this ->visibility = $ data ['visibility ' ];
29+ $ this ->sunriseAt = \DateTimeImmutable::createFromFormat ('U ' , $ data ['sunrise ' ]);
30+ $ this ->sunsetAt = \DateTimeImmutable::createFromFormat ('U ' , $ data ['sunset ' ]);
31+ }
32+
33+ public function getLocationName (): string
34+ {
35+ return $ this ->locationName ;
36+ }
37+
38+ public function getTemperature (): float
39+ {
40+ return $ this ->temperature ;
41+ }
42+
43+ public function getTemperatureFeelsLike (): float
44+ {
45+ return $ this ->temperatureFeelsLike ;
46+ }
47+
48+ public function getVisibility (): int
49+ {
50+ return $ this ->visibility ;
51+ }
52+
53+ public function getSunriseAt (): \DateTimeImmutable
54+ {
55+ return $ this ->sunriseAt ;
56+ }
57+
58+ public function getSunsetAt (): \DateTimeImmutable
59+ {
60+ return $ this ->sunsetAt ;
61+ }
62+ }
0 commit comments