-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert SensitiveParameter improved usage
- Loading branch information
Showing
17 changed files
with
85 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
<?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\IPv6; | ||
|
||
use Stringable; | ||
use ValueError; | ||
|
||
use const FILTER_FLAG_IPV6; | ||
use const FILTER_VALIDATE_IP; | ||
|
||
use function filter_var; | ||
use function inet_pton; | ||
use function implode; | ||
use function inet_pton; | ||
use function str_split; | ||
use function strtolower; | ||
use function unpack; | ||
|
||
use const FILTER_FLAG_IPV6; | ||
use const FILTER_VALIDATE_IP; | ||
|
||
final class Converter | ||
{ | ||
/** | ||
|
@@ -40,7 +49,7 @@ public static function expandIp(string $ipAddress): string | |
throw new ValueError('The submitted IP is not a valid IPv6 address.'); | ||
} | ||
|
||
$hex = (array) unpack("H*hex", (string) inet_pton($ipAddress)); | ||
$hex = (array) unpack('H*hex', (string) inet_pton($ipAddress)); | ||
|
||
return implode(':', str_split(strtolower($hex['hex'] ?? ''), 4)); | ||
} | ||
|
@@ -80,7 +89,7 @@ private static function build(array $components): string | |
$components['ipAddress'] ??= null; | ||
$components['zoneIdentifier'] ??= null; | ||
|
||
if (null === $components['ipAddress']){ | ||
if (null === $components['ipAddress']) { | ||
return ''; | ||
} | ||
|
||
|
@@ -97,12 +106,12 @@ private static function build(array $components): string | |
*/ | ||
private static function parse(Stringable|string|null $host): array | ||
{ | ||
if ($host === null) { | ||
if (null === $host) { | ||
return ['ipAddress' => null, 'zoneIdentifier' => null]; | ||
} | ||
|
||
$host = (string) $host; | ||
if ($host === '') { | ||
if ('' === $host) { | ||
return ['ipAddress' => null, 'zoneIdentifier' => null]; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\IPv6; | ||
|
@@ -59,9 +68,9 @@ public function testItFailsToCompressANonIpv6(string $invalidIp): void | |
#[DataProvider('invalidIpv6')] | ||
public function testItFailsToExpandANonIpv6(string $invalidIp): void | ||
{ | ||
$this->expectException(ValueError::class); | ||
$this->expectException(ValueError::class); | ||
|
||
Converter::expandIp($invalidIp); | ||
Converter::expandIp($invalidIp); | ||
} | ||
|
||
public static function invalidIpv6(): iterable | ||
|
Oops, something went wrong.