File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,7 @@ private function parseOptions(array $options): array {
55
55
public function validateOptions ($ options ): array {
56
56
['pushResource ' => $ pushResource ] = $ this ->parseOptions ($ options );
57
57
58
- // TODO: check if string is valid URL
59
-
60
- if (isset ($ pushResource ) && $ pushResource !== '' ) {
58
+ if (isset ($ pushResource ) && $ this ->validPushResource ($ pushResource )) {
61
59
return [
62
60
'valid ' => True ,
63
61
'errors ' => [],
@@ -70,6 +68,10 @@ public function validateOptions($options): array {
70
68
}
71
69
}
72
70
71
+ private function validPushResource (string $ url ): bool {
72
+ return (str_starts_with ($ url , 'https:// ' ) && filter_var ($ url , FILTER_VALIDATE_URL ) !== false );
73
+ }
74
+
73
75
public function registerSubscription ($ subsciptionId , $ options ) {
74
76
['pushResource ' => $ pushResource ] = $ this ->parseOptions ($ options );
75
77
You can’t perform that action at this time.
0 commit comments