@@ 59-71 (lines=13) @@ | ||
56 | } |
|
57 | ||
58 | /** {@inheritdoc} */ |
|
59 | public function parseUrl(string $url): string |
|
60 | { |
|
61 | $parsedUrl = parse_url($url); |
|
62 | parse_str($parsedUrl['query'], $link); |
|
63 | ||
64 | $url = filter_var($link['q'], FILTER_VALIDATE_URL); |
|
65 | // If this is not a valid URL, so the result is (probably) an image, news or video suggestion |
|
66 | if (!$url) { |
|
67 | throw new InvalidResultException(); |
|
68 | } |
|
69 | ||
70 | return $url; |
|
71 | } |
|
72 | ||
73 | /** |
|
74 | * Sends the request to the proxy service that saves the info in session. After this we can redirect |
@@ 29-43 (lines=15) @@ | ||
26 | } |
|
27 | ||
28 | /** {@inheritdoc} */ |
|
29 | public function parseUrl(string $url): string |
|
30 | { |
|
31 | // Separates the url parts |
|
32 | $link = parse_url($url); |
|
33 | // Parses the parameters of the url query |
|
34 | parse_str($link['query'], $link); |
|
35 | ||
36 | $url = filter_var($link['q'], FILTER_VALIDATE_URL); |
|
37 | // If this is not a valid URL, so the result is (probably) an image, news or video suggestion |
|
38 | if (!$url) { |
|
39 | throw new InvalidResultException(); |
|
40 | } |
|
41 | ||
42 | return $url; |
|
43 | } |
|
44 | } |
|
45 |