38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\Domain\Manga\Adapter;
|
|
|
|
use App\Domain\Manga\Domain\Contract\Service\ChapterSynchronizationServiceInterface;
|
|
use App\Domain\Manga\Domain\Model\Manga;
|
|
|
|
class InMemoryChapterSynchronizationService implements ChapterSynchronizationServiceInterface
|
|
{
|
|
/** @var array<string, array> */
|
|
private array $synchronizedChapters = [];
|
|
|
|
public function synchronizeChapters(Manga $manga): array
|
|
{
|
|
$this->synchronizedChapters[$manga->getId()->getValue()] = [
|
|
'manga_id' => $manga->getId()->getValue(),
|
|
'external_id' => $manga->getExternalId()?->getValue(),
|
|
'synchronized_at' => new \DateTimeImmutable()
|
|
];
|
|
|
|
// Retourne les IDs des chapitres synchronisés (simulation)
|
|
return ['chapter-1', 'chapter-2'];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array>
|
|
*/
|
|
public function getSynchronizedChapters(): array
|
|
{
|
|
return $this->synchronizedChapters;
|
|
}
|
|
|
|
public function clear(): void
|
|
{
|
|
$this->synchronizedChapters = [];
|
|
}
|
|
}
|