From 7b2ed5b067cad262bfd59d59c191319250a45b2b Mon Sep 17 00:00:00 2001 From: Lenny ROUANET Date: Mon, 25 Mar 2024 12:39:50 +0100 Subject: [PATCH 1/2] Fix collection item already exist --- component/Abstract/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/component/Abstract/Collection.php b/component/Abstract/Collection.php index 276b673..784bca8 100644 --- a/component/Abstract/Collection.php +++ b/component/Abstract/Collection.php @@ -15,7 +15,7 @@ public function __construct() protected function addItem(mixed $item): self { - if (array_search($item, $this->items) == false) { + if (array_search($item, $this->items) === false) { $this->items[] = $item; } From bcf55235a6fe4ea86bae15b38af196210eb3be87 Mon Sep 17 00:00:00 2001 From: Lenny ROUANET Date: Mon, 25 Mar 2024 12:40:50 +0100 Subject: [PATCH 2/2] CS --- component/Abstract/CollectionPaginated.php | 2 -- component/Geography/GpsCoordinates.php | 10 +++++----- component/Money/Price.php | 4 ++-- component/Web/Url.php | 22 +++++++++++----------- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/component/Abstract/CollectionPaginated.php b/component/Abstract/CollectionPaginated.php index 4822997..4d97044 100644 --- a/component/Abstract/CollectionPaginated.php +++ b/component/Abstract/CollectionPaginated.php @@ -4,8 +4,6 @@ namespace Phant\DataStructure\Abstract; -use Phant\Error\NotCompliant; - abstract class CollectionPaginated extends Collection { private ?int $itemPage; diff --git a/component/Geography/GpsCoordinates.php b/component/Geography/GpsCoordinates.php index cdd1770..50fb8d7 100644 --- a/component/Geography/GpsCoordinates.php +++ b/component/Geography/GpsCoordinates.php @@ -86,11 +86,11 @@ public static function makeFromUtm(float $x, float $y, int $zone, bool $southern $UTMScaleFactor = 0.9996; $sm_EccSquared = .00669437999013; $n = ($sm_a - $sm_b) / ($sm_a + $sm_b); - $alpha_ = (($sm_a + $sm_b) / 2.0)* (1 + (pow($n, 2.0) / 4) + (pow($n, 4.0) / 64)); + $alpha_ = (($sm_a + $sm_b) / 2.0) * (1 + (pow($n, 2.0) / 4) + (pow($n, 4.0) / 64)); $y_ = $y / $alpha_; - $beta_ = (3.0 * $n / 2.0) + (-27.0 * pow($n, 3.0) / 32.0)+ (269.0 * pow($n, 5.0) / 512.0); - $gamma_ = (21.0 * pow($n, 2.0) / 16.0)+ (-55.0 * pow($n, 4.0) / 32.0); - $delta_ = (151.0 * pow($n, 3.0) / 96.0)+ (-417.0 * pow($n, 5.0) / 128.0); + $beta_ = (3.0 * $n / 2.0) + (-27.0 * pow($n, 3.0) / 32.0) + (269.0 * pow($n, 5.0) / 512.0); + $gamma_ = (21.0 * pow($n, 2.0) / 16.0) + (-55.0 * pow($n, 4.0) / 32.0); + $delta_ = (151.0 * pow($n, 3.0) / 96.0) + (-417.0 * pow($n, 5.0) / 128.0); $epsilon_ = (1097.0 * pow($n, 4.0) / 512.0); $result = $y_ + ($beta_ * sin(2.0 * $y_)) + ($gamma_ * sin(4.0 * $y_)) @@ -145,7 +145,7 @@ public static function makeFromUtm(float $x, float $y, int $zone, bool $southern $x8frac = $tf / (40320.0 * $Nfpow); $x2poly = -1.0 - $nuf2; $x3poly = -1.0 - 2 * $tf2 - $nuf2; - $x4poly = 5.0 + 3.0 * $tf2 + 6.0 * $nuf2 - 6.0 * $tf2 * $nuf2- 3.0 * ($nuf2 *$nuf2) - 9.0 * $tf2 * ($nuf2 * $nuf2); + $x4poly = 5.0 + 3.0 * $tf2 + 6.0 * $nuf2 - 6.0 * $tf2 * $nuf2 - 3.0 * ($nuf2 * $nuf2) - 9.0 * $tf2 * ($nuf2 * $nuf2); $x5poly = 5.0 + 28.0 * $tf2 + 24.0 * $tf4 + 6.0 * $nuf2 + 8.0 * $tf2 * $nuf2; $x6poly = -61.0 - 90.0 * $tf2 - 45.0 * $tf4 - 107.0 * $nuf2 + 162.0 * $tf2 * $nuf2; $x7poly = -61.0 - 662.0 * $tf2 - 1320.0 * $tf4 - 720.0 * ($tf4 * $tf2); diff --git a/component/Money/Price.php b/component/Money/Price.php index 2b14e82..422442d 100644 --- a/component/Money/Price.php +++ b/component/Money/Price.php @@ -25,11 +25,11 @@ public function getFormatted(bool $espaceInsecable = true): string $price = number_format($this->amount, 2, ',', ' '); if ($this->currency) { - $price.= ' ' . $this->currency->getLabel(); + $price .= ' ' . $this->currency->getLabel(); } if ($this->unit) { - $price.= '/' . $this->unit; + $price .= '/' . $this->unit; } if ($espaceInsecable) { diff --git a/component/Web/Url.php b/component/Web/Url.php index f54c02a..2e2acf4 100644 --- a/component/Web/Url.php +++ b/component/Web/Url.php @@ -197,35 +197,35 @@ public static function compose(self $url): self { $urlString = ''; - $urlString.= $url->getScheme(); + $urlString .= $url->getScheme(); - $urlString.= '://'; + $urlString .= '://'; if ($url->getUser()) { - $urlString.= $url->getUser(); + $urlString .= $url->getUser(); if ($url->getPass()) { - $urlString.= ':'; - $urlString.= $url->getPass(); + $urlString .= ':'; + $urlString .= $url->getPass(); } - $urlString.= '@'; + $urlString .= '@'; } - $urlString.= $url->getHost(); + $urlString .= $url->getHost(); if ($url->getPort()) { - $urlString.= ':' . $url->getPort(); + $urlString .= ':' . $url->getPort(); } if ($url->getPath()) { - $urlString.= $url->getPath(); + $urlString .= $url->getPath(); } if ($url->getQuery()) { - $urlString.= '?' . http_build_query($url->getQuery()); + $urlString .= '?' . http_build_query($url->getQuery()); } if ($url->getFragment()) { - $urlString.= '#' . $url->getFragment(); + $urlString .= '#' . $url->getFragment(); } return new self($urlString);