fix: phpcs-fixer

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-05 21:32:04 +01:00
parent ba874480ee
commit c55cd62ec7
65 changed files with 346 additions and 355 deletions

View File

@@ -10,7 +10,6 @@ use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
#[AsDecorator('api_platform.openapi.factory')] #[AsDecorator('api_platform.openapi.factory')]
class OpenApiFactoryDecorator implements OpenApiFactoryInterface class OpenApiFactoryDecorator implements OpenApiFactoryInterface
{ {
public function __construct(private OpenApiFactoryInterface $decorated) public function __construct(private OpenApiFactoryInterface $decorated)
{ {
} }

View File

@@ -7,8 +7,8 @@ use GuzzleHttp\ClientInterface as GuzzleInterface;
class MangadexClient implements ClientInterface class MangadexClient implements ClientInterface
{ {
private CONST AUTHENTICATION_URL = 'https://auth.mangadex.org/realms/mangadex/protocol/openid-connect/token'; private const AUTHENTICATION_URL = 'https://auth.mangadex.org/realms/mangadex/protocol/openid-connect/token';
private CONST API_URL = 'https://api.mangadex.org'; private const API_URL = 'https://api.mangadex.org';
private GuzzleInterface $httpClient; private GuzzleInterface $httpClient;
private string $clientId; private string $clientId;
private string $clientSecret; private string $clientSecret;

View File

@@ -19,8 +19,7 @@ class ActivityController extends AbstractController
private readonly Connection $connection, private readonly Connection $connection,
private readonly ChapterRepository $chapterRepository, private readonly ChapterRepository $chapterRepository,
private readonly ToolbarFactory $toolbarFactory private readonly ToolbarFactory $toolbarFactory
) ) {
{
} }

View File

@@ -17,8 +17,7 @@ class ConversionController extends AbstractController
public function __construct( public function __construct(
private readonly CbrToCbzConverter $cbrToCbzConverter, private readonly CbrToCbzConverter $cbrToCbzConverter,
private readonly NotificationService $notificationService private readonly NotificationService $notificationService
) ) {
{
} }
#[Route('/convert', name: 'app_convert')] #[Route('/convert', name: 'app_convert')]

View File

@@ -27,8 +27,7 @@ class ImportController extends AbstractController
private readonly NotificationService $notificationService, private readonly NotificationService $notificationService,
private readonly MangaRepository $mangaRepository, private readonly MangaRepository $mangaRepository,
private readonly CbrToCbzConverter $cbrToCbzConverter private readonly CbrToCbzConverter $cbrToCbzConverter
) ) {
{
} }

View File

@@ -49,8 +49,7 @@ class MangaController extends AbstractController
private readonly EntityManagerInterface $entityManager, private readonly EntityManagerInterface $entityManager,
private readonly NotificationService $notificationService, private readonly NotificationService $notificationService,
private readonly ContentSourceRepository $contentSourceRepository private readonly ContentSourceRepository $contentSourceRepository
) ) {
{
$this->imageManager = new ImageManager(new Driver()); $this->imageManager = new ImageManager(new Driver());
} }
@@ -135,8 +134,7 @@ class MangaController extends AbstractController
Request $request, Request $request,
Manga $manga, Manga $manga,
ContentSourceRepository $contentSourceRepository ContentSourceRepository $contentSourceRepository
): JsonResponse ): JsonResponse {
{
$data = json_decode($request->getContent(), true); $data = json_decode($request->getContent(), true);
$preferredSourceIds = $data['preferredSources'] ?? []; $preferredSourceIds = $data['preferredSources'] ?? [];

View File

@@ -16,8 +16,7 @@ class ReaderController extends AbstractController
private readonly MangaRepository $mangaRepository, private readonly MangaRepository $mangaRepository,
private readonly CbzService $cbzService, private readonly CbzService $cbzService,
private readonly NotificationService $notificationService, private readonly NotificationService $notificationService,
) ) {
{
} }
#[Route('/read/{mangaSlug}/{chapterNumber}', name: 'app_reader')] #[Route('/read/{mangaSlug}/{chapterNumber}', name: 'app_reader')]

View File

