]> _ Git - psq.git/commitdiff
Update GetPageTitleFromUrl.php
authorLouis Jeckel <louis.jeckel@outlook.cm>
Thu, 27 Aug 2020 17:14:21 +0000 (19:14 +0200)
committerLouis Jeckel <louis.jeckel@outlook.cm>
Thu, 27 Aug 2020 17:14:21 +0000 (19:14 +0200)
app/Invokables/GetPageTitleFromUrl.php

index 51fbb87c01736e026a1764d109cbcb332931ddbf..bf38881b7b1c8d41bc92f7e0b6646141434c5b4b 100644 (file)
@@ -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 <title>
             preg_match("/<title>(.*)<\/title>/i",$str,$title); // ignore case
-            return $title[1] ?? $unknown;
+            return $title[1] ?? $url;
         }
 
-        return $unknown;
+        return $url;
     }
 
 }