ldc-ovoteam/app/Services/AutoCleanupUploadedFile.php
Jérémy Munsch dea6dc8a63
feat(test): add unit tests for ImageOptimizerService
- Implemented tests to verify the functionality of the ImageOptimizerService.
- Tests cover optimization of supported image formats, handling of unsupported files, and cleanup of temporary files.
- Added functionality to store optimized images onto disk using a storage service.
2026-11-06 08:51:44 +01:00

19 lines
388 B
PHP

<?php
declare(strict_types=1);
namespace App\Services;
use Illuminate\Http\UploadedFile;
class AutoCleanupUploadedFile extends UploadedFile
{
public function __destruct()
{
$path = $this->getPathname();
if ($path !== '' && file_exists($path)) {
// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
@unlink($path);
}
}
}