@@ -26,8 +26,7 @@ class SettingsController extends AbstractController
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private NotificationService $notificationService, private NotificationService $notificationService,
private ContentSourceRepository $contentSourceRepository private ContentSourceRepository $contentSourceRepository
) ) {
{
} }

View File

@@ -34,8 +34,7 @@ class TestController extends AbstractController
private string $projectDir, private string $projectDir,
private SluggerInterface $slugger, private SluggerInterface $slugger,
private MangaRepository $mangaRepository private MangaRepository $mangaRepository
) ) {
{
$this->imageManager = new ImageManager(new Driver()); $this->imageManager = new ImageManager(new Driver());
} }

View File

@@ -7,7 +7,8 @@ class ChapterScrapingCompleted
public function __construct( public function __construct(
private readonly string $jobId, private readonly string $jobId,
private readonly array $scrapedPages private readonly array $scrapedPages
) {} ) {
}
public function getJobId(): string public function getJobId(): string
{ {

View File

@@ -7,7 +7,8 @@ class ChapterScrapingFailed
public function __construct( public function __construct(
private readonly string $chapterId, private readonly string $chapterId,
private readonly string $reason private readonly string $reason
) {} ) {
}
public function getChapterId(): string public function getChapterId(): string
{ {

View File

@@ -6,7 +6,8 @@ class ChapterScrapingStarted
{ {
public function __construct( public function __construct(
private readonly string $jobId private readonly string $jobId
) {} ) {
}
public function getJobId(): string public function getJobId(): string
{ {

View File

@@ -9,7 +9,8 @@ class PageScrapingProgressed
public function __construct( public function __construct(
private readonly string $jobId, private readonly string $jobId,
private readonly ScrapingProgress $progress private readonly ScrapingProgress $progress
) {} ) {
}
public function getJobId(): string public function getJobId(): string
{ {

View File

@@ -10,7 +10,8 @@ class Manga
private readonly string $slug, private readonly string $slug,
private readonly string $description, private readonly string $description,
private readonly string $author, private readonly string $author,
) {} ) {
}
public function getId(): string public function getId(): string
{ {

View File

@@ -7,7 +7,8 @@ class ScrapingProgress
public function __construct( public function __construct(
private readonly int $pagesScraped, private readonly int $pagesScraped,
private readonly int $totalPages private readonly int $totalPages
) {} ) {
}
public function getPercentage(): float public function getPercentage(): float
{ {

View File

@@ -15,7 +15,8 @@ class Source
private readonly bool $isActive, private readonly bool $isActive,
private readonly DateTimeImmutable $createdAt, private readonly DateTimeImmutable $createdAt,
private readonly DateTimeImmutable $updatedAt private readonly DateTimeImmutable $updatedAt
) {} ) {
}
public function getId(): string public function getId(): string
{ {

View File

@@ -24,11 +24,9 @@ readonly class ScrapeChapterRequest
#[ApiProperty(description: 'ID du chapitre à scraper')] #[ApiProperty(description: 'ID du chapitre à scraper')]
#[Assert\NotBlank] #[Assert\NotBlank]
public string $chapterId, public string $chapterId,
#[ApiProperty(description: 'ID de la source à utiliser')] #[ApiProperty(description: 'ID de la source à utiliser')]
#[Assert\NotBlank] #[Assert\NotBlank]
public string $sourceId, public string $sourceId,
#[ApiProperty(description: 'ID du manga')] #[ApiProperty(description: 'ID du manga')]
#[Assert\NotBlank] #[Assert\NotBlank]
public string $mangaId, public string $mangaId,

View File

@@ -31,13 +31,10 @@ readonly class ScrapingStatusResponse
public function __construct( public function __construct(
#[ApiProperty(identifier: true)] #[ApiProperty(identifier: true)]
public string $jobId, public string $jobId,
#[ApiProperty] #[ApiProperty]
public string $status, public string $status,
#[ApiProperty] #[ApiProperty]
public ?float $progress = null, public ?float $progress = null,
#[ApiProperty] #[ApiProperty]
public ?string $error = null public ?string $error = null
) { ) {

View File

@@ -12,7 +12,8 @@ final class ScrapeChapterStateProcessor implements ProcessorInterface
{ {
public function __construct( public function __construct(
private readonly MessageBusInterface $commandBus private readonly MessageBusInterface $commandBus
) {} ) {
}
/** /**
* @param ScrapeChapterRequest $data * @param ScrapeChapterRequest $data

View File

@@ -11,7 +11,8 @@ class DoctrineMangaRepository implements MangaRepositoryInterface
{ {
public function __construct( public function __construct(
private readonly EntityManagerInterface $entityManager private readonly EntityManagerInterface $entityManager
) {} ) {
}
public function getById(string $id): ?Manga public function getById(string $id): ?Manga
{ {

View File

@@ -11,7 +11,8 @@ class DoctrineSourceRepository implements SourceRepositoryInterface
{ {
public function __construct( public function __construct(
private readonly EntityManagerInterface $entityManager private readonly EntityManagerInterface $entityManager
) {} ) {
}
public function getById(string $id): ?Source public function getById(string $id): ?Source
{ {

View File

@@ -8,7 +8,8 @@ class ImageDownloader
{ {
public function __construct( public function __construct(
private readonly HttpClientInterface $httpClient private readonly HttpClientInterface $httpClient
) {} ) {
}
public function download(string $url, string $destination): void public function download(string $url, string $destination): void
{ {

View File

@@ -19,7 +19,8 @@ abstract class AbstractScraper implements ScraperInterface
public function __construct( public function __construct(
protected readonly ImageDownloader $imageDownloader, protected readonly ImageDownloader $imageDownloader,
protected readonly MessageBusInterface $eventBus protected readonly MessageBusInterface $eventBus
) {} ) {
}
public function createScrapingJob(string $mangaId, string $chapterId, string $sourceId): ScrapingJob public function createScrapingJob(string $mangaId, string $chapterId, string $sourceId): ScrapingJob
{ {

View File

@@ -9,7 +9,6 @@ use Random\RandomException;
#[ORM\Entity(repositoryClass: ApiTokenRepository::class)] #[ORM\Entity(repositoryClass: ApiTokenRepository::class)]
class ApiToken class ApiToken
{ {
private const string PERSONAL_ACCESS_TOKEN_PREFIX = 'mgr_'; private const string PERSONAL_ACCESS_TOKEN_PREFIX = 'mgr_';
public const string SCOPE_USER_EDIT = 'ROLE_USER_EDIT'; public const string SCOPE_USER_EDIT = 'ROLE_USER_EDIT';
public const string SCOPE_PROJECT_CREATE = 'ROLE_PROJECT_CREATE'; public const string SCOPE_PROJECT_CREATE = 'ROLE_PROJECT_CREATE';

View File

@@ -19,8 +19,7 @@ class QueueStatusSubscriber implements EventSubscriberInterface
private ActivityService $activityService, private ActivityService $activityService,
private Connection $connection, private Connection $connection,
private ChapterRepository $chapterRepository private ChapterRepository $chapterRepository
) ) {
{
} }
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array

View File

@@ -30,8 +30,8 @@ use Zenstruck\Foundry\RepositoryProxy;
*/ */
final class UserFactory extends ModelFactory 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"]; 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"];
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 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 * @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services

View File

@@ -4,7 +4,6 @@ namespace App\Manager\Toolbar\Element;
class ToolbarButton extends AbstractToolbarElement class ToolbarButton extends AbstractToolbarElement
{ {
protected array $data; protected array $data;
public function __construct(string $icon, string $label, string $action, array $data = []) public function __construct(string $icon, string $label, string $action, array $data = [])

View File

@@ -21,8 +21,7 @@ final readonly class RefreshAndDownloadChaptersHandler
private MangadexProvider $mangadexProvider, private MangadexProvider $mangadexProvider,
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private MessageBusInterface $bus private MessageBusInterface $bus
) ) {
{
} }

View File

@@ -18,8 +18,7 @@ readonly class RefreshMetadataHandler
private MangadexProvider $mangadexProvider, private MangadexProvider $mangadexProvider,
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private NotificationService $notificationService private NotificationService $notificationService
) ) {
{
} }
public function __invoke(RefreshMetadata $message): void public function __invoke(RefreshMetadata $message): void

View File

@@ -12,7 +12,6 @@ use Symfony\Contracts\Cache\CacheInterface;
#[AsSchedule] #[AsSchedule]
class MainSchedule implements ScheduleProviderInterface class MainSchedule implements ScheduleProviderInterface
{ {
public function __construct(private CacheInterface $cache) public function __construct(private CacheInterface $cache)
{ {
} }

View File

@@ -10,7 +10,6 @@ use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
readonly class ApiTokenHandler implements AccessTokenHandlerInterface readonly class ApiTokenHandler implements AccessTokenHandlerInterface
{ {
public function __construct(private ApiTokenRepository $apiTokenRepository) public function __construct(private ApiTokenRepository $apiTokenRepository)
{ {

View File

@@ -41,7 +41,7 @@ class CbrToCbzConverter
$cbzFileName = pathinfo($cbrPath, PATHINFO_FILENAME) . '.cbz'; $cbzFileName = pathinfo($cbrPath, PATHINFO_FILENAME) . '.cbz';
$cbzPath = $this->tempDir . '/' . $cbzFileName; $cbzPath = $this->tempDir . '/' . $cbzFileName;
$zip = new \ZipArchive(); $zip = new \ZipArchive();
if ($zip->open($cbzPath, \ZipArchive::CREATE) !== TRUE) { if ($zip->open($cbzPath, \ZipArchive::CREATE) !== true) {
throw new \RuntimeException("Cannot create ZIP file"); throw new \RuntimeException("Cannot create ZIP file");
} }

View File

@@ -17,8 +17,7 @@ readonly class MangaImportService
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private ChapterRepository $chapterRepository, private ChapterRepository $chapterRepository,
private SluggerInterface $slugger private SluggerInterface $slugger
) ) {
{
} }
/** /**

View File

@@ -26,15 +26,14 @@ use Symfony\Component\Panther\Client as PantherClient;
class MangaScraperService class MangaScraperService
{ {
const string PUBLIC_CBZ = '/public/cbz'; public const string PUBLIC_CBZ = '/public/cbz';
public function __construct( public function __construct(
private readonly string $projectDir, private readonly string $projectDir,
private readonly EventDispatcherInterface $eventDispatcher, private readonly EventDispatcherInterface $eventDispatcher,
private readonly EntityManagerInterface $entityManager, private readonly EntityManagerInterface $entityManager,
private readonly MangaRepository $mangaRepository, private readonly MangaRepository $mangaRepository,
) ) {
{
} }
private function extractMangaPageData(string $html, ContentSource $mangaSource): array private function extractMangaPageData(string $html, ContentSource $mangaSource): array
@@ -582,7 +581,7 @@ class MangaScraperService
{ {
$zip = new \ZipArchive(); $zip = new \ZipArchive();
if ($zip->open($cbzFilePath, \ZipArchive::CREATE) === TRUE) { if ($zip->open($cbzFilePath, \ZipArchive::CREATE) === true) {
foreach ($pageData as $page) { foreach ($pageData as $page) {
$zip->addFile($page['local_image_url'], basename($page['local_image_url'])); $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 private function generateCbzPath(Manga $manga, Chapter $chapter): string
{ {
$volumeDir = $this->createDirectories($manga, $chapter->getVolume()); $volumeDir = $this->createDirectories($manga, $chapter->getVolume());
$fileName = sprintf('%s_vol%d_ch%s.cbz', $fileName = sprintf(
'%s_vol%d_ch%s.cbz',
$manga->getSlug(), $manga->getSlug(),
$chapter->getVolume(), $chapter->getVolume(),
$chapter->getNumber() $chapter->getNumber()

View File

@@ -54,7 +54,8 @@ abstract class AbstractScraper implements ScraperInterface
{ {
$mangaDir = $this->fileSystemManager->createMangaDirectory($manga->getSlug(), $manga->getPublicationYear()); $mangaDir = $this->fileSystemManager->createMangaDirectory($manga->getSlug(), $manga->getPublicationYear());
$volumeDir = $this->fileSystemManager->createVolumeDirectory($mangaDir, $chapter->getVolume()); $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(), $manga->getSlug(),
$chapter->getVolume(), $chapter->getVolume(),
$chapter->getNumber() $chapter->getNumber()