Skip to content

Commit

Permalink
Merge pull request #31 from PhantPHP/Fix-collection
Browse files Browse the repository at this point in the history
Fix collection
  • Loading branch information
lennyrouanet authored Mar 25, 2024
2 parents f51cd4e + bcf5523 commit b2bfde5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion component/Abstract/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 0 additions & 2 deletions component/Abstract/CollectionPaginated.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Phant\DataStructure\Abstract;

use Phant\Error\NotCompliant;

abstract class CollectionPaginated extends Collection
{
private ?int $itemPage;
Expand Down
10 changes: 5 additions & 5 deletions component/Geography/GpsCoordinates.php
Original file line number Diff line number Diff line change
Expand Up @@ -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_))
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions component/Money/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 11 additions & 11 deletions component/Web/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b2bfde5

Please sign in to comment.