-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update Composer dependencies (PHP 8.1+, PHPUnit 10, Psalm 5) * make PHPUnit data provider methods static * remove obsolete doc blocks * use constructor property promotion * deprecate getter methods * mark constants as final * use arrow functions * code style * throw JsonException when encoding fails * use typed properties * update return types * use public properties instead of deprecated getters * update Psalm config * update README + change log * update docs * update GitHub Actions version matrix * update change log
- Loading branch information
Showing
53 changed files
with
379 additions
and
979 deletions.
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
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 |
---|---|---|
|
@@ -42,17 +42,17 @@ | |
"email" : "[email protected]" | ||
}, | ||
"require": { | ||
"php": "^7.3 || ^8.0" | ||
"php": "^8.1" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Location\\": "src/" | ||
} | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.5", | ||
"vimeo/psalm": "^4.13", | ||
"squizlabs/php_codesniffer": "^3.6" | ||
"phpunit/phpunit": "^10.0", | ||
"vimeo/psalm": "^5.0", | ||
"squizlabs/php_codesniffer": "^3.7" | ||
}, | ||
"scripts": { | ||
"ci:composer-validate": "composer validate --no-check-all --no-check-lock --strict", | ||
|
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
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
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage> | ||
<include> | ||
<directory>src</directory> | ||
</include> | ||
</coverage> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"> | ||
<coverage/> | ||
<testsuites> | ||
<testsuite name="Location Test Suite"> | ||
<directory>tests/Location/</directory> | ||
<directory>tests/Regression/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<source> | ||
<include> | ||
<directory>src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
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 |
---|---|---|
|
@@ -16,8 +16,6 @@ | |
* has done. For more information visit the following URL. | ||
* | ||
* @see http://www.movable-type.co.uk/scripts/latlong-vincenty.html | ||
* | ||
* @author Marcus Jaschen <[email protected]> | ||
*/ | ||
class BearingEllipsoidal implements BearingInterface | ||
{ | ||
|
@@ -28,9 +26,6 @@ class BearingEllipsoidal implements BearingInterface | |
* If the two points share the same location, the bearing | ||
* value will be 0.0. | ||
* | ||
* @param Coordinate $point1 | ||
* @param Coordinate $point2 | ||
* | ||
* @return float Bearing Angle | ||
*/ | ||
public function calculateBearing(Coordinate $point1, Coordinate $point2): float | ||
|
@@ -39,62 +34,46 @@ public function calculateBearing(Coordinate $point1, Coordinate $point2): float | |
return 0.0; | ||
} | ||
|
||
return $this->inverseVincenty($point1, $point2)->getBearingInitial(); | ||
return $this->inverseVincenty($point1, $point2)->bearingInitial; | ||
} | ||
|
||
/** | ||
* Calculates the final bearing between the two points. | ||
* | ||
* @param Coordinate $point1 | ||
* @param Coordinate $point2 | ||
* | ||
* @return float | ||
* @return float Bearing Angle | ||
*/ | ||
public function calculateFinalBearing(Coordinate $point1, Coordinate $point2): float | ||
{ | ||
return $this->inverseVincenty($point1, $point2)->getBearingFinal(); | ||
return $this->inverseVincenty($point1, $point2)->bearingFinal; | ||
} | ||
|
||
/** | ||
* Calculates a destination point for the given point, bearing angle, | ||
* and distance. | ||
* | ||
* @param Coordinate $point | ||
* @param float $bearing the bearing angle between 0 and 360 degrees | ||
* @param float $distance the distance to the destination point in meters | ||
* | ||
* @return Coordinate | ||
*/ | ||
public function calculateDestination(Coordinate $point, float $bearing, float $distance): Coordinate | ||
{ | ||
return $this->directVincenty($point, $bearing, $distance)->getDestination(); | ||
return $this->directVincenty($point, $bearing, $distance)->destination; | ||
} | ||
|
||
/** | ||
* Calculates the final bearing angle for a destination point. | ||
* The method expects a starting point point, the bearing angle, | ||
* and the distance to destination. | ||
* | ||
* @param Coordinate $point | ||
* @param float $bearing | ||
* @param float $distance | ||
* | ||
* @return float | ||
* @return float Bearing Angle | ||
* | ||
* @throws NotConvergingException | ||
*/ | ||
public function calculateDestinationFinalBearing(Coordinate $point, float $bearing, float $distance): float | ||
{ | ||
return $this->directVincenty($point, $bearing, $distance)->getBearingFinal(); | ||
return $this->directVincenty($point, $bearing, $distance)->bearingFinal; | ||
} | ||
|
||
/** | ||
* @param Coordinate $point | ||
* @param float $bearing | ||
* @param float $distance | ||
* | ||
* @return DirectVincentyBearing | ||
* | ||
* @throws NotConvergingException | ||
*/ | ||
private function directVincenty(Coordinate $point, float $bearing, float $distance): DirectVincentyBearing | ||
|
@@ -167,11 +146,6 @@ private function directVincenty(Coordinate $point, float $bearing, float $distan | |
} | ||
|
||
/** | ||
* @param Coordinate $point1 | ||
* @param Coordinate $point2 | ||
* | ||
* @return InverseVincentyBearing | ||
* | ||
* @throws NotConvergingException | ||
*/ | ||
private function inverseVincenty(Coordinate $point1, Coordinate $point2): InverseVincentyBearing | ||
|
Oops, something went wrong.