fix: improve naming of Scout ResultProcessors with Host + Prop taxonomy
This commit is contained in:
+1
-1
@@ -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
|
||||
{
|
||||
+5
-3
@@ -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;
|
||||
}
|
||||
+1
-1
@@ -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
|
||||
{
|
||||
Reference in New Issue
Block a user