30 lines
845 B
PHP
30 lines
845 B
PHP
<?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;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function process($item, string $job)
|
||
|
|
{
|
||
|
|
switch ($item->type) {
|
||
|
|
case ItemToFetch::TYPE_MOVIE:
|
||
|
|
return $this->movieProcessingService->process($item, $job);
|
||
|
|
case ItemToFetch::TYPE_TV_SERIES:
|
||
|
|
return $this->showProcessingService->process($item, $job);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|