From 29dbc1c65760c6a86990238c9cb9a7c9d24b9178 Mon Sep 17 00:00:00 2001 From: akadko Date: Fri, 21 Apr 2017 13:25:20 +0300 Subject: [PATCH 1/5] Return float values Return float values of latittude, longitude and altitude instead of strings --- src/Passbook/Pass/Location.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Passbook/Pass/Location.php b/src/Passbook/Pass/Location.php index 856f206..c2b22c9 100644 --- a/src/Passbook/Pass/Location.php +++ b/src/Passbook/Pass/Location.php @@ -84,7 +84,7 @@ public function setAltitude($altitude) */ public function getAltitude() { - return $this->altitude; + return floatval($this->altitude); } /** @@ -102,7 +102,7 @@ public function setLatitude($latitude) */ public function getLatitude() { - return $this->latitude; + return floatval($this->latitude); } /** @@ -120,7 +120,7 @@ public function setLongitude($longitude) */ public function getLongitude() { - return $this->longitude; + return floatval($this->longitude); } /** From bc077cedd0ff3b03ede1342c8b4eb885112c58c2 Mon Sep 17 00:00:00 2001 From: akadko Date: Thu, 11 Jan 2018 20:38:58 +0300 Subject: [PATCH 2/5] Fixed --- src/Passbook/Pass/Location.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Passbook/Pass/Location.php b/src/Passbook/Pass/Location.php index c2b22c9..1d4383c 100644 --- a/src/Passbook/Pass/Location.php +++ b/src/Passbook/Pass/Location.php @@ -84,7 +84,7 @@ public function setAltitude($altitude) */ public function getAltitude() { - return floatval($this->altitude); + return $this->altitude !== null ? floatval($this->altitude) : null; } /** @@ -102,7 +102,7 @@ public function setLatitude($latitude) */ public function getLatitude() { - return floatval($this->latitude); + return $this->latitude !== null ? floatval($this->latitude) : null; } /** @@ -120,7 +120,7 @@ public function setLongitude($longitude) */ public function getLongitude() { - return floatval($this->longitude); + return $this-longitude !== null ? floatval($this->longitude) : null; } /** From b6e31bc787ea49ce477bf61b999086db8e7f9680 Mon Sep 17 00:00:00 2001 From: akadko Date: Thu, 11 Jan 2018 20:48:05 +0300 Subject: [PATCH 3/5] Fixed --- src/Passbook/Pass/Location.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Passbook/Pass/Location.php b/src/Passbook/Pass/Location.php index 1d4383c..ce0fb0c 100644 --- a/src/Passbook/Pass/Location.php +++ b/src/Passbook/Pass/Location.php @@ -120,7 +120,7 @@ public function setLongitude($longitude) */ public function getLongitude() { - return $this-longitude !== null ? floatval($this->longitude) : null; + return $this->longitude !== null ? floatval($this->longitude) : null; } /** From aa7c978bf4b27fec4ef925c9d56ce1822c1feba2 Mon Sep 17 00:00:00 2001 From: akadko Date: Thu, 11 Jan 2018 21:42:54 +0300 Subject: [PATCH 4/5] Use is_numeric() instead of comparing with null --- src/Passbook/Pass/Location.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Passbook/Pass/Location.php b/src/Passbook/Pass/Location.php index ce0fb0c..726d70b 100644 --- a/src/Passbook/Pass/Location.php +++ b/src/Passbook/Pass/Location.php @@ -84,7 +84,7 @@ public function setAltitude($altitude) */ public function getAltitude() { - return $this->altitude !== null ? floatval($this->altitude) : null; + return is_numeric($this->altitude) ? floatval($this->altitude) : null; } /** @@ -102,7 +102,7 @@ public function setLatitude($latitude) */ public function getLatitude() { - return $this->latitude !== null ? floatval($this->latitude) : null; + return is_numeric($this->latitude) ? floatval($this->latitude) : null; } /** @@ -120,7 +120,7 @@ public function setLongitude($longitude) */ public function getLongitude() { - return $this->longitude !== null ? floatval($this->longitude) : null; + return is_numeric($this->longitude) ? floatval($this->longitude) : null; } /** From a0780519515969e155c27cc40e1fcc2df8340efb Mon Sep 17 00:00:00 2001 From: akadko Date: Thu, 11 Jan 2018 21:44:58 +0300 Subject: [PATCH 5/5] Fixed --- src/Passbook/Pass/Location.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Passbook/Pass/Location.php b/src/Passbook/Pass/Location.php index 726d70b..72aab2d 100644 --- a/src/Passbook/Pass/Location.php +++ b/src/Passbook/Pass/Location.php @@ -84,7 +84,7 @@ public function setAltitude($altitude) */ public function getAltitude() { - return is_numeric($this->altitude) ? floatval($this->altitude) : null; + return is_numeric($this->altitude) ? floatval($this->altitude) : $this->altitude; } /** @@ -102,7 +102,7 @@ public function setLatitude($latitude) */ public function getLatitude() { - return is_numeric($this->latitude) ? floatval($this->latitude) : null; + return is_numeric($this->latitude) ? floatval($this->latitude) : $this->latitude; } /** @@ -120,7 +120,7 @@ public function setLongitude($longitude) */ public function getLongitude() { - return is_numeric($this->longitude) ? floatval($this->longitude) : null; + return is_numeric($this->longitude) ? floatval($this->longitude) : $this->longitude; } /**