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 {
5555 public function validateOptions ($ options ): array {
5656 ['pushResource ' => $ pushResource ] = $ this ->parseOptions ($ options );
5757
58- // TODO: check if string is valid URL
59-
60- if (isset ($ pushResource ) && $ pushResource !== '' ) {
58+ if (isset ($ pushResource ) && $ this ->validPushResource ($ pushResource )) {
6159 return [
6260 'valid ' => True ,
6361 'errors ' => [],
@@ -70,6 +68,10 @@ public function validateOptions($options): array {
7068 }
7169 }
7270
71+ private function validPushResource (string $ url ): bool {
72+ return (str_starts_with ($ url , 'https:// ' ) && filter_var ($ url , FILTER_VALIDATE_URL ) !== false );
73+ }
74+
7375 public function registerSubscription ($ subsciptionId , $ options ) {
7476 ['pushResource ' => $ pushResource ] = $ this ->parseOptions ($ options );
7577
You can’t perform that action at this time.
0 commit comments