@@ -36,7 +36,7 @@ Get current and forecast (minutely, hourly and daily) weather data.
3636Returns a [ ` OneCall ` ] ( 05-objects.md#onecall ) object:
3737
3838``` php
39- $weather = $openWeatherMap->oneCall->getWeather(50, 50);
39+ $weather = $openWeatherMap->oneCall() ->getWeather(50, 50);
4040
4141echo $weather->getCurrent()->getTemperature();
4242```
@@ -52,7 +52,7 @@ Get weather data from a single moment in the past.
5252Returns a [ ` WeatherLocation ` ] ( 05-objects.md#weatherlocation ) object:
5353
5454``` php
55- $weather = $openWeatherMap->oneCall->getHistoryMoment(50, 50, new \DateTime('2023-01-01 12:00:00'));
55+ $weather = $openWeatherMap->oneCall() ->getHistoryMoment(50, 50, new \DateTime('2023-01-01 12:00:00'));
5656
5757echo $weather->getTemperature();
5858```
@@ -68,7 +68,7 @@ Get aggregated weather data from a single day in the past.
6868Returns a [ ` WeatherAggregate ` ] ( 05-objects.md#weatheraggregate ) object:
6969
7070``` php
71- $weather = $openWeatherMap->oneCall->getHistoryAggregate(50, 50, new \DateTime('1985-07-19'));
71+ $weather = $openWeatherMap->oneCall() ->getHistoryAggregate(50, 50, new \DateTime('1985-07-19'));
7272
7373echo $weather->getTemperature();
7474```
@@ -86,7 +86,7 @@ Get current weather data.
8686Returns a [ ` WeatherLocation ` ] ( 05-objects.md#weatherlocation-1 ) object:
8787
8888``` php
89- $weather = $openWeatherMap->weather->getCurrent(50, 50);
89+ $weather = $openWeatherMap->weather() ->getCurrent(50, 50);
9090
9191echo $weather->getTemperature();
9292```
@@ -104,7 +104,7 @@ Returns a [`WeatherLocationList`](05-objects.md#weatherlocationlist) object:
104104``` php
105105// Since it returns 3-hour steps,
106106// passing 8 as the numResults means it will return results for the next 24 hours
107- $weatherForecast = $openWeatherMap->weather->getForecast(50, 50, 8);
107+ $weatherForecast = $openWeatherMap->weather() ->getForecast(50, 50, 8);
108108
109109foreach ($weatherForecast->getList() as $weather) {
110110 echo $weather->getDateTime()->format('Y-m-d H:i:s');
@@ -125,7 +125,7 @@ Get current air pollution data.
125125Returns a [ ` AirPollutionLocation ` ] ( 05-objects.md#airpollutionlocation ) object:
126126
127127``` php
128- $airPollution = $openWeatherMap->airPollution->getCurrent(50, 50);
128+ $airPollution = $openWeatherMap->airPollution() ->getCurrent(50, 50);
129129
130130echo $airPollution->getAirQuality()->getQualitativeName();
131131echo $airPollution->getCarbonMonoxide();
@@ -142,7 +142,7 @@ Get air pollution forecast data per 1-hour for the next 24 hours.
142142Returns a [ ` AirPollutionLocationList ` ] ( 05-objects.md#airpollutionlocationlist ) object:
143143
144144``` php
145- $airPollutionForecast = $openWeatherMap->airPollution->getForecast(50, 50);
145+ $airPollutionForecast = $openWeatherMap->airPollution() ->getForecast(50, 50);
146146
147147foreach ($airPollutionForecast->getList() as $airPollution) {
148148 echo $airPollution->getDateTime()->format('Y-m-d H:i:s');
@@ -164,7 +164,7 @@ Returns a [`AirPollutionLocationList`](05-objects.md#airpollutionlocationlist) o
164164``` php
165165$startDate = new \DateTime('-7 days'); // 7 days ago
166166$endDate = new \DateTime('-6 days'); // 6 days ago
167- $airPollutionHistory = $openWeatherMap->airPollution->getHistory(50, 50, $startDate, $endDate);
167+ $airPollutionHistory = $openWeatherMap->airPollution() ->getHistory(50, 50, $startDate, $endDate);
168168
169169foreach ($airPollutionHistory->getList() as $airPollution) {
170170 echo $airPollution->getDateTime()->format('Y-m-d H:i:s');
@@ -189,7 +189,7 @@ Get locations data by location name.
189189Returns an array of [ ` Location ` ] ( 05-objects.md#location ) objects:
190190
191191``` php
192- $locations = $openWeatherMap->geocoding->getByLocationName('lisbon');
192+ $locations = $openWeatherMap->geocoding() ->getByLocationName('lisbon');
193193
194194foreach ($locations as $location) {
195195 echo $location->getName();
@@ -208,7 +208,7 @@ Get location data by zip/post code.
208208Returns a [ ` ZipCodeLocation ` ] ( 05-objects.md#zipcodelocation ) object:
209209
210210``` php
211- $location = $openWeatherMap->geocoding->getByZipCode('1000-001', 'pt');
211+ $location = $openWeatherMap->geocoding() ->getByZipCode('1000-001', 'pt');
212212
213213echo $location->getName();
214214```
@@ -227,7 +227,7 @@ Get locations data by coordinate.
227227Returns an array of [ ` Location ` ] ( 05-objects.md#location ) objects:
228228
229229``` php
230- $locations = $openWeatherMap->geocoding->getByCoordinate(50, 50);
230+ $locations = $openWeatherMap->geocoding() ->getByCoordinate(50, 50);
231231
232232foreach ($locations as $location) {
233233 echo $location->getName();
@@ -251,7 +251,7 @@ Only available for [`OneCall`](#one-call) and [`Weather`](#weather) APIs.
251251use ProgrammatorDev\OpenWeatherMap\UnitSystem\UnitSystem;
252252
253253// Uses 'imperial' unit system for this request alone
254- $openWeatherMap->weather
254+ $openWeatherMap->weather()
255255 ->withUnitSystem(UnitSystem::IMPERIAL)
256256 ->getCurrent(50, 50);
257257```
@@ -270,7 +270,7 @@ Only available for [`OneCall`](#one-call) and [`Weather`](#weather) APIs.
270270use ProgrammatorDev\OpenWeatherMap\Language\Language
271271
272272// Uses 'pt' language for this request alone
273- $openWeatherMap->weather
273+ $openWeatherMap->weather()
274274 ->withLanguage(Language::PORTUGUESE)
275275 ->getCurrent(50, 50);
276276```
@@ -296,7 +296,7 @@ Available for all APIs if `cache` is enabled in the [configuration](02-configura
296296use ProgrammatorDev\OpenWeatherMap\Language\Language
297297
298298// Cache will be saved for 1 hour for this request alone
299- $openWeatherMap->weather
299+ $openWeatherMap->weather()
300300 ->withCacheTtl(3600)
301301 ->getCurrent(50, 50);
302302```
0 commit comments