TaskInterface

A task is a unit of work that can be performed by a file processor. This may include multiple steps in any order, details depend on the configuration of the task and the tools the processor uses.

Each task has a type and a name. The type describes the category of the task, like "image" and "video". If your task is generic or applies to multiple types of files, use "general".

A task also already has to know the target file it should be executed on, so there is no "abstract" task that just specifies the steps to be executed without a concrete file. However, new tasks can easily be created from an existing task object.

Table of Contents

Methods

__construct()  : mixed
fileNeedsProcessing()  : bool
Returns TRUE if the file has to be processed at all, such as e.g. the original file does.
getConfiguration()  : array<string|int, mixed>
Returns the configuration for this task.
getConfigurationChecksum()  : string
Returns the configuration checksum of this task.
getName()  : string
Returns the name of this task.
getSourceFile()  : File
Returns the original file this task is based on.
getTargetFile()  : ProcessedFile
Returns the processed file this task is executed on.
getTargetFileExtension()  : string
Gets the file extension the processed file should have in the filesystem.
getTargetFileName()  : string
Returns the name the processed file should have in the filesystem.
getType()  : string
Returns the type of this task.
isExecuted()  : bool
Returns TRUE if this task has been executed, no matter if the execution was successful.
isSuccessful()  : bool
Returns TRUE if this task has been successfully executed. Only call this method if the task has been processed at all.
setExecuted()  : mixed
Mark this task as executed. This is used by the Processors in order to transfer the state of this task to the file processing service.

Methods

__construct()

public __construct(ProcessedFile $targetFile, array<string|int, mixed> $configuration) : mixed
Parameters
$targetFile : ProcessedFile
$configuration : array<string|int, mixed>

fileNeedsProcessing()

Returns TRUE if the file has to be processed at all, such as e.g. the original file does.

public fileNeedsProcessing() : bool

Note: This does not indicate if the concrete ProcessedFile attached to this task has to be (re)processed. This check is done in ProcessedFile::isOutdated(). @todo isOutdated()/needsReprocessing()?

Return values
bool

getConfiguration()

Returns the configuration for this task.

public getConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed>

getConfigurationChecksum()

Returns the configuration checksum of this task.

public getConfigurationChecksum() : string
Return values
string

getName()

Returns the name of this task.

public getName() : string
Return values
string

getSourceFile()

Returns the original file this task is based on.

public getSourceFile() : File
Return values
File

getTargetFileExtension()

Gets the file extension the processed file should have in the filesystem.

public getTargetFileExtension() : string
Return values
string

getTargetFileName()

Returns the name the processed file should have in the filesystem.

public getTargetFileName() : string
Return values
string

getType()

Returns the type of this task.

public getType() : string
Return values
string

isExecuted()

Returns TRUE if this task has been executed, no matter if the execution was successful.

public isExecuted() : bool
Return values
bool

isSuccessful()

Returns TRUE if this task has been successfully executed. Only call this method if the task has been processed at all.

public isSuccessful() : bool
Tags
throws
LogicException

If the task has not been executed already

Return values
bool

setExecuted()

Mark this task as executed. This is used by the Processors in order to transfer the state of this task to the file processing service.

public setExecuted(bool $successful) : mixed
Parameters
$successful : bool

Set this to FALSE if executing the task failed


        
On this page

Search results