From 798e98a7015b10075e034105fbf195c3839cfad4 Mon Sep 17 00:00:00 2001 From: Daniel Subiabre Date: Fri, 6 Feb 2026 12:57:18 +0100 Subject: [PATCH] fix: improve naming of Scout ResultProcessors with Host + Prop taxonomy --- .../{CoverVimeoProcessor.php => VimeoCoverProcessor.php} | 2 +- ...veYoutubeProcessor.php => YoutubeBadhostProcessor.php} | 8 +++++--- ...overYoutubeProcessor.php => YoutubeCoverProcessor.php} | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) rename src/Service/Scout/{CoverVimeoProcessor.php => VimeoCoverProcessor.php} (90%) rename src/Service/Scout/{UnresponsiveYoutubeProcessor.php => YoutubeBadhostProcessor.php} (61%) rename src/Service/Scout/{CoverYoutubeProcessor.php => YoutubeCoverProcessor.php} (90%) diff --git a/src/Service/Scout/CoverVimeoProcessor.php b/src/Service/Scout/VimeoCoverProcessor.php similarity index 90% rename from src/Service/Scout/CoverVimeoProcessor.php rename to src/Service/Scout/VimeoCoverProcessor.php index 0c71dee..666162d 100644 --- a/src/Service/Scout/CoverVimeoProcessor.php +++ b/src/Service/Scout/VimeoCoverProcessor.php @@ -5,7 +5,7 @@ namespace App\Service\Scout; /** * Transforms a Vimeo thumbnail URI into an HD URI for a cover. */ -class CoverVimeoProcessor implements ScoutProcessorInterface +class VimeoCoverProcessor implements ScoutProcessorInterface { public function supports(ScoutResult $result): bool { diff --git a/src/Service/Scout/UnresponsiveYoutubeProcessor.php b/src/Service/Scout/YoutubeBadhostProcessor.php similarity index 61% rename from src/Service/Scout/UnresponsiveYoutubeProcessor.php rename to src/Service/Scout/YoutubeBadhostProcessor.php index 57cfe80..014fc0e 100644 --- a/src/Service/Scout/UnresponsiveYoutubeProcessor.php +++ b/src/Service/Scout/YoutubeBadhostProcessor.php @@ -5,11 +5,11 @@ namespace App\Service\Scout; /** * Tries to fix bad YouTube responses caused by malformed URI host. */ -class UnresponsiveYoutubeProcessor implements ScoutProcessorInterface +class YoutubeBadhostProcessor implements ScoutProcessorInterface { public function supports(ScoutResult $result): bool { - return $result->image === null && \in_array($result->getUri()->getHost(), [ + return $result->title === null && \in_array($result->getUri()->getHost(), [ 'youtube.com', ]); } @@ -17,7 +17,9 @@ class UnresponsiveYoutubeProcessor implements ScoutProcessorInterface public function process(ScoutResult $result): ScoutResult { $uri = $result->getUri(); - $result->retry = $uri->withHost(\sprintf('www.%s', $uri->getHost())); + $wwwHost = \sprintf('www.%s', $uri->getHost()); + + $result->retry = $uri->withHost($wwwHost); return $result; } diff --git a/src/Service/Scout/CoverYoutubeProcessor.php b/src/Service/Scout/YoutubeCoverProcessor.php similarity index 90% rename from src/Service/Scout/CoverYoutubeProcessor.php rename to src/Service/Scout/YoutubeCoverProcessor.php index 938b48f..92d9f00 100644 --- a/src/Service/Scout/CoverYoutubeProcessor.php +++ b/src/Service/Scout/YoutubeCoverProcessor.php @@ -5,7 +5,7 @@ namespace App\Service\Scout; /** * Transforms a YouTube thumbnail URI into a high-res URI for a cover. */ -class CoverYoutubeProcessor implements ScoutProcessorInterface +class YoutubeCoverProcessor implements ScoutProcessorInterface { public function supports(ScoutResult $result): bool {