protected function WeatherHourlyBlock::getWind in Wunderground weather 8
Get the wind speed for a specific hour.
Parameters
\stdClass $hour: The hour for that holds the wind speed variable.
Return value
string The windspeed in bft
File
- src/
Plugin/ Block/ WeatherHourlyBlock.php, line 315 - Contains \Drupal\wunderground_weather\Plugin\Block\WeatherHourlyBlock.
Class
- WeatherHourlyBlock
- Provides a with an hourly weather forecast.
Namespace
Drupal\wunderground_weather\Plugin\BlockCode
protected function getWind(\stdClass $hour) {
$config = $this
->getConfiguration();
$windspeed_scale = $config['windspeed_scale'];
switch ($windspeed_scale) {
case 'mph':
$windspeed = $hour->wspd->english;
break;
case 'kph':
$windspeed = $hour->wspd->metric;
break;
default:
$wind_kph = $hour->wspd->metric;
$windspeed = $this->wundergroundWeatherManager
->windSpeedToBeaufort($wind_kph, 'kph');
break;
}
return $windspeed . ' ' . $windspeed_scale;
}