FileProcessingService
readonly class \
This is a general service for creating Processed Files a.k.a. processing a File object with a given configuration.
This is how it works: -> File->process(string $taskType, array $configuration) -> ResourceStorage->processFile(File $file, $taskType, array $configuration) -> FileProcessingService->processFile(File $file, $taskType, array $configuration)
This class then transforms the information of a Task through a Processor into a ProcessedFile object. For this, the DB is checked if there is a ProcessedFile which has been processed or does not need to be processed. If processing is required, a valid Processor is searched for to process the Task object (which is created from the TaskTypeRegistry when needed for processing).
A resource outside the File Abstraction Layer (for example a system resource shipped with a package) takes the same path through this method, using ProcessedResourceCache instead of ProcessedFileRepository, and TaskTypeRegistry to build its task the same way the FAL branch does - the only places the underlying storage genuinely differs. Everything after that - event dispatch, processor selection, processTask(), fileNeedsProcessing() - is the same code for both, not a duplicate of it.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Properties
- $eventDispatcher : EventDispatcherInterface
- $processedFileRepository : ProcessedFileRepository
- $processedResourceCache : ProcessedResourceCache
- $processorRegistry : ProcessorRegistry
- $taskTypeRegistry : TaskTypeRegistry
Methods
- __construct() : mixed
- processFile() : ProcessedFile|ProcessedResource
- getProcessorByTask() : ProcessorInterface
Properties
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$processedFileRepository
protected
ProcessedFileRepository
$processedFileRepository
$processedResourceCache
protected
ProcessedResourceCache
$processedResourceCache
$processorRegistry
protected
ProcessorRegistry
$processorRegistry
$taskTypeRegistry
protected
TaskTypeRegistry
$taskTypeRegistry
Methods
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher, ProcessedFileRepository $processedFileRepository, ProcessorRegistry $processorRegistry, TaskTypeRegistry $taskTypeRegistry, ProcessedResourceCache $processedResourceCache) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
- $processedFileRepository : ProcessedFileRepository
- $processorRegistry : ProcessorRegistry
- $taskTypeRegistry : TaskTypeRegistry
- $processedResourceCache : ProcessedResourceCache
processFile()
public
processFile(File|FileReference|SystemResourceInterface $fileObject, string $taskType, DriverInterface|null $driver, array $configuration) : ProcessedFile|ProcessedResource
Parameters
- $fileObject : File|FileReference|SystemResourceInterface
- $taskType : string
- $driver : DriverInterface|null
- $configuration : array
Tags
Return values
ProcessedFile|ProcessedResourcegetProcessorByTask()
protected
getProcessorByTask(TaskInterface $task) : ProcessorInterface
Parameters
- $task : TaskInterface