Skip to content

Commit

Permalink
Improve implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Dec 24, 2024
1 parent 3a59b2d commit a592919
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion components/Components/URLSearchParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Deprecated;
use Iterator;
use IteratorAggregate;
use League\Uri\Contracts\Conditionable;
use League\Uri\Contracts\QueryInterface;
use League\Uri\Contracts\UriComponentInterface;
use League\Uri\Contracts\UriException;
Expand Down
9 changes: 9 additions & 0 deletions interfaces/Contracts/Conditionable.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/**
* League.Uri (https://uri.thephpleague.com)
*
* (c) Ignace Nyamagana Butera <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace League\Uri\Contracts;
Expand Down
5 changes: 2 additions & 3 deletions uri/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
use function base64_decode;
use function base64_encode;
use function count;
use function dd;
use function end;
use function explode;
use function file_get_contents;
Expand Down Expand Up @@ -1338,11 +1337,11 @@ public function isCrossOrigin(UriInterface|Stringable|string $uri): bool
$uri = self::tryNew($uri);
}

if (null === $uri?->getOrigin()) {
if (null === $uri || null === ($origin = $uri->getOrigin())) {
return true;
}

return $this->origin !== (string) $this->getOrigin();
return $this->origin !== (string) $origin;
}

public function isSameOrigin(Stringable|string $uri): bool
Expand Down

0 comments on commit a592919

Please sign in to comment.