Skip to content

Commit

Permalink
Merge pull request #34 from jaz-on/master
Browse files Browse the repository at this point in the history
Resolution #33 & #17
  • Loading branch information
jaz-on committed Aug 8, 2023
2 parents afbc781 + f1fc744 commit 2801495
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
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

0 comments on commit 2801495

Please sign in to comment.