From 4c4f43092d90797941298c6171eb87afdac94cda Mon Sep 17 00:00:00 2001 From: Stefan Bauer Date: Sat, 6 Oct 2018 21:42:17 +0200 Subject: [PATCH] remove url validation as it's not necessary --- src/FaviconExtractor.php | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/FaviconExtractor.php b/src/FaviconExtractor.php index 08a454b..83fa534 100644 --- a/src/FaviconExtractor.php +++ b/src/FaviconExtractor.php @@ -29,10 +29,6 @@ public function __construct(FaviconFactoryInterface $faviconFactory, ProviderInt public function fromUrl(string $url): FaviconExtractorInterface { - if (!$this->isValidUrl($url)) { - throw new InvalidUrlException(); - } - $this->url = $url; return $this; @@ -75,20 +71,4 @@ private function getTargetPath(string $path, string $filename): string { return $path.DIRECTORY_SEPARATOR.$filename.'.png'; } - - private function isValidUrl(string $url): bool - { - $pattern = '/^ - (http|https):\\/\\/ - ( - [a-z0-9]+([\\-\\.]{1}[a-z_0-9]+)*\\.[a-z]{2,5} - | - (([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]) - ) - (:[0-9]+)? - (\\/.*)? - $/ixu'; - - return preg_match($pattern, $url) > 0; - } }