Skip to content

Commit fd3b159

Browse files
committed
docs: updated air pollution related info
1 parent 70b8f59 commit fd3b159

File tree

2 files changed

+25
-37
lines changed

2 files changed

+25
-37
lines changed

docs/03-supported-apis.md

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -110,60 +110,47 @@ $weatherForecast = $api->weather()->getForecast(50, 50, 8);
110110
#### `getCurrent`
111111

112112
```php
113-
getCurrent(float $latitude, float $longitude): AirPollutionLocation
113+
getCurrent(float $latitude, float $longitude): AirPollution
114114
```
115115

116116
Get current air pollution data.
117117

118-
Returns a [`AirPollutionLocation`](05-entities.md#airpollutionlocation) object:
118+
Returns a [`AirPollution`](05-entities.md#airpollution) object:
119119

120120
```php
121-
$airPollution = $openWeatherMap->airPollution()->getCurrent(50, 50);
122-
123-
echo $airPollution->getAirQuality()->getQualitativeName();
124-
echo $airPollution->getCarbonMonoxide();
121+
$currentAirPollution = $api->airPollution()->getCurrent(50, 50);
125122
```
126123

127124
#### `getForecast`
128125

129126
```php
130-
getForecast(float $latitude, float $longitude): AirPollutionLocationList
127+
getForecast(float $latitude, float $longitude): AirPollutionCollection
131128
```
132129

133-
Get air pollution forecast data per 1-hour for the next 24 hours.
130+
Get air pollution forecast data per hour.
134131

135-
Returns a [`AirPollutionLocationList`](05-entities.md#airpollutionlocationlist) object:
132+
Returns a [`AirPollutionCollection`](05-entities.md#airpollutioncollection) object:
136133

137134
```php
138-
$airPollutionForecast = $openWeatherMap->airPollution()->getForecast(50, 50);
139-
140-
foreach ($airPollutionForecast->getList() as $airPollution) {
141-
echo $airPollution->getDateTime()->format('Y-m-d H:i:s');
142-
echo $airPollution->getAirQuality()->getQualitativeName();
143-
echo $airPollution->getCarbonMonoxide();
144-
}
135+
$airPollutionForecast = $api->airPollution()->getForecast(50, 50);
145136
```
146137

147138
#### `getHistory`
148139

149140
```php
150-
getHistory(float $latitude, float $longitude, \DateTimeInterface $startDate, \DateTimeInterface $endDate): AirPollutionLocationList
141+
getHistory(float $latitude, float $longitude, \DateTimeInterface $startDate, \DateTimeInterface $endDate): AirPollutionCollection
151142
```
152143

153-
Get air pollution history data between two dates.
144+
Get air pollution history data per hour between two dates.
154145

155-
Returns a [`AirPollutionLocationList`](05-entities.md#airpollutionlocationlist) object:
146+
Returns a [`AirPollutionCollection`](05-entities.md#airpollutioncollection) object:
156147

157148
```php
158-
$startDate = new \DateTime('-7 days'); // 7 days ago
159-
$endDate = new \DateTime('-6 days'); // 6 days ago
160-
$airPollutionHistory = $openWeatherMap->airPollution()->getHistory(50, 50, $startDate, $endDate);
161-
162-
foreach ($airPollutionHistory->getList() as $airPollution) {
163-
echo $airPollution->getDateTime()->format('Y-m-d H:i:s');
164-
echo $airPollution->getAirQuality()->getQualitativeName();
165-
echo $airPollution->getCarbonMonoxide();
166-
}
149+
$startDate = new \DateTime('-1 day');
150+
$endDate = new \DateTime('now');
151+
152+
// returns air pollution data for the last 24 hours
153+
$airPollutionHistory = $api->airPollution()->getHistory(50, 50, $startDate, $endDate);
167154
```
168155

169156
### Geocoding
@@ -210,7 +197,7 @@ getByZipCode(string $zipCode, string $countryCode): ZipLocation
210197

211198
Get location by zip code.
212199

213-
Returns a [`ZipLocation`](05-entities.md#ziplocation) entity.
200+
Returns a [`ZipLocation`](05-entities.md#ziplocation) object.
214201

215202
```php
216203
$location = $api->geocoding()->getByZipCode('1000-001', 'pt');

docs/05-entities.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
- [WeatherData](#weatherdata)
1414
- [Air Pollution](#air-pollution)
1515
- [AirPollution](#airpollution)
16-
- [AirPollutionLocation](#airpollutionlocation)
17-
- [AirPollutionLocationList](#airpollutionlocationlist)
16+
- [AirPollutionCollection](#airpollutioncollection)
17+
- [AirPollutionData](#airpollutiondata)
1818
- [AirQuality](#airquality)
1919
- [Geocoding](#geocoding)
2020
- [ZipLocation](#ziplocation)
@@ -161,6 +161,7 @@
161161

162162
### AirPollution
163163

164+
- `getCoordinate()`: [`Coordinate`](#coordinate)
164165
- `getDateTime()`: `\DateTimeImmutable`
165166
- `getAirQuality`: [`AirQuality`](#airquality)
166167
- `getCarbonMonoxide()`: `float`
@@ -172,9 +173,14 @@
172173
- `getCoarseParticulateMatter()`: `float`
173174
- `getAmmonia()`: `float`
174175

175-
### AirPollutionLocation
176+
### AirPollutionCollection
176177

178+
- `getNumResults()`: `int`
177179
- `getCoordinate()`: [`Coordinate`](#coordinate)
180+
- `getData()`: [`AirPollutionData[]`](#airpollutiondata)
181+
182+
### AirPollutionData
183+
178184
- `getDateTime()`: `\DateTimeImmutable`
179185
- `getAirQuality`: [`AirQuality`](#airquality)
180186
- `getCarbonMonoxide()`: `float`
@@ -186,11 +192,6 @@
186192
- `getCoarseParticulateMatter()`: `float`
187193
- `getAmmonia()`: `float`
188194

189-
### AirPollutionLocationList
190-
191-
- `getCoordinate()`: [`Coordinate`](#coordinate)
192-
- `getList()`: [`AirPollution[]`](#airpollution)
193-
194195
### AirQuality
195196

196197
- `getIndex()`: `int`

0 commit comments

Comments
 (0)