Skip to content

Commit 1a6205f

Browse files
committed
docs: add weather overview docs
1 parent 3c174ad commit 1a6205f

File tree

8 files changed

+30
-7
lines changed

8 files changed

+30
-7
lines changed

docs/03-supported-apis.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [getWeather](#getweather)
66
- [getWeatherByDate](#getweatherbydate)
77
- [getWeatherSummaryByDate](#getweathersummarybydate)
8+
- [getWeatherOverviewByDate](#getweatheroverviewbydate)
89
- [Weather](#weather)
910
- [getCurrent](#getcurrent)
1011
- [getForecast](#getforecast)
@@ -68,6 +69,21 @@ Returns a [`WeatherSummary`](05-entities.md#weathersummary) object:
6869
$weatherSummary = $api->oneCall()->getWeatherSummaryByDate(50, 50, new \DateTime('1985-07-19'));
6970
```
7071

72+
#### `getWeatherOverviewByDate`
73+
74+
```php
75+
getWeatherOverviewByDate(float $latitude, float $longitude, \DateTimeInterface $date): WeatherOverview
76+
```
77+
78+
Get the weather overview with a human-readable summary for today and tomorrow's forecast,
79+
using OpenWeather AI.
80+
81+
Returns a [`WeatherOverview`](05-entities.md#weatheroverview) object:
82+
83+
```php
84+
$weatherOverview = $api->oneCall()->getWeatherOverviewByDate(50, 50, new \DateTime('today'));
85+
```
86+
7187
### Weather
7288

7389
#### `getCurrent`

docs/05-entities.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@
7878
- `getAtmosphericPressure()`: `int`
7979
- `getWind()`: [`Wind`](#wind)
8080

81+
### WeatherOverview
82+
83+
- `getCoordinate()`: [`Coordinate`](#coordinate)
84+
- `getTimezone()`: [`Timezone`](#timezone)
85+
- `getDateTime()`: `\DateTimeImmutable`
86+
- `getOverview()`: `string`
87+
8188
### WeatherData
8289

8390
- `getDateTime()`: `\DateTimeImmutable`

src/Entity/AirPollution/AirPollutionCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AirPollutionCollection
1818

1919
public function __construct(array $data)
2020
{
21-
$this->numResults = \count($data['list']);
21+
$this->numResults = count($data['list']);
2222
$this->coordinate = new Coordinate($data['coord']);
2323
$this->data = $this->createEntityList(AirPollutionData::class, $data['list']);
2424
}

src/Entity/AirPollution/AirQuality.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ private function findQualitativeName(int $index): string
2828
{
2929
// levels based on https://openweathermap.org/api/air-pollution
3030
return match ($index) {
31-
0 => 'Undefined',
3231
1 => 'Good',
3332
2 => 'Fair',
3433
3 => 'Moderate',
3534
4 => 'Poor',
36-
5 => 'Very Poor'
35+
5 => 'Very Poor',
36+
default => 'Undefined'
3737
};
3838
}
3939
}

src/Entity/OneCall/DayData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(array $data)
2828

2929
$this->temperature = new Temperature($data['temp']);
3030
$this->temperatureFeelsLike = new Temperature($data['feels_like']);
31-
$this->precipitationProbability = \round($data['pop'] * 100);
31+
$this->precipitationProbability = round($data['pop'] * 100);
3232
$this->summary = $data['summary'];
3333
$this->moonPhase = new MoonPhase($data);
3434
$this->moonriseAt = \DateTimeImmutable::createFromFormat('U', $data['moonrise']);

src/Entity/OneCall/HourData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(array $data)
1919
$this->temperature = $data['temp'];
2020
$this->temperatureFeelsLike = $data['feels_like'];
2121
$this->visibility = $data['visibility'];
22-
$this->precipitationProbability = \round($data['pop'] * 100);
22+
$this->precipitationProbability = round($data['pop'] * 100);
2323
}
2424

2525
public function getTemperature(): float

src/Entity/OneCall/MoonPhase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct(array $data)
2323
{
2424
$this->value = $data['moon_phase'];
2525
$this->systemName = $this->findSystemName($this->value);
26-
$this->name = \ucwords(\strtolower(\str_replace('_', ' ', $this->systemName)));
26+
$this->name = ucwords(strtolower(str_replace('_', ' ', $this->systemName)));
2727
}
2828

2929
public function getValue(): float

src/Entity/Weather/WeatherData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(array $data)
5454
$this->wind = new Wind($data['wind']);
5555

5656
$this->precipitationProbability = isset($data['pop'])
57-
? \round($data['pop'] * 100)
57+
? round($data['pop'] * 100)
5858
: null;
5959

6060
$this->rainVolume = $data['rain']['1h'] ?? $data['rain']['3h'] ?? null;

0 commit comments

Comments
 (0)