feat: finalizing Scraping endpoint
This commit is contained in:
parent
0374ab0e46
commit
073439163b
@@ -12,23 +12,17 @@ class InMemoryScrapingJobRepository implements ScrapingJobRepositoryInterface
|
||||
|
||||
public function save(ScrapingJob $job): void
|
||||
{
|
||||
self::$jobs[] = $job;
|
||||
self::$jobs[$job->getId()] = $job;
|
||||
}
|
||||
|
||||
public function getJobs(): array
|
||||
{
|
||||
return self::$jobs;
|
||||
return array_values(self::$jobs);
|
||||
}
|
||||
|
||||
public function findById(string $id): ?ScrapingJob
|
||||
{
|
||||
foreach (self::$jobs as $job) {
|
||||
if ($job->getId() === $id) {
|
||||
return $job;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return self::$jobs[$id] ?? null;
|
||||
}
|
||||
|
||||
public function findByChapterId(string $chapterId): ?ScrapingJob
|
||||
@@ -46,4 +40,4 @@ class InMemoryScrapingJobRepository implements ScrapingJobRepositoryInterface
|
||||
{
|
||||
self::$jobs = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user