Patched to Drupal 8.4.8 level. See https://www.drupal.org/sa-core-2018-004 and patch...
[yaffs-website] / web / core / modules / file / src / FileInterface.php
1 <?php
2
3 namespace Drupal\file;
4
5 use Drupal\Core\Entity\ContentEntityInterface;
6 use Drupal\user\EntityOwnerInterface;
7 use Drupal\Core\Entity\EntityChangedInterface;
8
9 /**
10  * Defines getter and setter methods for file entity base fields.
11  *
12  * @ingroup file
13  */
14 interface FileInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
15
16   /**
17    * Returns the name of the file.
18    *
19    * This may differ from the basename of the URI if the file is renamed to
20    * avoid overwriting an existing file.
21    *
22    * @return string
23    *   Name of the file.
24    */
25   public function getFilename();
26
27   /**
28    * Sets the name of the file.
29    *
30    * @param string $filename
31    *   The file name that corresponds to this file. May differ from the basename
32    *   of the URI and changing the filename does not change the URI.
33    */
34   public function setFilename($filename);
35
36   /**
37    * Returns the URI of the file.
38    *
39    * @return string
40    *   The URI of the file, e.g. public://directory/file.jpg.
41    */
42   public function getFileUri();
43
44   /**
45    * Sets the URI of the file.
46    *
47    * @param string $uri
48    *   The URI of the file, e.g. public://directory/file.jpg. Does not change
49    *   the location of the file.
50    */
51   public function setFileUri($uri);
52
53   /**
54    * Returns the MIME type of the file.
55    *
56    * @return string
57    *   The MIME type of the file, e.g. image/jpeg or text/xml.
58    */
59   public function getMimeType();
60
61   /**
62    * Sets the MIME type of the file.
63    *
64    * @param string $mime
65    *   The MIME type of the file, e.g. image/jpeg or text/xml.
66    */
67   public function setMimeType($mime);
68
69   /**
70    * Returns the size of the file.
71    *
72    * @return string
73    *   The size of the file in bytes.
74    */
75   public function getSize();
76
77   /**
78    * Sets the size of the file.
79    *
80    * @param int $size
81    *   The size of the file in bytes.
82    */
83   public function setSize($size);
84
85   /**
86    * Returns TRUE if the file is permanent.
87    *
88    * @return bool
89    *   TRUE if the file status is permanent.
90    */
91   public function isPermanent();
92
93   /**
94    * Returns TRUE if the file is temporary.
95    *
96    * @return bool
97    *   TRUE if the file status is temporary.
98    */
99   public function isTemporary();
100
101   /**
102    * Sets the file status to permanent.
103    */
104   public function setPermanent();
105
106   /**
107    * Sets the file status to temporary.
108    */
109   public function setTemporary();
110
111   /**
112    * Returns the file entity creation timestamp.
113    *
114    * @return int
115    *   Creation timestamp of the file entity.
116    */
117   public function getCreatedTime();
118
119 }