Browse Source
refactor: Make some code a bit more correct
- Use PHP_FLOAT_EPSILON for float comparaison
- Simplify some getValueBool code
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
pull/55631/head
Carl Schwan
2 months ago
No known key found for this signature in database
GPG Key ID: 2325448204E452A
2 changed files with
3 additions and
3 deletions
-
apps/user_ldap/lib/User/DeletedUsersIndex.php
-
apps/weather_status/lib/Service/WeatherStatusService.php
|
|
|
@ -85,6 +85,6 @@ class DeletedUsersIndex { |
|
|
|
} |
|
|
|
|
|
|
|
public function isUserMarked(string $ocName): bool { |
|
|
|
return ($this->userConfig->getValueBool($ocName, 'user_ldap', 'isDeleted', false) === true); |
|
|
|
return $this->userConfig->getValueBool($ocName, 'user_ldap', 'isDeleted'); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -285,8 +285,8 @@ class WeatherStatusService { |
|
|
|
$address = $this->userConfig->getValueString($this->userId, Application::APP_ID, 'address'); |
|
|
|
$mode = $this->userConfig->getValueInt($this->userId, Application::APP_ID, 'mode', self::MODE_MANUAL_LOCATION); |
|
|
|
return [ |
|
|
|
'lat' => $lat === 0.0 ? '' : (string)$lat, |
|
|
|
'lon' => $lon === 0.0 ? '' : (string)$lon, |
|
|
|
'lat' => abs($lat) < PHP_FLOAT_EPSILON ? '' : (string)$lat, |
|
|
|
'lon' => abs($lon) < PHP_FLOAT_EPSILON ? '' : (string)$lon, |
|
|
|
'address' => $address, |
|
|
|
'mode' => $mode, |
|
|
|
]; |
|
|
|
|