Skip to content

Commit 0fac330

Browse files
committed
Improve UriString implementation
1 parent 58f734f commit 0fac330

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

interfaces/UriString.php

+10
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,16 @@ private static function resolvePathAndQuery(array $uri, array $baseUri): array
495495
return [$targetPath, $uri['query']];
496496
}
497497

498+
public static function containsValidRfc3986Characters(Stringable|string $uri): bool
499+
{
500+
return 1 === preg_match('/^(?:[A-Za-z0-9\-._~:\/?#[\]@!$&\'()*+,;=%]|%[0-9A-Fa-f]{2})*$/', (string) $uri);
501+
}
502+
503+
public static function containsValidCharacters(Stringable|string $uri): bool
504+
{
505+
return 1 === preg_match(self::REGEXP_INVALID_URI_CHARS, (string) $uri);
506+
}
507+
498508
/**
499509
* Parse a URI string into its components.
500510
*

0 commit comments

Comments
 (0)