From 4c884be9520890d776ab5e514772129c4ebd3906 Mon Sep 17 00:00:00 2001 From: Jason Rouet <56646501+jaz-on@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:41:42 +0200 Subject: [PATCH] Rewrite get_wind_angle and rename to . Resolves #33 --- includes/traits/DataUnitConversion.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/includes/traits/DataUnitConversion.php b/includes/traits/DataUnitConversion.php index 84f014d..d27a8ee 100644 --- a/includes/traits/DataUnitConversion.php +++ b/includes/traits/DataUnitConversion.php @@ -703,16 +703,19 @@ protected function get_reverse_illuminance($value) } /** - * Get the wind angle expressed in its unique unit. - * - * @param mixed $value The value of the wind angle. - * @return string The wind angle expressed in its unique unit. - * @since 1.0.0 - */ - protected function get_wind_angle($value) + * Get the wind angle expressed in its unique unit. + * + * @param mixed $windAngle The value of the wind angle. (Assumed to be numeric) + * @return string The wind angle expressed in its unique unit. + * @since 1.0.0 + */ + protected function get_wind_angle($windAngle) { - $result = $value; - return sprintf('%d', round($result, 0)); + if (is_numeric()) { + return sprintf('%d', round($windAngle, 0)); + } else { + return 'Invalid input'; + } } /**