From c55cd62ec7460ffb3ea85468c4a5e137ddd82b9b Mon Sep 17 00:00:00 2001 From: "ext.jeremy.guillot@maxicoffee.domains" Date: Wed, 5 Feb 2025 21:32:04 +0100 Subject: [PATCH] fix: phpcs-fixer --- src/ApiPlatform/OpenApiFactoryDecorator.php | 1 - src/Client/MangadexClient.php | 4 +- src/Controller/ActivityController.php | 5 +- src/Controller/ConversionController.php | 3 +- src/Controller/ImportController.php | 3 +- src/Controller/MangaController.php | 14 +++--- src/Controller/ReaderController.php | 17 ++++--- src/Controller/SecurityController.php | 2 +- src/Controller/SettingsController.php | 5 +- src/Controller/TestController.php | 11 ++--- .../Repository/MangaRepositoryInterface.php | 2 +- .../Contract/Service/ScraperInterface.php | 2 +- .../Domain/Event/ChapterScrapingCompleted.php | 5 +- .../Domain/Event/ChapterScrapingFailed.php | 5 +- .../Domain/Event/ChapterScrapingStarted.php | 3 +- .../Domain/Event/PageScrapingProgressed.php | 5 +- src/Domain/Scraping/Domain/Model/Manga.php | 5 +- .../Scraping/Domain/Model/ScrapingJob.php | 2 +- .../Domain/Model/ScrapingProgress.php | 5 +- .../Scraping/Domain/Model/ScrapingStatus.php | 2 +- src/Domain/Scraping/Domain/Model/Source.php | 5 +- .../Domain/Model/ValueObject/ChapterId.php | 2 +- .../Domain/Model/ValueObject/ImageUrl.php | 2 +- .../Domain/Model/ValueObject/PageNumber.php | 2 +- .../Domain/Model/ValueObject/SourceId.php | 4 +- .../Model/ValueObject/TempDirectory.php | 2 +- .../ApiPlatform/Dto/ScrapeChapterRequest.php | 2 - .../Dto/ScrapingStatusResponse.php | 3 -- .../Processor/ScrapeChapterStateProcessor.php | 3 +- .../Persistence/DoctrineMangaRepository.php | 5 +- .../Persistence/DoctrineSourceRepository.php | 7 +-- .../Persistence/Entity/MangaEntity.php | 2 +- .../Persistence/Entity/ScrapingJobEntity.php | 4 +- .../Persistence/Entity/SourceEntity.php | 4 +- .../Service/ImageDownloader.php | 11 +++-- .../Service/Scraper/AbstractScraper.php | 7 +-- .../Service/Scraper/HtmlScraper.php | 18 ++++---- src/Entity/ApiToken.php | 1 - src/EventListener/ExceptionListener.php | 36 +++++++-------- src/EventSubscriber/QueueStatusSubscriber.php | 3 +- src/Factory/UserFactory.php | 6 +-- src/Interface/ContentProviderInterface.php | 4 +- src/Kernel.php | 2 +- src/Manager/Toolbar/Element/ToolbarButton.php | 1 - src/Message/RefreshAndDownloadChapters.php | 18 ++++---- .../RefreshAndDownloadChaptersHandler.php | 3 +- src/MessageHandler/RefreshMetadataHandler.php | 3 +- src/Repository/ApiTokenRepository.php | 46 +++++++++---------- src/Repository/AppSettingsRepository.php | 46 +++++++++---------- src/Repository/ChapterRepository.php | 46 +++++++++---------- src/Repository/ContentSourceRepository.php | 46 +++++++++---------- src/Repository/MangaRepository.php | 46 +++++++++---------- src/Repository/PageRepository.php | 46 +++++++++---------- src/Repository/SourceRepository.php | 46 +++++++++---------- src/Repository/UserRepository.php | 46 +++++++++---------- src/Scheduler/MainSchedule.php | 1 - src/Security/ApiTokenHandler.php | 3 +- src/Service/CbrToCbzConverter.php | 2 +- src/Service/MangaImportService.php | 3 +- src/Service/MangaScraperService.php | 46 +++++++++---------- src/Service/Scraper/AbstractScraper.php | 3 +- src/Twig/Components/DownloadChapter.php | 8 ++-- src/Twig/Components/DropdownMenu.php | 2 +- src/Twig/Components/Search.php | 2 +- src/Twig/Components/ToolBarButton.php | 2 +- 65 files changed, 346 insertions(+), 355 deletions(-) diff --git a/src/ApiPlatform/OpenApiFactoryDecorator.php b/src/ApiPlatform/OpenApiFactoryDecorator.php index 9735024..f6597d5 100644 --- a/src/ApiPlatform/OpenApiFactoryDecorator.php +++ b/src/ApiPlatform/OpenApiFactoryDecorator.php @@ -10,7 +10,6 @@ use Symfony\Component\DependencyInjection\Attribute\AsDecorator; #[AsDecorator('api_platform.openapi.factory')] class OpenApiFactoryDecorator implements OpenApiFactoryInterface { - public function __construct(private OpenApiFactoryInterface $decorated) { } diff --git a/src/Client/MangadexClient.php b/src/Client/MangadexClient.php index 26a31da..f830a7f 100644 --- a/src/Client/MangadexClient.php +++ b/src/Client/MangadexClient.php @@ -7,8 +7,8 @@ use GuzzleHttp\ClientInterface as GuzzleInterface; class MangadexClient implements ClientInterface { - private CONST AUTHENTICATION_URL = 'https://auth.mangadex.org/realms/mangadex/protocol/openid-connect/token'; - private CONST API_URL = 'https://api.mangadex.org'; + private const AUTHENTICATION_URL = 'https://auth.mangadex.org/realms/mangadex/protocol/openid-connect/token'; + private const API_URL = 'https://api.mangadex.org'; private GuzzleInterface $httpClient; private string $clientId; private string $clientSecret; diff --git a/src/Controller/ActivityController.php b/src/Controller/ActivityController.php index 3f4a199..2cfd630 100644 --- a/src/Controller/ActivityController.php +++ b/src/Controller/ActivityController.php @@ -19,8 +19,7 @@ class ActivityController extends AbstractController private readonly Connection $connection, private readonly ChapterRepository $chapterRepository, private readonly ToolbarFactory $toolbarFactory - ) - { + ) { } @@ -57,7 +56,7 @@ class ActivityController extends AbstractController return new JsonResponse($status); } -// TODO refactorer ce code avec celui du QueueStatusSubscriber + // TODO refactorer ce code avec celui du QueueStatusSubscriber private function getQueueStatus(): array { // Requête pour récupérer les messages en attente diff --git a/src/Controller/ConversionController.php b/src/Controller/ConversionController.php index 3934bcb..bd04d72 100644 --- a/src/Controller/ConversionController.php +++ b/src/Controller/ConversionController.php @@ -17,8 +17,7 @@ class ConversionController extends AbstractController public function __construct( private readonly CbrToCbzConverter $cbrToCbzConverter, private readonly NotificationService $notificationService - ) - { + ) { } #[Route('/convert', name: 'app_convert')] diff --git a/src/Controller/ImportController.php b/src/Controller/ImportController.php index 927e626..6c0d1d9 100644 --- a/src/Controller/ImportController.php +++ b/src/Controller/ImportController.php @@ -27,8 +27,7 @@ class ImportController extends AbstractController private readonly NotificationService $notificationService, private readonly MangaRepository $mangaRepository, private readonly CbrToCbzConverter $cbrToCbzConverter - ) - { + ) { } diff --git a/src/Controller/MangaController.php b/src/Controller/MangaController.php index f024c4d..0e73da7 100644 --- a/src/Controller/MangaController.php +++ b/src/Controller/MangaController.php @@ -49,8 +49,7 @@ class MangaController extends AbstractController private readonly EntityManagerInterface $entityManager, private readonly NotificationService $notificationService, private readonly ContentSourceRepository $contentSourceRepository - ) - { + ) { $this->imageManager = new ImageManager(new Driver()); } @@ -75,7 +74,7 @@ class MangaController extends AbstractController #[Route('/manga/chapters/{mangaSlug}', name: 'app_manga_show')] public function showChapters(string $mangaSlug, Request $request): Response { -// $manga = $this->mangaRepository->findOneWithChapterBy(['slug' => $mangaSlug]); + // $manga = $this->mangaRepository->findOneWithChapterBy(['slug' => $mangaSlug]); $manga = $this->mangaRepository->findOneBy(['slug' => $mangaSlug]); if (!$manga) { @@ -98,7 +97,7 @@ class MangaController extends AbstractController { try { foreach ($manga->getChapters() as $chapter) { - file_exists($chapter->getCbzPath()) ?? unlink($chapter->getCbzPath()); + file_exists($chapter->getCbzPath()) ?? unlink($chapter->getCbzPath()); $this->entityManager->remove($chapter); } $this->entityManager->remove($manga); @@ -135,8 +134,7 @@ class MangaController extends AbstractController Request $request, Manga $manga, ContentSourceRepository $contentSourceRepository - ): JsonResponse - { + ): JsonResponse { $data = json_decode($request->getContent(), true); $preferredSourceIds = $data['preferredSources'] ?? []; @@ -144,7 +142,7 @@ class MangaController extends AbstractController // This will maintain the order of the sources as they were sent in the request $orderedPreferredSources = array_map( - fn($id) => current(array_filter($preferredSources, fn($s) => $s->getId() == $id)), + fn ($id) => current(array_filter($preferredSources, fn ($s) => $s->getId() == $id)), $preferredSourceIds ); @@ -194,7 +192,7 @@ class MangaController extends AbstractController return new JsonResponse(['error' => 'No CBZ path for this chapter.'], 400); } - file_exists($cbzPath) ?? unlink($cbzPath); + file_exists($cbzPath) ?? unlink($cbzPath); $chapter->setCbzPath(null); $this->entityManager->persist($chapter); diff --git a/src/Controller/ReaderController.php b/src/Controller/ReaderController.php index 4766577..f7e4945 100644 --- a/src/Controller/ReaderController.php +++ b/src/Controller/ReaderController.php @@ -16,8 +16,7 @@ class ReaderController extends AbstractController private readonly MangaRepository $mangaRepository, private readonly CbzService $cbzService, private readonly NotificationService $notificationService, - ) - { + ) { } #[Route('/read/{mangaSlug}/{chapterNumber}', name: 'app_reader')] @@ -80,12 +79,12 @@ class ReaderController extends AbstractController } $chapters = $manga->getChapters() - ->filter(fn($chapter) => $chapter->isVisible() && !is_null($chapter->getCbzPath())) + ->filter(fn ($chapter) => $chapter->isVisible() && !is_null($chapter->getCbzPath())) ->toArray(); - usort($chapters, fn($a, $b) => $b->getNumber() <=> $a->getNumber()); + usort($chapters, fn ($a, $b) => $b->getNumber() <=> $a->getNumber()); - $chapters = array_values(array_map(fn($chapter) => [ + $chapters = array_values(array_map(fn ($chapter) => [ 'number' => $chapter->getNumber(), 'title' => $chapter->getTitle(), ], $chapters)); @@ -102,10 +101,10 @@ class ReaderController extends AbstractController } $chapters = $manga->getChapters() - ->filter(fn($chapter) => $chapter->isVisible() && $chapter->getNumber() < $currentChapterNumber) + ->filter(fn ($chapter) => $chapter->isVisible() && $chapter->getNumber() < $currentChapterNumber) ->toArray(); - usort($chapters, fn($a, $b) => $b->getNumber() <=> $a->getNumber()); + usort($chapters, fn ($a, $b) => $b->getNumber() <=> $a->getNumber()); $previousChapter = reset($chapters) ?: null; @@ -124,10 +123,10 @@ class ReaderController extends AbstractController } $nextChapter = $manga->getChapters() - ->filter(fn($chapter) => $chapter->isVisible() && $chapter->getNumber() > $currentChapterNumber) + ->filter(fn ($chapter) => $chapter->isVisible() && $chapter->getNumber() > $currentChapterNumber) ->toArray(); - usort($nextChapter, fn($a, $b) => $a->getNumber() <=> $b->getNumber()); + usort($nextChapter, fn ($a, $b) => $a->getNumber() <=> $b->getNumber()); $nextChapter = reset($nextChapter) ?: null; diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 0c2ed00..098ba17 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -15,7 +15,7 @@ class SecurityController extends AbstractController #[Route('/login', name: 'app_login', methods: ['GET', 'POST'])] public function login(IriConverterInterface $iriConverter, #[CurrentUser] User $user = null): Response { - if(!$user){ + if(!$user) { return $this->json([ 'error' => 'Invalid credentials' ], 401); diff --git a/src/Controller/SettingsController.php b/src/Controller/SettingsController.php index 4928a5b..ef06c1d 100644 --- a/src/Controller/SettingsController.php +++ b/src/Controller/SettingsController.php @@ -26,8 +26,7 @@ class SettingsController extends AbstractController private EntityManagerInterface $entityManager, private NotificationService $notificationService, private ContentSourceRepository $contentSourceRepository - ) - { + ) { } @@ -117,7 +116,7 @@ class SettingsController extends AbstractController try { $scrapedData = $this->mangaScraperService->testScraping($mangaSlug, $chapterNumber, $contentSource); - }catch (\Exception $e){ + } catch (\Exception $e) { $this->notificationService->sendUpdate(['status' => 'error', 'message' => $e->getMessage()]); return new JsonResponse([ 'success' => false, diff --git a/src/Controller/TestController.php b/src/Controller/TestController.php index 1d1f22c..0122023 100644 --- a/src/Controller/TestController.php +++ b/src/Controller/TestController.php @@ -34,8 +34,7 @@ class TestController extends AbstractController private string $projectDir, private SluggerInterface $slugger, private MangaRepository $mangaRepository - ) - { + ) { $this->imageManager = new ImageManager(new Driver()); } @@ -45,9 +44,9 @@ class TestController extends AbstractController $mangas = $this->mangaRepository->findAll(); $changed = 0; - foreach ($mangas as $manga){ + foreach ($mangas as $manga) { //si getImageUrl() retourne un lien sous la forme d'une URL (https ou http) - if($manga->getImageUrl()){ + if($manga->getImageUrl()) { $imageUrls = $this->processAndSaveImage($manga->getImageUrl()); $manga->setThumbnailUrl($imageUrls['thumbnail']); $this->mangaRepository->save($manga, true); @@ -81,8 +80,8 @@ class TestController extends AbstractController $thumbnail->save($this->projectDir . '/public/images/thumbnails/' . $newFilename, quality: 85); // Sauvegarder l'image en taille réelle -// $fullImage = $this->imageManager->read($tempImagePath); -// $fullImage->save($this->projectDir . '/public/images/full/' . $newFilename, quality: 90); + // $fullImage = $this->imageManager->read($tempImagePath); + // $fullImage->save($this->projectDir . '/public/images/full/' . $newFilename, quality: 90); // Fermer et supprimer le fichier temporaire fclose($tempImage); diff --git a/src/Domain/Scraping/Domain/Contract/Repository/MangaRepositoryInterface.php b/src/Domain/Scraping/Domain/Contract/Repository/MangaRepositoryInterface.php index 1ace6a8..ead9c79 100644 --- a/src/Domain/Scraping/Domain/Contract/Repository/MangaRepositoryInterface.php +++ b/src/Domain/Scraping/Domain/Contract/Repository/MangaRepositoryInterface.php @@ -7,4 +7,4 @@ use App\Domain\Scraping\Domain\Model\Manga; interface MangaRepositoryInterface { public function getById(string $id): ?Manga; -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Contract/Service/ScraperInterface.php b/src/Domain/Scraping/Domain/Contract/Service/ScraperInterface.php index 7424bf5..94a15ff 100644 --- a/src/Domain/Scraping/Domain/Contract/Service/ScraperInterface.php +++ b/src/Domain/Scraping/Domain/Contract/Service/ScraperInterface.php @@ -9,4 +9,4 @@ interface ScraperInterface public function createScrapingJob(string $mangaId, string $chapterId, string $sourceId): ScrapingJob; public function scrape(ScrapingJob $job): void; public function supports(string $sourceType): bool; -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Event/ChapterScrapingCompleted.php b/src/Domain/Scraping/Domain/Event/ChapterScrapingCompleted.php index 199a248..c8dd183 100644 --- a/src/Domain/Scraping/Domain/Event/ChapterScrapingCompleted.php +++ b/src/Domain/Scraping/Domain/Event/ChapterScrapingCompleted.php @@ -7,7 +7,8 @@ class ChapterScrapingCompleted public function __construct( private readonly string $jobId, private readonly array $scrapedPages - ) {} + ) { + } public function getJobId(): string { @@ -18,4 +19,4 @@ class ChapterScrapingCompleted { return $this->scrapedPages; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Event/ChapterScrapingFailed.php b/src/Domain/Scraping/Domain/Event/ChapterScrapingFailed.php index 2d8f7d8..46299ba 100644 --- a/src/Domain/Scraping/Domain/Event/ChapterScrapingFailed.php +++ b/src/Domain/Scraping/Domain/Event/ChapterScrapingFailed.php @@ -7,7 +7,8 @@ class ChapterScrapingFailed public function __construct( private readonly string $chapterId, private readonly string $reason - ) {} + ) { + } public function getChapterId(): string { @@ -18,4 +19,4 @@ class ChapterScrapingFailed { return $this->reason; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Event/ChapterScrapingStarted.php b/src/Domain/Scraping/Domain/Event/ChapterScrapingStarted.php index 2549442..20c64ec 100644 --- a/src/Domain/Scraping/Domain/Event/ChapterScrapingStarted.php +++ b/src/Domain/Scraping/Domain/Event/ChapterScrapingStarted.php @@ -6,7 +6,8 @@ class ChapterScrapingStarted { public function __construct( private readonly string $jobId - ) {} + ) { + } public function getJobId(): string { diff --git a/src/Domain/Scraping/Domain/Event/PageScrapingProgressed.php b/src/Domain/Scraping/Domain/Event/PageScrapingProgressed.php index 0f4e6c0..fb3cab8 100644 --- a/src/Domain/Scraping/Domain/Event/PageScrapingProgressed.php +++ b/src/Domain/Scraping/Domain/Event/PageScrapingProgressed.php @@ -9,7 +9,8 @@ class PageScrapingProgressed public function __construct( private readonly string $jobId, private readonly ScrapingProgress $progress - ) {} + ) { + } public function getJobId(): string { @@ -20,4 +21,4 @@ class PageScrapingProgressed { return $this->progress; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/Manga.php b/src/Domain/Scraping/Domain/Model/Manga.php index 13f1709..62ae5ea 100644 --- a/src/Domain/Scraping/Domain/Model/Manga.php +++ b/src/Domain/Scraping/Domain/Model/Manga.php @@ -10,7 +10,8 @@ class Manga private readonly string $slug, private readonly string $description, private readonly string $author, - ) {} + ) { + } public function getId(): string { @@ -36,4 +37,4 @@ class Manga { return $this->author; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/ScrapingJob.php b/src/Domain/Scraping/Domain/Model/ScrapingJob.php index 98f798e..fa753d3 100644 --- a/src/Domain/Scraping/Domain/Model/ScrapingJob.php +++ b/src/Domain/Scraping/Domain/Model/ScrapingJob.php @@ -87,4 +87,4 @@ class ScrapingJob { return $this->completedAt; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/ScrapingProgress.php b/src/Domain/Scraping/Domain/Model/ScrapingProgress.php index b5861b3..fb48ca7 100644 --- a/src/Domain/Scraping/Domain/Model/ScrapingProgress.php +++ b/src/Domain/Scraping/Domain/Model/ScrapingProgress.php @@ -7,7 +7,8 @@ class ScrapingProgress public function __construct( private readonly int $pagesScraped, private readonly int $totalPages - ) {} + ) { + } public function getPercentage(): float { @@ -16,4 +17,4 @@ class ScrapingProgress } return ($this->pagesScraped / $this->totalPages) * 100; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/ScrapingStatus.php b/src/Domain/Scraping/Domain/Model/ScrapingStatus.php index 1d88c84..eb82c20 100644 --- a/src/Domain/Scraping/Domain/Model/ScrapingStatus.php +++ b/src/Domain/Scraping/Domain/Model/ScrapingStatus.php @@ -8,4 +8,4 @@ enum ScrapingStatus: string case IN_PROGRESS = 'in_progress'; case COMPLETED = 'completed'; case FAILED = 'failed'; -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/Source.php b/src/Domain/Scraping/Domain/Model/Source.php index e7e74f9..ec123ac 100644 --- a/src/Domain/Scraping/Domain/Model/Source.php +++ b/src/Domain/Scraping/Domain/Model/Source.php @@ -15,7 +15,8 @@ class Source private readonly bool $isActive, private readonly DateTimeImmutable $createdAt, private readonly DateTimeImmutable $updatedAt - ) {} + ) { + } public function getId(): string { @@ -56,4 +57,4 @@ class Source { return $this->updatedAt; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/ValueObject/ChapterId.php b/src/Domain/Scraping/Domain/Model/ValueObject/ChapterId.php index eecb0a2..45077c2 100644 --- a/src/Domain/Scraping/Domain/Model/ValueObject/ChapterId.php +++ b/src/Domain/Scraping/Domain/Model/ValueObject/ChapterId.php @@ -15,4 +15,4 @@ class ChapterId { return $this->value; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/ValueObject/ImageUrl.php b/src/Domain/Scraping/Domain/Model/ValueObject/ImageUrl.php index 1f5f5ef..13116b1 100644 --- a/src/Domain/Scraping/Domain/Model/ValueObject/ImageUrl.php +++ b/src/Domain/Scraping/Domain/Model/ValueObject/ImageUrl.php @@ -21,4 +21,4 @@ class ImageUrl { return pathinfo(parse_url($this->url, PHP_URL_PATH), PATHINFO_EXTENSION); } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/ValueObject/PageNumber.php b/src/Domain/Scraping/Domain/Model/ValueObject/PageNumber.php index 5c0fa9d..4aa1564 100644 --- a/src/Domain/Scraping/Domain/Model/ValueObject/PageNumber.php +++ b/src/Domain/Scraping/Domain/Model/ValueObject/PageNumber.php @@ -21,4 +21,4 @@ class PageNumber { return sprintf('%03d', $this->number); } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/ValueObject/SourceId.php b/src/Domain/Scraping/Domain/Model/ValueObject/SourceId.php index 045eefd..b64b92d 100644 --- a/src/Domain/Scraping/Domain/Model/ValueObject/SourceId.php +++ b/src/Domain/Scraping/Domain/Model/ValueObject/SourceId.php @@ -2,7 +2,7 @@ namespace App\Domain\Scraping\Domain\Model\ValueObject; -class SourceId +class SourceId { public function __construct(private readonly string $value) { @@ -15,4 +15,4 @@ class SourceId { return $this->value; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Domain/Model/ValueObject/TempDirectory.php b/src/Domain/Scraping/Domain/Model/ValueObject/TempDirectory.php index 6739eef..656409b 100644 --- a/src/Domain/Scraping/Domain/Model/ValueObject/TempDirectory.php +++ b/src/Domain/Scraping/Domain/Model/ValueObject/TempDirectory.php @@ -15,4 +15,4 @@ class TempDirectory { return $this->path; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Infrastructure/ApiPlatform/Dto/ScrapeChapterRequest.php b/src/Domain/Scraping/Infrastructure/ApiPlatform/Dto/ScrapeChapterRequest.php index afb9ffd..aef3035 100644 --- a/src/Domain/Scraping/Infrastructure/ApiPlatform/Dto/ScrapeChapterRequest.php +++ b/src/Domain/Scraping/Infrastructure/ApiPlatform/Dto/ScrapeChapterRequest.php @@ -24,11 +24,9 @@ readonly class ScrapeChapterRequest #[ApiProperty(description: 'ID du chapitre à scraper')] #[Assert\NotBlank] public string $chapterId, - #[ApiProperty(description: 'ID de la source à utiliser')] #[Assert\NotBlank] public string $sourceId, - #[ApiProperty(description: 'ID du manga')] #[Assert\NotBlank] public string $mangaId, diff --git a/src/Domain/Scraping/Infrastructure/ApiPlatform/Dto/ScrapingStatusResponse.php b/src/Domain/Scraping/Infrastructure/ApiPlatform/Dto/ScrapingStatusResponse.php index c3bd4d0..5bd3f5b 100644 --- a/src/Domain/Scraping/Infrastructure/ApiPlatform/Dto/ScrapingStatusResponse.php +++ b/src/Domain/Scraping/Infrastructure/ApiPlatform/Dto/ScrapingStatusResponse.php @@ -31,13 +31,10 @@ readonly class ScrapingStatusResponse public function __construct( #[ApiProperty(identifier: true)] public string $jobId, - #[ApiProperty] public string $status, - #[ApiProperty] public ?float $progress = null, - #[ApiProperty] public ?string $error = null ) { diff --git a/src/Domain/Scraping/Infrastructure/ApiPlatform/State/Processor/ScrapeChapterStateProcessor.php b/src/Domain/Scraping/Infrastructure/ApiPlatform/State/Processor/ScrapeChapterStateProcessor.php index 3c49577..79a2902 100644 --- a/src/Domain/Scraping/Infrastructure/ApiPlatform/State/Processor/ScrapeChapterStateProcessor.php +++ b/src/Domain/Scraping/Infrastructure/ApiPlatform/State/Processor/ScrapeChapterStateProcessor.php @@ -12,7 +12,8 @@ final class ScrapeChapterStateProcessor implements ProcessorInterface { public function __construct( private readonly MessageBusInterface $commandBus - ) {} + ) { + } /** * @param ScrapeChapterRequest $data diff --git a/src/Domain/Scraping/Infrastructure/Persistence/DoctrineMangaRepository.php b/src/Domain/Scraping/Infrastructure/Persistence/DoctrineMangaRepository.php index de0b24a..48fe41d 100644 --- a/src/Domain/Scraping/Infrastructure/Persistence/DoctrineMangaRepository.php +++ b/src/Domain/Scraping/Infrastructure/Persistence/DoctrineMangaRepository.php @@ -11,7 +11,8 @@ class DoctrineMangaRepository implements MangaRepositoryInterface { public function __construct( private readonly EntityManagerInterface $entityManager - ) {} + ) { + } public function getById(string $id): ?Manga { @@ -19,4 +20,4 @@ class DoctrineMangaRepository implements MangaRepositoryInterface return $manga ? $manga->toDomain() : null; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Infrastructure/Persistence/DoctrineSourceRepository.php b/src/Domain/Scraping/Infrastructure/Persistence/DoctrineSourceRepository.php index 27bbc82..cb5f421 100644 --- a/src/Domain/Scraping/Infrastructure/Persistence/DoctrineSourceRepository.php +++ b/src/Domain/Scraping/Infrastructure/Persistence/DoctrineSourceRepository.php @@ -11,16 +11,17 @@ class DoctrineSourceRepository implements SourceRepositoryInterface { public function __construct( private readonly EntityManagerInterface $entityManager - ) {} + ) { + } public function getById(string $id): ?Source { $sourceEntity = $this->entityManager->getRepository(SourceEntityEntity::class)->find($id); - + if (!$sourceEntity) { return null; } return $sourceEntity->toDomain(); } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Infrastructure/Persistence/Entity/MangaEntity.php b/src/Domain/Scraping/Infrastructure/Persistence/Entity/MangaEntity.php index d9b0eb4..61e1de3 100644 --- a/src/Domain/Scraping/Infrastructure/Persistence/Entity/MangaEntity.php +++ b/src/Domain/Scraping/Infrastructure/Persistence/Entity/MangaEntity.php @@ -56,7 +56,7 @@ class MangaEntity $entity->description = $manga->getDescription(); $entity->author = $manga->getAuthor(); - + return $entity; } diff --git a/src/Domain/Scraping/Infrastructure/Persistence/Entity/ScrapingJobEntity.php b/src/Domain/Scraping/Infrastructure/Persistence/Entity/ScrapingJobEntity.php index eeb02e4..e5b2672 100644 --- a/src/Domain/Scraping/Infrastructure/Persistence/Entity/ScrapingJobEntity.php +++ b/src/Domain/Scraping/Infrastructure/Persistence/Entity/ScrapingJobEntity.php @@ -45,7 +45,7 @@ class ScrapingJobEntity $entity->status = $job->getStatus()->value; $entity->createdAt = $job->getCreatedAt(); $entity->completedAt = $job->getCompletedAt(); - + return $entity; } @@ -60,4 +60,4 @@ class ScrapingJobEntity return $job; } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Infrastructure/Persistence/Entity/SourceEntity.php b/src/Domain/Scraping/Infrastructure/Persistence/Entity/SourceEntity.php index 197e55b..8649693 100644 --- a/src/Domain/Scraping/Infrastructure/Persistence/Entity/SourceEntity.php +++ b/src/Domain/Scraping/Infrastructure/Persistence/Entity/SourceEntity.php @@ -45,7 +45,7 @@ class SourceEntity $entity->isActive = $source->isActive(); $entity->createdAt = $source->getCreatedAt(); $entity->updatedAt = $source->getUpdatedAt(); - + return $entity; } @@ -62,4 +62,4 @@ class SourceEntity $this->updatedAt ); } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Infrastructure/Service/ImageDownloader.php b/src/Domain/Scraping/Infrastructure/Service/ImageDownloader.php index 96804e9..a728c9a 100644 --- a/src/Domain/Scraping/Infrastructure/Service/ImageDownloader.php +++ b/src/Domain/Scraping/Infrastructure/Service/ImageDownloader.php @@ -4,20 +4,21 @@ namespace App\Domain\Scraping\Infrastructure\Service; use Symfony\Contracts\HttpClient\HttpClientInterface; -class ImageDownloader +class ImageDownloader { public function __construct( private readonly HttpClientInterface $httpClient - ) {} + ) { + } public function download(string $url, string $destination): void { $response = $this->httpClient->request('GET', $url); - + if (!str_starts_with($response->getHeaders()['content-type'][0], 'image/')) { throw new \RuntimeException('Invalid content type'); } - + file_put_contents($destination, $response->getContent()); } -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Infrastructure/Service/Scraper/AbstractScraper.php b/src/Domain/Scraping/Infrastructure/Service/Scraper/AbstractScraper.php index 2c45d01..6ce59a2 100644 --- a/src/Domain/Scraping/Infrastructure/Service/Scraper/AbstractScraper.php +++ b/src/Domain/Scraping/Infrastructure/Service/Scraper/AbstractScraper.php @@ -19,7 +19,8 @@ abstract class AbstractScraper implements ScraperInterface public function __construct( protected readonly ImageDownloader $imageDownloader, protected readonly MessageBusInterface $eventBus - ) {} + ) { + } public function createScrapingJob(string $mangaId, string $chapterId, string $sourceId): ScrapingJob { @@ -32,7 +33,7 @@ abstract class AbstractScraper implements ScraperInterface } abstract public function scrape(ScrapingJob $job): void; - + abstract protected function scrapePages(ScrapingJob $job, Source $source): array; protected function cleanupTempDirectory(string $tempDir): void @@ -82,4 +83,4 @@ abstract class AbstractScraper implements ScraperInterface } abstract public function supports(string $sourceType): bool; -} \ No newline at end of file +} diff --git a/src/Domain/Scraping/Infrastructure/Service/Scraper/HtmlScraper.php b/src/Domain/Scraping/Infrastructure/Service/Scraper/HtmlScraper.php index 5e7c4a6..8b8d31d 100644 --- a/src/Domain/Scraping/Infrastructure/Service/Scraper/HtmlScraper.php +++ b/src/Domain/Scraping/Infrastructure/Service/Scraper/HtmlScraper.php @@ -30,7 +30,7 @@ class HtmlScraper extends AbstractScraper try { $pages = $this->scrapePages($job, $sourceConfig); - + foreach ($pages as $index => $imageUrl) { $pageNumber = new PageNumber($index + 1); $extension = pathinfo(parse_url($imageUrl, PHP_URL_PATH), PATHINFO_EXTENSION); @@ -43,7 +43,7 @@ class HtmlScraper extends AbstractScraper $this->downloadImage($imageUrl, $destination); $job->addPage($pageNumber, new ImageUrl($imageUrl)); - + $this->dispatchProgressEvent($job, $index + 1, count($pages)); } @@ -61,7 +61,7 @@ class HtmlScraper extends AbstractScraper if (!$sourceConfig['next_page_selector']) { return $this->scrapeVerticalReader($job, $sourceConfig); } - + return $this->scrapeHorizontalReader($job, $sourceConfig); } @@ -69,7 +69,7 @@ class HtmlScraper extends AbstractScraper { $html = $this->fetchHtml($this->buildChapterUrl($job, $sourceConfig)); $crawler = new Crawler($html); - + return $crawler->filter($sourceConfig['image_selector']) ->each(function ($node) { return $this->cleanImageUrl( @@ -86,11 +86,11 @@ class HtmlScraper extends AbstractScraper while ($currentUrl) { $html = $this->fetchHtml($currentUrl); $crawler = new Crawler($html); - + $imageUrl = $crawler->filter($sourceConfig['image_selector']) ->attr('src') ?: $crawler->filter($sourceConfig['image_selector']) ->attr('data-src'); - + $pages[] = $this->cleanImageUrl($imageUrl); $nextLink = $crawler->filter($sourceConfig['next_page_selector']); @@ -103,11 +103,11 @@ class HtmlScraper extends AbstractScraper private function fetchHtml(string $url): string { $response = $this->httpClient->request('GET', $url); - + if ($response->getStatusCode() >= 400) { throw new \RuntimeException('Failed to fetch page: ' . $url); } - + return $response->getContent(); } @@ -130,4 +130,4 @@ class HtmlScraper extends AbstractScraper { return 'html' === $sourceType; } -} \ No newline at end of file +} diff --git a/src/Entity/ApiToken.php b/src/Entity/ApiToken.php index f4c1f51..e132977 100644 --- a/src/Entity/ApiToken.php +++ b/src/Entity/ApiToken.php @@ -9,7 +9,6 @@ use Random\RandomException; #[ORM\Entity(repositoryClass: ApiTokenRepository::class)] class ApiToken { - private const string PERSONAL_ACCESS_TOKEN_PREFIX = 'mgr_'; public const string SCOPE_USER_EDIT = 'ROLE_USER_EDIT'; public const string SCOPE_PROJECT_CREATE = 'ROLE_PROJECT_CREATE'; diff --git a/src/EventListener/ExceptionListener.php b/src/EventListener/ExceptionListener.php index 5bffc1d..47cc9e2 100644 --- a/src/EventListener/ExceptionListener.php +++ b/src/EventListener/ExceptionListener.php @@ -21,24 +21,24 @@ class ExceptionListener public function onKernelException(ExceptionEvent $event): void { -// $exception = $event->getThrowable(); -// -// $response = match(true) { -// $exception instanceof FilterValidationException, -// $exception instanceof BadRequestException => $this->createResponse($exception, Response::HTTP_BAD_REQUEST), -// $exception instanceof NotFoundHttpException, -// $exception instanceof ItemNotFoundException => $this->createResponse($exception, Response::HTTP_NOT_FOUND), -// $exception instanceof AccessDeniedHttpException => $this->createResponse($exception, Response::HTTP_FORBIDDEN), -// $exception instanceof ValidationException, -// $exception instanceof NotNormalizableValueException => $this->createResponse($exception, Response::HTTP_UNPROCESSABLE_ENTITY), -// default => null, -// }; -// -// if ($response) { -// $event->setResponse($response); -// }else{ -// $this->logger->error($exception->getMessage(), ['exception' => $exception]); -// } + // $exception = $event->getThrowable(); + // + // $response = match(true) { + // $exception instanceof FilterValidationException, + // $exception instanceof BadRequestException => $this->createResponse($exception, Response::HTTP_BAD_REQUEST), + // $exception instanceof NotFoundHttpException, + // $exception instanceof ItemNotFoundException => $this->createResponse($exception, Response::HTTP_NOT_FOUND), + // $exception instanceof AccessDeniedHttpException => $this->createResponse($exception, Response::HTTP_FORBIDDEN), + // $exception instanceof ValidationException, + // $exception instanceof NotNormalizableValueException => $this->createResponse($exception, Response::HTTP_UNPROCESSABLE_ENTITY), + // default => null, + // }; + // + // if ($response) { + // $event->setResponse($response); + // }else{ + // $this->logger->error($exception->getMessage(), ['exception' => $exception]); + // } } private function createResponse(\Throwable $exception, int $statusCode): Response diff --git a/src/EventSubscriber/QueueStatusSubscriber.php b/src/EventSubscriber/QueueStatusSubscriber.php index 2c304a6..a9e7264 100644 --- a/src/EventSubscriber/QueueStatusSubscriber.php +++ b/src/EventSubscriber/QueueStatusSubscriber.php @@ -19,8 +19,7 @@ class QueueStatusSubscriber implements EventSubscriberInterface private ActivityService $activityService, private Connection $connection, private ChapterRepository $chapterRepository - ) - { + ) { } public static function getSubscribedEvents(): array diff --git a/src/Factory/UserFactory.php b/src/Factory/UserFactory.php index cf6529f..da2b211 100644 --- a/src/Factory/UserFactory.php +++ b/src/Factory/UserFactory.php @@ -30,8 +30,8 @@ use Zenstruck\Foundry\RepositoryProxy; */ final class UserFactory extends ModelFactory { - const array FIRST_NAMES = ["ALAIN", "ALEXANDRE", "ANDRÉ", "ANNIE", "ANTHONY", "AUDREY", "AURÉLIE", "BERNARD", "BRIGITTE", "BRUNO", "CATHERINE", "CEDRIC", "CHANTAL", "CHRISTELLE", "CHRISTIAN", "CHRISTIANE", "CHRISTINE", "CHRISTOPHE", "CLAUDE", "CORINNE", "CÉLINE", "DANIEL", "DANIELLE", "DAVID", "DENISE", "DIDIER", "DOMINIQUE", "ELODIE", "EMILIE", "ENZO", "ERIC", "FABRICE", "FLORENCE", "FRANCK", "FRANÇOISE", "FRÉDÉRIC", "GEORGES", "GERMAINE", "GUILLAUME", "GUY", "GÉRARD", "HENRI", "ISABELLE", "JACQUELINE", "JACQUES", "JEAN", "JEAN-CLAUDE", "JEAN-PIERRE", "JEANNE", "JEANNINE", "JEREMY", "JEROME", "JONATHAN", "JOSEPH", "JULIE", "JULIEN", "KARINE", "KEVIN", "LAETITIA", "LAURA", "LAURENCE", "LAURENT", "LOUIS", "LUCAS", "LÉA", "MADELEINE", "MANON", "MARCEL", "MARCELLE", "MARGUERITE", "MARIE", "MARINE", "MARTINE", "MAURICE", "MAXIME", "MICHEL", "MICHÈLE", "MONIQUE", "NATHALIE", "NICOLAS", "NICOLE", "ODETTE", "OLIVIER", "PASCAL", "PASCALE", "PATRICIA", "PATRICK", "PAUL", "PAULETTE", "PHILIPPE", "PIERRE", "RENÉ", "ROBERT", "ROGER", "ROMAIN", "SANDRA", "SANDRINE", "SERGE", "SOPHIE", "STÉPHANE", "STÉPHANIE", "SUZANNE", "SYLVIE", "SÉBASTIEN", "THIERRY", "THOMAS", "THÉO", "VALÉRIE", "VIRGINIE", "VÉRONIQUE", "YVETTE", "YVONNE"]; - const array LAST_NAMES = ["Adam", "Andre", "Antoine", "Arnaud", "Aubert", "Aubry", "Bailly", "Barbier", "Baron", "Barre", "Barthelemy", "Benard", "Benoit", "Berger", "Bernard", "Bertin", "Bertrand", "Besson", "Blanc", "Blanchard", "Bonnet", "Boucher", "Bouchet", "Boulanger", "Bourgeois", "Bouvier", "Boyer", "Breton", "Brun", "Brunet", "Carlier", "Caron", "Carpentier", "Carre", "Charles", "Charpentier", "Chauvin", "Chevalier", "Chevallier", "Clement", "Colin", "Collet", "Collin", "Cordier", "Cousin", "Da Silva", "Daniel", "David", "Delaunay", "Denis", "Deschamps", "Dubois", "Dufour", "Dumas", "Dumont", "Dupont", "Dupuis", "Dupuy", "Durand", "Duval", "Etienne", "Fabre", "Faure", "Fernandez", "Fleury", "Fontaine", "Fournier", "Francois", "Gaillard", "Garcia", "Garnier", "Gauthier", "Gautier", "Gay", "Gerard", "Germain", "Gilbert", "Gillet", "Girard", "Giraud", "Gonzalez", "Grondin", "Guerin", "Guichard", "Guillaume", "Guillot", "Guyot", "Hamon", "Henry", "Herve", "Hoarau", "Hubert", "Huet", "Humbert", "Jacob", "Jacquet", "Jean", "Joly", "Julien", "Klein", "Lacroix", "Lambert", "Lamy", "Langlois", "Laporte", "Laurent", "Le Gall", "Le Goff", "Le Roux", "Leblanc", "Lebrun", "Leclerc", "Leclercq", "Lecomte", "Lefebvre", "Lefevre", "Leger", "Legrand", "Lejeune", "Lemaire", "Lemaitre", "Lemoine", "Leroux", "Leroy", "Leveque", "Lopez", "Louis", "Lucas", "Maillard", "Mallet", "Marchal", "Marchand", "Marechal", "Marie", "Martin", "Martinez", "Marty", "Masson", "Mathieu", "Menard", "Mercier", "Meunier", "Meyer", "Michaud", "Michel", "Millet", "Monnier", "Moreau", "Morel", "Morin", "Moulin", "Muller", "Nicolas", "Noel", "Olivier", "Paris", "Pasquier", "Payet", "Pelletier", "Perez", "Perret", "Perrier", "Perrin", "Perrot", "Petit", "Philippe", "Picard", "Pichon", "Pierre", "Poirier", "Poulain", "Prevost", "Remy", "Renard", "Renaud", "Renault", "Rey", "Reynaud", "Richard", "Riviere", "Robert", "Robin", "Roche", "Rodriguez", "Roger", "Rolland", "Rousseau", "Roussel", "Roux", "Roy", "Royer", "Sanchez", "Schmitt", "Schneider", "Simon", "Tessier", "Thomas", "Vasseur", "Vidal", "Vincent", "Weber"]; + public const array FIRST_NAMES = ["ALAIN", "ALEXANDRE", "ANDRÉ", "ANNIE", "ANTHONY", "AUDREY", "AURÉLIE", "BERNARD", "BRIGITTE", "BRUNO", "CATHERINE", "CEDRIC", "CHANTAL", "CHRISTELLE", "CHRISTIAN", "CHRISTIANE", "CHRISTINE", "CHRISTOPHE", "CLAUDE", "CORINNE", "CÉLINE", "DANIEL", "DANIELLE", "DAVID", "DENISE", "DIDIER", "DOMINIQUE", "ELODIE", "EMILIE", "ENZO", "ERIC", "FABRICE", "FLORENCE", "FRANCK", "FRANÇOISE", "FRÉDÉRIC", "GEORGES", "GERMAINE", "GUILLAUME", "GUY", "GÉRARD", "HENRI", "ISABELLE", "JACQUELINE", "JACQUES", "JEAN", "JEAN-CLAUDE", "JEAN-PIERRE", "JEANNE", "JEANNINE", "JEREMY", "JEROME", "JONATHAN", "JOSEPH", "JULIE", "JULIEN", "KARINE", "KEVIN", "LAETITIA", "LAURA", "LAURENCE", "LAURENT", "LOUIS", "LUCAS", "LÉA", "MADELEINE", "MANON", "MARCEL", "MARCELLE", "MARGUERITE", "MARIE", "MARINE", "MARTINE", "MAURICE", "MAXIME", "MICHEL", "MICHÈLE", "MONIQUE", "NATHALIE", "NICOLAS", "NICOLE", "ODETTE", "OLIVIER", "PASCAL", "PASCALE", "PATRICIA", "PATRICK", "PAUL", "PAULETTE", "PHILIPPE", "PIERRE", "RENÉ", "ROBERT", "ROGER", "ROMAIN", "SANDRA", "SANDRINE", "SERGE", "SOPHIE", "STÉPHANE", "STÉPHANIE", "SUZANNE", "SYLVIE", "SÉBASTIEN", "THIERRY", "THOMAS", "THÉO", "VALÉRIE", "VIRGINIE", "VÉRONIQUE", "YVETTE", "YVONNE"]; + public const array LAST_NAMES = ["Adam", "Andre", "Antoine", "Arnaud", "Aubert", "Aubry", "Bailly", "Barbier", "Baron", "Barre", "Barthelemy", "Benard", "Benoit", "Berger", "Bernard", "Bertin", "Bertrand", "Besson", "Blanc", "Blanchard", "Bonnet", "Boucher", "Bouchet", "Boulanger", "Bourgeois", "Bouvier", "Boyer", "Breton", "Brun", "Brunet", "Carlier", "Caron", "Carpentier", "Carre", "Charles", "Charpentier", "Chauvin", "Chevalier", "Chevallier", "Clement", "Colin", "Collet", "Collin", "Cordier", "Cousin", "Da Silva", "Daniel", "David", "Delaunay", "Denis", "Deschamps", "Dubois", "Dufour", "Dumas", "Dumont", "Dupont", "Dupuis", "Dupuy", "Durand", "Duval", "Etienne", "Fabre", "Faure", "Fernandez", "Fleury", "Fontaine", "Fournier", "Francois", "Gaillard", "Garcia", "Garnier", "Gauthier", "Gautier", "Gay", "Gerard", "Germain", "Gilbert", "Gillet", "Girard", "Giraud", "Gonzalez", "Grondin", "Guerin", "Guichard", "Guillaume", "Guillot", "Guyot", "Hamon", "Henry", "Herve", "Hoarau", "Hubert", "Huet", "Humbert", "Jacob", "Jacquet", "Jean", "Joly", "Julien", "Klein", "Lacroix", "Lambert", "Lamy", "Langlois", "Laporte", "Laurent", "Le Gall", "Le Goff", "Le Roux", "Leblanc", "Lebrun", "Leclerc", "Leclercq", "Lecomte", "Lefebvre", "Lefevre", "Leger", "Legrand", "Lejeune", "Lemaire", "Lemaitre", "Lemoine", "Leroux", "Leroy", "Leveque", "Lopez", "Louis", "Lucas", "Maillard", "Mallet", "Marchal", "Marchand", "Marechal", "Marie", "Martin", "Martinez", "Marty", "Masson", "Mathieu", "Menard", "Mercier", "Meunier", "Meyer", "Michaud", "Michel", "Millet", "Monnier", "Moreau", "Morel", "Morin", "Moulin", "Muller", "Nicolas", "Noel", "Olivier", "Paris", "Pasquier", "Payet", "Pelletier", "Perez", "Perret", "Perrier", "Perrin", "Perrot", "Petit", "Philippe", "Picard", "Pichon", "Pierre", "Poirier", "Poulain", "Prevost", "Remy", "Renard", "Renaud", "Renault", "Rey", "Reynaud", "Richard", "Riviere", "Robert", "Robin", "Roche", "Rodriguez", "Roger", "Rolland", "Rousseau", "Roussel", "Roux", "Roy", "Royer", "Sanchez", "Schmitt", "Schneider", "Simon", "Tessier", "Thomas", "Vasseur", "Vidal", "Vincent", "Weber"]; /** * @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services @@ -63,7 +63,7 @@ final class UserFactory extends ModelFactory protected function initialize(): self { return $this - ->afterInstantiate(function(User $user): void { + ->afterInstantiate(function (User $user): void { $user->setPassword($this->passwordHasher->hashPassword( $user, $user->getPassword() diff --git a/src/Interface/ContentProviderInterface.php b/src/Interface/ContentProviderInterface.php index eebf209..bc577c4 100644 --- a/src/Interface/ContentProviderInterface.php +++ b/src/Interface/ContentProviderInterface.php @@ -6,6 +6,6 @@ use App\Entity\Manga; interface ContentProviderInterface { - public function getAvailableContent(Manga $manga): array; - public function getContent(Manga $manga): array; + public function getAvailableContent(Manga $manga): array; + public function getContent(Manga $manga): array; } diff --git a/src/Kernel.php b/src/Kernel.php index 1b0686b..fd10ba9 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -17,7 +17,7 @@ class Kernel extends BaseKernel #[Override] protected function build(ContainerBuilder $container): void { - $container->addCompilerPass(new class() implements CompilerPassInterface { + $container->addCompilerPass(new class () implements CompilerPassInterface { public function process(ContainerBuilder $container): void { $container->getDefinition('doctrine.orm.default_configuration') diff --git a/src/Manager/Toolbar/Element/ToolbarButton.php b/src/Manager/Toolbar/Element/ToolbarButton.php index 924c420..fceaae6 100644 --- a/src/Manager/Toolbar/Element/ToolbarButton.php +++ b/src/Manager/Toolbar/Element/ToolbarButton.php @@ -4,7 +4,6 @@ namespace App\Manager\Toolbar\Element; class ToolbarButton extends AbstractToolbarElement { - protected array $data; public function __construct(string $icon, string $label, string $action, array $data = []) diff --git a/src/Message/RefreshAndDownloadChapters.php b/src/Message/RefreshAndDownloadChapters.php index 88648e4..2631a8e 100644 --- a/src/Message/RefreshAndDownloadChapters.php +++ b/src/Message/RefreshAndDownloadChapters.php @@ -9,15 +9,15 @@ final class RefreshAndDownloadChapters * to hold the data for this message class. */ -// private $name; + // private $name; -// public function __construct(string $name) -// { -// $this->name = $name; -// } + // public function __construct(string $name) + // { + // $this->name = $name; + // } -// public function getName(): string -// { -// return $this->name; -// } + // public function getName(): string + // { + // return $this->name; + // } } diff --git a/src/MessageHandler/RefreshAndDownloadChaptersHandler.php b/src/MessageHandler/RefreshAndDownloadChaptersHandler.php index 323d2e6..cb655f3 100644 --- a/src/MessageHandler/RefreshAndDownloadChaptersHandler.php +++ b/src/MessageHandler/RefreshAndDownloadChaptersHandler.php @@ -21,8 +21,7 @@ final readonly class RefreshAndDownloadChaptersHandler private MangadexProvider $mangadexProvider, private EntityManagerInterface $entityManager, private MessageBusInterface $bus - ) - { + ) { } diff --git a/src/MessageHandler/RefreshMetadataHandler.php b/src/MessageHandler/RefreshMetadataHandler.php index 86b6bc4..d63abd7 100644 --- a/src/MessageHandler/RefreshMetadataHandler.php +++ b/src/MessageHandler/RefreshMetadataHandler.php @@ -18,8 +18,7 @@ readonly class RefreshMetadataHandler private MangadexProvider $mangadexProvider, private EntityManagerInterface $entityManager, private NotificationService $notificationService - ) - { + ) { } public function __invoke(RefreshMetadata $message): void diff --git a/src/Repository/ApiTokenRepository.php b/src/Repository/ApiTokenRepository.php index f5877da..60918e7 100644 --- a/src/Repository/ApiTokenRepository.php +++ b/src/Repository/ApiTokenRepository.php @@ -21,28 +21,28 @@ class ApiTokenRepository extends ServiceEntityRepository parent::__construct($registry, ApiToken::class); } -// /** -// * @return ApiToken[] Returns an array of ApiToken objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('a') -// ->andWhere('a.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('a.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return ApiToken[] Returns an array of ApiToken objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('a') + // ->andWhere('a.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('a.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?ApiToken -// { -// return $this->createQueryBuilder('a') -// ->andWhere('a.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?ApiToken + // { + // return $this->createQueryBuilder('a') + // ->andWhere('a.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Repository/AppSettingsRepository.php b/src/Repository/AppSettingsRepository.php index 196b8e4..94fac81 100644 --- a/src/Repository/AppSettingsRepository.php +++ b/src/Repository/AppSettingsRepository.php @@ -21,28 +21,28 @@ class AppSettingsRepository extends ServiceEntityRepository parent::__construct($registry, AppSettings::class); } -// /** -// * @return AppSettings[] Returns an array of AppSettings objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('a') -// ->andWhere('a.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('a.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return AppSettings[] Returns an array of AppSettings objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('a') + // ->andWhere('a.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('a.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?AppSettings -// { -// return $this->createQueryBuilder('a') -// ->andWhere('a.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?AppSettings + // { + // return $this->createQueryBuilder('a') + // ->andWhere('a.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Repository/ChapterRepository.php b/src/Repository/ChapterRepository.php index ce25575..9761bff 100644 --- a/src/Repository/ChapterRepository.php +++ b/src/Repository/ChapterRepository.php @@ -39,28 +39,28 @@ class ChapterRepository extends ServiceEntityRepository } } -// /** -// * @return Chapter[] Returns an array of Chapter objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('c') -// ->andWhere('c.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('c.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return Chapter[] Returns an array of Chapter objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('c.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?Chapter -// { -// return $this->createQueryBuilder('c') -// ->andWhere('c.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?Chapter + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Repository/ContentSourceRepository.php b/src/Repository/ContentSourceRepository.php index 21606f0..c33f0b6 100644 --- a/src/Repository/ContentSourceRepository.php +++ b/src/Repository/ContentSourceRepository.php @@ -21,28 +21,28 @@ class ContentSourceRepository extends ServiceEntityRepository parent::__construct($registry, ContentSource::class); } -// /** -// * @return ContentSource[] Returns an array of ContentSource objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('c') -// ->andWhere('c.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('c.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return ContentSource[] Returns an array of ContentSource objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('c.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?ContentSource -// { -// return $this->createQueryBuilder('c') -// ->andWhere('c.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?ContentSource + // { + // return $this->createQueryBuilder('c') + // ->andWhere('c.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Repository/MangaRepository.php b/src/Repository/MangaRepository.php index 0549798..6d75fe3 100644 --- a/src/Repository/MangaRepository.php +++ b/src/Repository/MangaRepository.php @@ -116,28 +116,28 @@ class MangaRepository extends ServiceEntityRepository return $qb->getQuery()->getResult(); } -// /** -// * @return Manga[] Returns an array of Manga objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('m') -// ->andWhere('m.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('m.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return Manga[] Returns an array of Manga objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('m') + // ->andWhere('m.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('m.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?Manga -// { -// return $this->createQueryBuilder('m') -// ->andWhere('m.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?Manga + // { + // return $this->createQueryBuilder('m') + // ->andWhere('m.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Repository/PageRepository.php b/src/Repository/PageRepository.php index f6ca4d0..d31c3c0 100644 --- a/src/Repository/PageRepository.php +++ b/src/Repository/PageRepository.php @@ -39,28 +39,28 @@ class PageRepository extends ServiceEntityRepository } } -// /** -// * @return Page[] Returns an array of Page objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('p') -// ->andWhere('p.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('p.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return Page[] Returns an array of Page objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('p') + // ->andWhere('p.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('p.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?Page -// { -// return $this->createQueryBuilder('p') -// ->andWhere('p.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?Page + // { + // return $this->createQueryBuilder('p') + // ->andWhere('p.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Repository/SourceRepository.php b/src/Repository/SourceRepository.php index 3ccc4d3..a679459 100644 --- a/src/Repository/SourceRepository.php +++ b/src/Repository/SourceRepository.php @@ -39,28 +39,28 @@ class SourceRepository extends ServiceEntityRepository } } -// /** -// * @return Source[] Returns an array of Source objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('s') -// ->andWhere('s.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('s.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return Source[] Returns an array of Source objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('s') + // ->andWhere('s.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('s.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?Source -// { -// return $this->createQueryBuilder('s') -// ->andWhere('s.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?Source + // { + // return $this->createQueryBuilder('s') + // ->andWhere('s.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php index c788f46..50a7511 100644 --- a/src/Repository/UserRepository.php +++ b/src/Repository/UserRepository.php @@ -40,28 +40,28 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader $this->getEntityManager()->flush(); } -// /** -// * @return User[] Returns an array of User objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('u') -// ->andWhere('u.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('u.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return User[] Returns an array of User objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('u') + // ->andWhere('u.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('u.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?User -// { -// return $this->createQueryBuilder('u') -// ->andWhere('u.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?User + // { + // return $this->createQueryBuilder('u') + // ->andWhere('u.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Scheduler/MainSchedule.php b/src/Scheduler/MainSchedule.php index 80793c6..d770d28 100644 --- a/src/Scheduler/MainSchedule.php +++ b/src/Scheduler/MainSchedule.php @@ -12,7 +12,6 @@ use Symfony\Contracts\Cache\CacheInterface; #[AsSchedule] class MainSchedule implements ScheduleProviderInterface { - public function __construct(private CacheInterface $cache) { } diff --git a/src/Security/ApiTokenHandler.php b/src/Security/ApiTokenHandler.php index b83bc95..8598955 100644 --- a/src/Security/ApiTokenHandler.php +++ b/src/Security/ApiTokenHandler.php @@ -10,7 +10,6 @@ use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; readonly class ApiTokenHandler implements AccessTokenHandlerInterface { - public function __construct(private ApiTokenRepository $apiTokenRepository) { @@ -24,7 +23,7 @@ readonly class ApiTokenHandler implements AccessTokenHandlerInterface throw new BadCredentialsException(); } - if(!$token->isValid()){ + if(!$token->isValid()) { throw new CustomUserMessageAuthenticationException('Token expired'); } diff --git a/src/Service/CbrToCbzConverter.php b/src/Service/CbrToCbzConverter.php index 6667e96..7fe41cb 100644 --- a/src/Service/CbrToCbzConverter.php +++ b/src/Service/CbrToCbzConverter.php @@ -41,7 +41,7 @@ class CbrToCbzConverter $cbzFileName = pathinfo($cbrPath, PATHINFO_FILENAME) . '.cbz'; $cbzPath = $this->tempDir . '/' . $cbzFileName; $zip = new \ZipArchive(); - if ($zip->open($cbzPath, \ZipArchive::CREATE) !== TRUE) { + if ($zip->open($cbzPath, \ZipArchive::CREATE) !== true) { throw new \RuntimeException("Cannot create ZIP file"); } diff --git a/src/Service/MangaImportService.php b/src/Service/MangaImportService.php index 0556701..25411a4 100644 --- a/src/Service/MangaImportService.php +++ b/src/Service/MangaImportService.php @@ -17,8 +17,7 @@ readonly class MangaImportService private EntityManagerInterface $entityManager, private ChapterRepository $chapterRepository, private SluggerInterface $slugger - ) - { + ) { } /** diff --git a/src/Service/MangaScraperService.php b/src/Service/MangaScraperService.php index 3038ad5..dbbcfbd 100644 --- a/src/Service/MangaScraperService.php +++ b/src/Service/MangaScraperService.php @@ -26,15 +26,14 @@ use Symfony\Component\Panther\Client as PantherClient; class MangaScraperService { - const string PUBLIC_CBZ = '/public/cbz'; + public const string PUBLIC_CBZ = '/public/cbz'; public function __construct( private readonly string $projectDir, private readonly EventDispatcherInterface $eventDispatcher, private readonly EntityManagerInterface $entityManager, private readonly MangaRepository $mangaRepository, - ) - { + ) { } private function extractMangaPageData(string $html, ContentSource $mangaSource): array @@ -43,11 +42,11 @@ class MangaScraperService $imgUrl = $crawler->filter($mangaSource->getImageSelector())->attr('src') ?? $crawler->filter($mangaSource->getImageSelector())->attr('data-src'); -// dd($imgUrl); + // dd($imgUrl); -// if (empty($imgUrl)) { -// throw new \Exception('No valid image found on the page.'); -// } + // if (empty($imgUrl)) { + // throw new \Exception('No valid image found on the page.'); + // } $nextLink = $crawler->filter($mangaSource->getNextPageSelector()); $nextUrl = $nextLink->count() > 0 ? $nextLink->attr('href') : null; @@ -204,7 +203,7 @@ class MangaScraperService } } } catch (\Exception $e) { -// $this->logger->warning('Erreur lors de la sélection du chapitre : ' . $e->getMessage()); + // $this->logger->warning('Erreur lors de la sélection du chapitre : ' . $e->getMessage()); $pantherClient->close(); return false; } @@ -221,7 +220,7 @@ class MangaScraperService } } catch (\Exception $e) { throw $e; -// $this->logger->warning('Erreur lors du scraping du chapitre ' . $chapter->getNumber() . ' du manga ' . $manga->getTitle() . ': ' . $e->getMessage()); + // $this->logger->warning('Erreur lors du scraping du chapitre ' . $chapter->getNumber() . ' du manga ' . $manga->getTitle() . ': ' . $e->getMessage()); } finally { $pantherClient->close(); } @@ -295,7 +294,7 @@ class MangaScraperService $pageNumber++; } catch (\Exception $e) { throw $e; -// $this->logger->warning('Erreur lors du scraping de la page ' . $pageNumber . ' du chapitre ' . $chapter->getNumber() . ': ' . $e->getMessage()); + // $this->logger->warning('Erreur lors du scraping de la page ' . $pageNumber . ' du chapitre ' . $chapter->getNumber() . ': ' . $e->getMessage()); break; } } @@ -308,10 +307,10 @@ class MangaScraperService // Appeler le script Puppeteer avec les paramètres nécessaires $output = []; $command = sprintf('node puppeteer-script.js "%s" "%s" "%s" 2>&1', $url, $imageSelector, $nextButtonSelector); // Redirect stderr to stdout -// dump($command); -// exec($command, $output, $return_var); + // dump($command); + // exec($command, $output, $return_var); -// dd($command, $output); + // dd($command, $output); // Convertir la sortie JSON en tableau PHP return json_decode(implode("", $output), true); @@ -455,8 +454,8 @@ class MangaScraperService $this->downloadAndSaveImage($imgUrl, $imagePath); -// $event = new PageScrappingProgressEvent($chapter->getId(), $index + 1, 0); -// $this->eventDispatcher->dispatch($event, PageScrappingProgressEvent::NAME); + // $event = new PageScrappingProgressEvent($chapter->getId(), $index + 1, 0); + // $this->eventDispatcher->dispatch($event, PageScrappingProgressEvent::NAME); $pageData[] = [ 'image_url' => $imgUrl, @@ -516,13 +515,13 @@ class MangaScraperService if (str_starts_with($contentType, 'image/')) { file_put_contents($destinationPath, $response->getBody()->getContents()); -// if ($this->scrapingType === 'mangadex') { -// $this->sendReport($imageUrl, true, $isCached, (int)$contentLength, ($endTime - $startTime) * 1000); -// } + // if ($this->scrapingType === 'mangadex') { + // $this->sendReport($imageUrl, true, $isCached, (int)$contentLength, ($endTime - $startTime) * 1000); + // } } else { -// if ($this->scrapingType === 'mangadex') { -// $this->sendReport($imageUrl, false, $isCached, (int)$contentLength, ($endTime - $startTime) * 1000); -// } + // if ($this->scrapingType === 'mangadex') { + // $this->sendReport($imageUrl, false, $isCached, (int)$contentLength, ($endTime - $startTime) * 1000); + // } throw new \Exception('Le contenu récupéré n\'est pas une image. Type de contenu : ' . $contentType); } } catch @@ -582,7 +581,7 @@ class MangaScraperService { $zip = new \ZipArchive(); - if ($zip->open($cbzFilePath, \ZipArchive::CREATE) === TRUE) { + if ($zip->open($cbzFilePath, \ZipArchive::CREATE) === true) { foreach ($pageData as $page) { $zip->addFile($page['local_image_url'], basename($page['local_image_url'])); } @@ -593,7 +592,8 @@ class MangaScraperService private function generateCbzPath(Manga $manga, Chapter $chapter): string { $volumeDir = $this->createDirectories($manga, $chapter->getVolume()); - $fileName = sprintf('%s_vol%d_ch%s.cbz', + $fileName = sprintf( + '%s_vol%d_ch%s.cbz', $manga->getSlug(), $chapter->getVolume(), $chapter->getNumber() diff --git a/src/Service/Scraper/AbstractScraper.php b/src/Service/Scraper/AbstractScraper.php index dea8e16..f16febe 100644 --- a/src/Service/Scraper/AbstractScraper.php +++ b/src/Service/Scraper/AbstractScraper.php @@ -54,7 +54,8 @@ abstract class AbstractScraper implements ScraperInterface { $mangaDir = $this->fileSystemManager->createMangaDirectory($manga->getSlug(), $manga->getPublicationYear()); $volumeDir = $this->fileSystemManager->createVolumeDirectory($mangaDir, $chapter->getVolume()); - $fileName = sprintf('%s_vol%d_ch%s.cbz', + $fileName = sprintf( + '%s_vol%d_ch%s.cbz', $manga->getSlug(), $chapter->getVolume(), $chapter->getNumber() diff --git a/src/Twig/Components/DownloadChapter.php b/src/Twig/Components/DownloadChapter.php index f33c10a..43c4274 100644 --- a/src/Twig/Components/DownloadChapter.php +++ b/src/Twig/Components/DownloadChapter.php @@ -21,10 +21,10 @@ final class DownloadChapter public function downloadChapter(MangaRepository $mangaRepository, ChapterRepository $chapterRepository): int { -// $mangaSlug = $this->mangaSlug; -// $chapter = $this->chapter; -// $manga = $mangaRepository->findOneBy(['slug' => $mangaSlug]); -// $chapter = $chapterRepository->findOneBy(['manga' => $manga, 'number' => $chapter]); + // $mangaSlug = $this->mangaSlug; + // $chapter = $this->chapter; + // $manga = $mangaRepository->findOneBy(['slug' => $mangaSlug]); + // $chapter = $chapterRepository->findOneBy(['manga' => $manga, 'number' => $chapter]); return 0; diff --git a/src/Twig/Components/DropdownMenu.php b/src/Twig/Components/DropdownMenu.php index eee97e3..8b5cba2 100644 --- a/src/Twig/Components/DropdownMenu.php +++ b/src/Twig/Components/DropdownMenu.php @@ -11,6 +11,6 @@ class DropdownMenu { use DefaultActionTrait; - #[LiveProp (writable: true)] + #[LiveProp(writable: true)] public ?array $items = null; } diff --git a/src/Twig/Components/Search.php b/src/Twig/Components/Search.php index 5652231..9ddfede 100644 --- a/src/Twig/Components/Search.php +++ b/src/Twig/Components/Search.php @@ -14,7 +14,7 @@ final class Search { use DefaultActionTrait; - #[LiveProp (writable: true)] + #[LiveProp(writable: true)] public ?string $query = null; public function __construct(private readonly MangaRepository $mangaRepository) diff --git a/src/Twig/Components/ToolBarButton.php b/src/Twig/Components/ToolBarButton.php index 45725ab..23b5676 100644 --- a/src/Twig/Components/ToolBarButton.php +++ b/src/Twig/Components/ToolBarButton.php @@ -10,6 +10,6 @@ use Symfony\UX\LiveComponent\DefaultActionTrait; final class ToolBarButton { use DefaultActionTrait; - #[LiveProp (writable: true)] + #[LiveProp(writable: true)] public ?array $data = null; }