diff --git a/src/Interfaces/GeoInterface.php b/src/Interfaces/GeoInterface.php index 6def1f4..ea5f5e1 100644 --- a/src/Interfaces/GeoInterface.php +++ b/src/Interfaces/GeoInterface.php @@ -26,10 +26,9 @@ public function getDistance(); public function getCenter(); /** - * clear all stored results. - * - * @return GeoInterface + * clear all stored results * + * @return GeoInterface * @author karam mustafa */ public function clearResult(); diff --git a/src/Traits/DataStorage.php b/src/Traits/DataStorage.php index 6150979..00b0372 100644 --- a/src/Traits/DataStorage.php +++ b/src/Traits/DataStorage.php @@ -44,10 +44,10 @@ trait DataStorage */ private $units = [ 'mile' => 1, - 'km' => 1.609344, - 'm' => (1.609344 * 1000), - 'cm' => (1.609344 * 100), - 'mm' => (1.609344 * 1000 * 1000), + 'km' => 1.609344, + 'm' => (1.609344 * 1000), + 'cm' => (1.609344 * 100), + 'mm' => (1.609344 * 1000 * 1000), ]; /** * for develop and resolve any options. @@ -71,7 +71,7 @@ public function getUnits() } /** - * @param array $units + * @param array $units * * @return DataStorage * @@ -85,7 +85,7 @@ public function setUnits($units) } /** - * @param mixed $key + * @param mixed $key * * @return array * @@ -99,7 +99,7 @@ public function getOptions($key = null) } /** - * @param array $options + * @param array $options * * @return DataStorage * @@ -113,7 +113,7 @@ public function setOptions($options) } /** - * @param null $index + * @param null $index * * @return array * @@ -141,7 +141,7 @@ public function setPoint($point) } /** - * @param array $points + * @param array $points * * @return DataStorage * @@ -165,8 +165,9 @@ public function getResult() } /** - * @param mixed $result - * @param bool $force + * @param mixed $result + * + * @param bool $force * * @return DataStorage * @@ -192,7 +193,7 @@ public function clearStoredResults() } /** - * @param string $key + * @param string $key * * @return mixed * @@ -206,8 +207,8 @@ public function getFromStorage($key = null) } /** - * @param string $key - * @param mixed $value + * @param string $key + * @param mixed $value * * @return DataStorage * @@ -233,7 +234,7 @@ public function clearStorage() } /** - * @param mixed $keys + * @param mixed $keys * * @return DataStorage * diff --git a/src/Traits/Distances.php b/src/Traits/Distances.php index c445504..d44b64f 100644 --- a/src/Traits/Distances.php +++ b/src/Traits/Distances.php @@ -192,14 +192,11 @@ private function getValueForAngleBetween() */ private function calcDistance() { - $this->setInStorage( - 'distance', + $this->setInStorage('distance', acos($this->getSin() + $this->getCos() * $this->getValueForAngleBetween()) - )->setInStorage( - 'rad2deg', + )->setInStorage('rad2deg', rad2deg($this->getFromStorage('distance')) - )->setInStorage( - 'correctDistanceValue', + )->setInStorage('correctDistanceValue', $this->correctDistanceValue($this->getFromStorage('rad2deg')) ); @@ -249,10 +246,11 @@ private function resolveDistanceWithUnits($distance) // remove un required results and get the results from storage. return $this ->removeFromStorage('position', 'distance_key') - ->removeFromStorage('distance', 'rad2deg', 'correctDistanceValue') + ->removeFromStorage('distance' , 'rad2deg' , 'correctDistanceValue') ->getFromStorage(); } + /** * check if user chose any units. * diff --git a/tests/Feature/AreasTest.php b/tests/Feature/AreasTest.php index 566ebb0..e0a3478 100644 --- a/tests/Feature/AreasTest.php +++ b/tests/Feature/AreasTest.php @@ -21,7 +21,7 @@ public function test_center() ->getCenter(); $this->assertEquals([ - 'lat' => 27.508023496931, + 'lat' => 27.508023496931, 'long' => 38.424795502212, ], $result); }