From: Louis Jeckel Date: Thu, 27 Aug 2020 17:14:21 +0000 (+0200) Subject: Update GetPageTitleFromUrl.php X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=cb90949581a1d365f5647da9f8aa5c4016e23428;p=psq.git Update GetPageTitleFromUrl.php --- diff --git a/app/Invokables/GetPageTitleFromUrl.php b/app/Invokables/GetPageTitleFromUrl.php index 51fbb87..bf38881 100644 --- a/app/Invokables/GetPageTitleFromUrl.php +++ b/app/Invokables/GetPageTitleFromUrl.php @@ -9,7 +9,6 @@ class GetPageTitleFromUrl public function __invoke($url): string { - $unknown = "Titre inconnu"; $context = stream_context_create( [ "http" => [ @@ -22,10 +21,10 @@ class GetPageTitleFromUrl if($str !== ''){ $str = trim(preg_replace('/\s+/', ' ', $str)); // supports line breaks inside preg_match("/<title>(.*)<\/title>/i",$str,$title); // ignore case - return $title[1] ?? $unknown; + return $title[1] ?? $url; } - return $unknown; + return $url; } }