[TASK] Remove leading slash from use statements
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / Processing / TaskInterface.php
1 <?php
2 namespace TYPO3\CMS\Core\Resource\Processing;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Resource;
18
19 /**
20 * A task is a unit of work that can be performed by a file processor. This may include multiple steps in any order,
21 * details depend on the configuration of the task and the tools the processor uses.
22 *
23 * Each task has a type and a name. The type describes the category of the task, like "image" and "video". If your task
24 * is generic or applies to multiple types of files, use "general".
25 *
26 * A task also already has to know the target file it should be executed on, so there is no "abstract" task that just
27 * specifies the steps to be executed without a concrete file. However, new tasks can easily be created from an
28 * existing task object.
29 */
30 interface TaskInterface {
31
32 /**
33 * @param \TYPO3\CMS\Core\Resource\ProcessedFile $targetFile
34 * @param array $configuration
35 */
36 public function __construct(Resource\ProcessedFile $targetFile, array $configuration);
37
38 /**
39 * Returns the name of this task.
40 *
41 * @return string
42 */
43 public function getName();
44
45 /**
46 * Returns the type of this task.
47 *
48 * @return string
49 */
50 public function getType();
51
52 /**
53 * Returns the processed file this task is executed on.
54 *
55 * @return Resource\ProcessedFile
56 */
57 public function getTargetFile();
58
59 /**
60 * Returns the original file this task is based on.
61 *
62 * @return Resource\File
63 */
64 public function getSourceFile();
65
66 /**
67 * Returns the configuration for this task.
68 *
69 * @return array
70 */
71 public function getConfiguration();
72
73 /**
74 * Returns the configuration checksum of this task.
75 *
76 * @return string
77 */
78 public function getConfigurationChecksum();
79
80 /**
81 * Returns the name the processed file should have in the filesystem.
82 *
83 * @return string
84 */
85 public function getTargetFileName();
86
87 /**
88 * Gets the file extension the processed file should have in the filesystem.
89 *
90 * @return string
91 */
92 public function getTargetFileExtension();
93
94 /**
95 * Returns TRUE if the file has to be processed at all, such as e.g. the original file does.
96 *
97 * Note: This does not indicate if the concrete ProcessedFile attached to this task has to be (re)processed.
98 * This check is done in ProcessedFile::isOutdated(). @todo isOutdated()/needsReprocessing()?
99 *
100 * @return bool
101 */
102 public function fileNeedsProcessing();
103
104 /**
105 * Returns TRUE if this task has been executed, no matter if the execution was successful.
106 *
107 * @return bool
108 */
109 public function isExecuted();
110
111 /**
112 * Mark this task as executed. This is used by the Processors in order to transfer the state of this task to
113 * the file processing service.
114 *
115 * @param bool $successful Set this to FALSE if executing the task failed
116 * @return void
117 */
118 public function setExecuted($successful);
119
120 /**
121 * Returns TRUE if this task has been successfully executed. Only call this method if the task has been processed
122 * at all.
123 *
124 * @return bool
125 * @throws \LogicException If the task has not been executed already
126 */
127 public function isSuccessful();
128 }