Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolution #33 & #17 #34

Merged
merged 5 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
/.eslintrc.js export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/readme.md export-ignore
/readme.md export-ignore
20 changes: 5 additions & 15 deletions includes/system/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,25 +723,15 @@ public static function is_updated($old) {
}

/**
* Is the WP update system enabled?
*
* @since 3.1.3
*/
public static function is_updatable() {
$result = true;
if (defined('AUTOMATIC_UPDATER_DISABLED')) {
$result = !AUTOMATIC_UPDATER_DISABLED;
}
return $result;
}

/**
* Is the plugin auto-update enabled?
* Checks if the plugin's auto-update is enabled.
*
* @since 3.1.3
* @return bool Returns true if auto-update is enabled, false otherwise.
*/
public static function is_autoupdatable() {
return (self::is_updatable() && get_option('live_weather_station_auto_update'));
$is_updatable = self::is_updatable();
$auto_update_option = get_option('live_weather_station_auto_update');
return ($is_updatable && $auto_update_option);
}

/**
Expand Down
21 changes: 12 additions & 9 deletions includes/traits/DataUnitConversion.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}

/**
Expand Down