This repository has been archived by the owner on Dec 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
min / max for lat long values #570
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b9f056d
min / max for lat long values
ShortlyMAB 321204f
min / max for lat long values
ShortlyMAB f13d640
removed number_format
ShortlyMAB 4a764d5
lat, lng converted to randomfloat func
ShortlyMAB c3c586d
localCoordinates() function added
ShortlyMAB File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,20 +104,24 @@ public static function country() | |
} | ||
|
||
/** | ||
* @example 77.147489 | ||
* @example '77.147489' | ||
* @param float|int $min | ||
* @param float|int $max | ||
* @return float Uses signed degrees format (returns a float number between -90 and 90) | ||
*/ | ||
public static function latitude() | ||
public static function latitude($min = -90, $max = 90) | ||
{ | ||
return static::randomFloat(6, 0, 180) - 90; | ||
return floatval(number_format(mt_rand($min * 1000000, $max * 1000000)/1000000, 6)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the interest of converting a float to string (with |
||
} | ||
|
||
/** | ||
* @example 86.211205 | ||
* @example '86.211205' | ||
* @param float|int $min | ||
* @param float|int $max | ||
* @return float Uses signed degrees format (returns a float number between -180 and 180) | ||
*/ | ||
public static function longitude() | ||
public static function longitude($min = -180, $max = 180) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're changing the results of existing calls. Please use 0 and 360 as min and max values. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disregard. |
||
{ | ||
return static::randomFloat(6, 0, 360) - 180; | ||
return floatval(number_format(mt_rand($min * 1000000, $max * 1000000)/1000000, 6)); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're changing the results of existing calls. Please use 0 and 180 as min and max values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He isn't. Look again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, you're right.