Skip to content

Commit

Permalink
Fix phpstan/sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
mcop1 committed Oct 24, 2024
1 parent 89f5b11 commit c616f12
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/GraphQL/FieldHelper/AssetFieldHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,19 @@ public function getImageDocumentThumbnail(
string $thumbNailFormat = null,
bool $deferred = false
): mixed {
match(true) {
$asset instanceof Asset\Document => $thumb = $asset->getImageThumbnail(
$thumbNailConfig,
deferred: $deferred
),
$asset instanceof Asset\Video => $thumb = $asset->getImageThumbnail($thumbNailConfig),
$asset instanceof Asset\Image => $thumb = $asset->getThumbnail($thumbNailConfig, $deferred),
default => $thumb = null
};
$thumb = null;

if($asset instanceof Asset\Document) {
$thumb = $asset->getImageThumbnail($thumbNailConfig, deferred: $deferred);
}

if($asset instanceof Asset\Video) {
$thumb = $asset->getImageThumbnail($thumbNailConfig);
}

if($asset instanceof Asset\Image) {
$thumb = $asset->getThumbnail($thumbNailConfig, $deferred);
}

if (
!($asset instanceof Asset\Video) &&
Expand Down

0 comments on commit c616f12

Please sign in to comment.