File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -730,6 +730,25 @@ private static function filterHost(Stringable|string|null $host): ?string
730
730
throw new SyntaxError (sprintf ('Host `%s` is invalid : the IP host is malformed ' , $ host ));
731
731
}
732
732
733
+ /**
734
+ * Tells whether the scheme component is valid
735
+ *
736
+ * @param Stringable|string|null $scheme
737
+ *
738
+ * @return bool
739
+ */
740
+ public static function isScheme (Stringable |string |null $ scheme ): bool
741
+ {
742
+ return null === $ scheme || 1 === preg_match ('/^[A-Za-z]([-A-Za-z\d+.]+)?$/ ' , (string ) $ scheme );
743
+ }
744
+
745
+ /**
746
+ * Tells whether the host component is valid
747
+ *
748
+ * @param Stringable|string|null $host
749
+ *
750
+ * @return bool
751
+ */
733
752
public static function isHost (Stringable |string |null $ host ): bool
734
753
{
735
754
try {
You can’t perform that action at this time.
0 commit comments