diff --git a/Classes/Command/ProcessQueueCommand.php b/Classes/Command/ProcessQueueCommand.php index 971729e..28c9d6f 100644 --- a/Classes/Command/ProcessQueueCommand.php +++ b/Classes/Command/ProcessQueueCommand.php @@ -1,10 +1,8 @@ getTargetFile(); + /** @var TemplateRunner $templateRunner */ $templateRunner = GeneralUtility::makeInstance(TemplateRunner::class, $processedFile); $templateRunner->run(); diff --git a/Classes/Runner/TemplateRunner.php b/Classes/Runner/TemplateRunner.php index fc31e57..75f4ad7 100644 --- a/Classes/Runner/TemplateRunner.php +++ b/Classes/Runner/TemplateRunner.php @@ -1,10 +1,10 @@ image->getMimeType(), $this->getSupportedMimeTypes()) && $this->isActive()); + return in_array($this->image->getMimeType(), $this->getSupportedMimeTypes()) && $this->isActive(); } public function getSupportedMimeTypes(): array @@ -74,7 +74,7 @@ public function processFile(): void try { $this->storage->addFile( $targetFile, - $this->image->getParentFolder(), /* @phpstan-ignore-line */ + $this->image->getParentFolder(), // @phpstan-ignore-line $this->image->getName() . '.avif', DuplicationBehavior::REPLACE ); @@ -113,20 +113,19 @@ protected function convertImageUsingGd(string $quality, string $targetFile): boo /** @var Typo3Version $version */ $version = GeneralUtility::makeInstance(Typo3Version::class); if ($version->getMajorVersion() == 13) { - $graphicalFunctionsObject = GeneralUtility::makeInstance(GifBuilder::class);/* @phpstan-ignore-line */ + $graphicalFunctionsObject = GeneralUtility::makeInstance(GifBuilder::class);// @phpstan-ignore-line } else { $graphicalFunctionsObject = GeneralUtility::makeInstance(GraphicalFunctions::class); } - $image = $graphicalFunctionsObject->imageCreateFromFile($this->imagePath);/* @phpstan-ignore-line */ + $image = $graphicalFunctionsObject->imageCreateFromFile($this->imagePath);// @phpstan-ignore-line // Convert CMYK to RGB if (!imageistruecolor($image)) { imagepalettetotruecolor($image); } return imageavif($image, $targetFile, (int)$quality); - } else { - $this->logger->writeLog('Avif is not supported by your GD version', LogLevel::ERROR); } + $this->logger->writeLog('Avif is not supported by your GD version', LogLevel::ERROR); return false; } diff --git a/Classes/Templates/ConverterInterface.php b/Classes/Templates/ConverterInterface.php index 3703653..8c1eb25 100644 --- a/Classes/Templates/ConverterInterface.php +++ b/Classes/Templates/ConverterInterface.php @@ -1,5 +1,5 @@ image->getMimeType(), $this->getSupportedMimeTypes()) && $this->isActive()); + return in_array($this->image->getMimeType(), $this->getSupportedMimeTypes()) && $this->isActive(); } public function getSupportedMimeTypes(): array @@ -43,7 +43,7 @@ public function processFile(): void try { $this->storage->addFile( $this->imagePath, - $this->image->getParentFolder(), /* @phpstan-ignore-line */ + $this->image->getParentFolder(), // @phpstan-ignore-line $this->image->getName(), DuplicationBehavior::REPLACE ); diff --git a/Classes/Templates/PngTemplate.php b/Classes/Templates/PngTemplate.php index 71e22e4..8eb1fec 100644 --- a/Classes/Templates/PngTemplate.php +++ b/Classes/Templates/PngTemplate.php @@ -1,5 +1,5 @@ storage->addFile( $this->imagePath, - $this->image->getParentFolder(), /* @phpstan-ignore-line */ + $this->image->getParentFolder(), // @phpstan-ignore-line $this->image->getName(), DuplicationBehavior::REPLACE ); diff --git a/Classes/Templates/TemplateInterface.php b/Classes/Templates/TemplateInterface.php index ae2f63a..18cf0fa 100644 --- a/Classes/Templates/TemplateInterface.php +++ b/Classes/Templates/TemplateInterface.php @@ -1,5 +1,5 @@ image->getMimeType(), $this->getSupportedMimeTypes()) && $this->isActive()); + return in_array($this->image->getMimeType(), $this->getSupportedMimeTypes()) && $this->isActive(); } public function getSupportedMimeTypes(): array @@ -74,7 +74,7 @@ public function processFile(): void try { $this->storage->addFile( $targetFile, - $this->image->getParentFolder(), /* @phpstan-ignore-line */ + $this->image->getParentFolder(), // @phpstan-ignore-line $this->image->getName() . '.webp', DuplicationBehavior::REPLACE ); @@ -112,20 +112,19 @@ protected function convertImageUsingGd(string $quality, string $targetFile): boo if (function_exists('imagewebp') && defined('IMG_WEBP') && (imagetypes() & IMG_WEBP) === IMG_WEBP) { $version = GeneralUtility::makeInstance(Typo3Version::class); if ($version->getMajorVersion() == 13) { - $graphicalFunctionsObject = GeneralUtility::makeInstance(GifBuilder::class);/* @phpstan-ignore-line */ + $graphicalFunctionsObject = GeneralUtility::makeInstance(GifBuilder::class);// @phpstan-ignore-line } else { $graphicalFunctionsObject = GeneralUtility::makeInstance(GraphicalFunctions::class); } - $image = $graphicalFunctionsObject->imageCreateFromFile($this->imagePath);/* @phpstan-ignore-line */ + $image = $graphicalFunctionsObject->imageCreateFromFile($this->imagePath);// @phpstan-ignore-line // Convert CMYK to RGB if (!imageistruecolor($image)) { imagepalettetotruecolor($image); } return imagewebp($image, $targetFile, (int)$quality); - } else { - $this->logger->writeLog('Webp is not supported by your GD version', LogLevel::ERROR); } + $this->logger->writeLog('Webp is not supported by your GD version', LogLevel::ERROR); return false; } diff --git a/Classes/Utility/LoggerUtility.php b/Classes/Utility/LoggerUtility.php index 82b4aae..730b994 100644 --- a/Classes/Utility/LoggerUtility.php +++ b/Classes/Utility/LoggerUtility.php @@ -1,5 +1,5 @@