fix: phpcs-fixer
This commit is contained in:
parent
ba874480ee
commit
c55cd62ec7
@@ -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
|
||||
|
||||
@@ -17,8 +17,7 @@ class ConversionController extends AbstractController
|
||||
public function __construct(
|
||||
private readonly CbrToCbzConverter $cbrToCbzConverter,
|
||||
private readonly NotificationService $notificationService
|
||||
)
|
||||
{
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/convert', name: 'app_convert')]
|
||||
|
||||
@@ -27,8 +27,7 @@ class ImportController extends AbstractController
|
||||
private readonly NotificationService $notificationService,
|
||||
private readonly MangaRepository $mangaRepository,
|
||||
private readonly CbrToCbzConverter $cbrToCbzConverter
|
||||
)
|
||||
{
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user