[BUGFIX] Declare mimetype property in FAL as string
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / FileInterface.php
1 <?php
2 namespace TYPO3\CMS\Core\Resource;
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 /**
18 * File Interface
19 */
20 interface FileInterface extends ResourceInterface {
21 /*******************************
22 * VARIOUS FILE PROPERTY GETTERS
23 *******************************/
24 /**
25 * Returns true if the given key exists for this file.
26 *
27 * @param string $key
28 * @return bool
29 */
30 public function hasProperty($key);
31
32 /**
33 * Get the value of the $key property.
34 *
35 * @param string $key
36 * @return string
37 */
38 public function getProperty($key);
39
40 /**
41 * Returns the size of this file
42 *
43 * @return int
44 */
45 public function getSize();
46
47 /**
48 * Returns the Sha1 of this file
49 *
50 * @return string
51 */
52 public function getSha1();
53
54 /**
55 * Returns the basename (the name without extension) of this file.
56 *
57 * @return string
58 */
59 public function getNameWithoutExtension();
60
61 /**
62 * Get the file extension
63 *
64 * @return string The file extension
65 */
66 public function getExtension();
67
68 /**
69 * Get the MIME type of this file
70 *
71 * @return string mime type
72 */
73 public function getMimeType();
74
75 /**
76 * Returns the modification time of the file as Unix timestamp
77 *
78 * @return int
79 */
80 public function getModificationTime();
81
82 /**
83 * Returns the creation time of the file as Unix timestamp
84 *
85 * @return int
86 */
87 public function getCreationTime();
88
89 /******************
90 * CONTENTS RELATED
91 ******************/
92 /**
93 * Get the contents of this file
94 *
95 * @return string File contents
96 */
97 public function getContents();
98
99 /**
100 * Replace the current file contents with the given string.
101 *
102 * @TODO : Consider to remove this function from the interface, as its
103 * @TODO : At the same time, it could be considered whether to make the whole
104 * @param string $contents The contents to write to the file.
105 * @return File The file object (allows chaining).
106 */
107 public function setContents($contents);
108
109 /****************************************
110 * STORAGE AND MANAGEMENT RELATED METHODS
111 ****************************************/
112 /**
113 * Deletes this file from its storage. This also means that this object becomes useless.
114 *
115 * @return bool TRUE if deletion succeeded
116 */
117 public function delete();
118
119 /**
120 * Renames this file.
121 *
122 * @param string $newName The new file name
123 * @return File
124 */
125 public function rename($newName);
126
127 /*****************
128 * SPECIAL METHODS
129 *****************/
130 /**
131 * Returns a publicly accessible URL for this file
132 *
133 * WARNING: Access to the file may be restricted by further means, e.g.
134 * some web-based authentication. You have to take care of this yourself.
135 *
136 * @param bool $relativeToCurrentScript Determines whether the URL returned should be relative to the current script, in case it is relative at all (only for the LocalDriver)
137 * @return string
138 */
139 public function getPublicUrl($relativeToCurrentScript = FALSE);
140
141 /**
142 * Returns TRUE if this file is indexed
143 *
144 * @return bool
145 */
146 public function isIndexed();
147
148 /**
149 * Returns a path to a local version of this file to process it locally (e.g. with some system tool).
150 * If the file is normally located on a remote storages, this creates a local copy.
151 * If the file is already on the local system, this only makes a new copy if $writable is set to TRUE.
152 *
153 * @param bool $writable Set this to FALSE if you only want to do read operations on the file.
154 * @return string
155 */
156 public function getForLocalProcessing($writable = TRUE);
157
158 /**
159 * Returns an array representation of the file.
160 * (This is used by the generic listing module vidi when displaying file records.)
161 *
162 * @return array Array of main data of the file. Don't rely on all data to be present here, it's just a selection of the most relevant information.
163 */
164 public function toArray();
165
166 }