2024-12-30 01:51:28 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Service\MediaProcessing;
|
|
|
|
|
|
|
|
|
|
use App\Models\ItemToFetch;
|
|
|
|
|
|
|
|
|
|
class FactoryService
|
|
|
|
|
{
|
|
|
|
|
private MovieProcessingService $movieProcessingService;
|
|
|
|
|
private ShowProcessingService $showProcessingService;
|
|
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
|
MovieProcessingService $movieProcessingService,
|
|
|
|
|
ShowProcessingService $showProcessingService
|
|
|
|
|
) {
|
|
|
|
|
$this->movieProcessingService = $movieProcessingService;
|
|
|
|
|
$this->showProcessingService = $showProcessingService;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-10 01:58:12 +02:00
|
|
|
public function process($item, string $job, $type)
|
2024-12-30 01:51:28 +02:00
|
|
|
{
|
2025-02-10 01:58:12 +02:00
|
|
|
switch ($type) {
|
2024-12-30 01:51:28 +02:00
|
|
|
case ItemToFetch::TYPE_MOVIE:
|
|
|
|
|
return $this->movieProcessingService->process($item, $job);
|
|
|
|
|
case ItemToFetch::TYPE_TV_SERIES:
|
|
|
|
|
return $this->showProcessingService->process($item, $job);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|