Backup of db before drupal security update
[yaffs-website] / web / core / modules / locale / src / StringInterface.php
1 <?php
2
3 namespace Drupal\locale;
4
5 /**
6  * Defines the locale string interface.
7  */
8 interface StringInterface {
9
10   /**
11    * Gets the string unique identifier.
12    *
13    * @return int
14    *   The string identifier.
15    */
16   public function getId();
17
18   /**
19    * Sets the string unique identifier.
20    *
21    * @param int $id
22    *   The string identifier.
23    *
24    * @return $this
25    */
26   public function setId($id);
27
28   /**
29    * Gets the string version.
30    *
31    * @return string
32    *   Version identifier.
33    */
34   public function getVersion();
35
36   /**
37    * Sets the string version.
38    *
39    * @param string $version
40    *   Version identifier.
41    *
42    * @return $this
43    */
44   public function setVersion($version);
45
46   /**
47    * Gets plain string contained in this object.
48    *
49    * @return string
50    *   The string contained in this object.
51    */
52   public function getString();
53
54   /**
55    * Sets the string contained in this object.
56    *
57    * @param string $string
58    *   String to set as value.
59    *
60    * @return $this
61    */
62   public function setString($string);
63
64   /**
65    * Splits string to work with plural values.
66    *
67    * @return array
68    *   Array of strings that are plural variants.
69    */
70   public function getPlurals();
71
72   /**
73    * Sets this string using array of plural values.
74    *
75    * Serializes plural variants in one string glued by LOCALE_PLURAL_DELIMITER.
76    *
77    * @param array $plurals
78    *   Array of strings with plural variants.
79    *
80    * @return $this
81    */
82   public function setPlurals($plurals);
83
84   /**
85    * Gets the string storage.
86    *
87    * @return \Drupal\locale\StringStorageInterface
88    *   The storage used for this string.
89    */
90   public function getStorage();
91
92   /**
93    * Sets the string storage.
94    *
95    * @param \Drupal\locale\StringStorageInterface $storage
96    *   The storage to use for this string.
97    *
98    * @return $this
99    */
100   public function setStorage($storage);
101
102   /**
103    * Checks whether the object is not saved to storage yet.
104    *
105    * @return bool
106    *   TRUE if the object exists in the storage, FALSE otherwise.
107    */
108   public function isNew();
109
110   /**
111    * Checks whether the object is a source string.
112    *
113    * @return bool
114    *   TRUE if the object is a source string, FALSE otherwise.
115    */
116   public function isSource();
117
118   /**
119    * Checks whether the object is a translation string.
120    *
121    * @return bool
122    *   TRUE if the object is a translation string, FALSE otherwise.
123    */
124   public function isTranslation();
125
126   /**
127    * Sets an array of values as object properties.
128    *
129    * @param array $values
130    *   Array with values indexed by property name.
131    * @param bool $override
132    *   (optional) Whether to override already set fields, defaults to TRUE.
133    *
134    * @return $this
135    */
136   public function setValues(array $values, $override = TRUE);
137
138   /**
139    * Gets field values that are set for given field names.
140    *
141    * @param array $fields
142    *   Array of field names.
143    *
144    * @return array
145    *   Array of field values indexed by field name.
146    */
147   public function getValues(array $fields);
148
149   /**
150    * Gets location information for this string.
151    *
152    * Locations are arbitrary pairs of type and name strings, used to store
153    * information about the origins of the string, like the file name it
154    * was found on, the path on which it was discovered, etc.
155    *
156    * A string can have any number of locations since the same string may be
157    * found on different places of Drupal code and configuration.
158    *
159    * @param bool $check_only
160    *   (optional) Set to TRUE to get only new locations added during the
161    *   current page request and not loading all existing locations.
162    *
163    * @return array
164    *   Location ids indexed by type and name.
165    */
166   public function getLocations($check_only = FALSE);
167
168   /**
169    * Adds a location for this string.
170    *
171    * @param string $type
172    *   Location type that may be any arbitrary string. Types used in Drupal
173    *   core are: 'javascript', 'path', 'code', 'configuration'.
174    * @param string $name
175    *   Location name. Drupal path in case of online discovered translations,
176    *   file path in case of imported strings, configuration name for strings
177    *   that come from configuration, etc.
178    *
179    * @return $this
180    */
181   public function addLocation($type, $name);
182
183   /**
184    * Checks whether the string has a given location.
185    *
186    * @param string $type
187    *   Location type.
188    * @param string $name
189    *   Location name.
190    *
191    * @return bool
192    *   TRUE if the string has a location with this type and name.
193    */
194   public function hasLocation($type, $name);
195
196   /**
197    * Saves string object to storage.
198    *
199    * @return $this
200    *
201    * @throws \Drupal\locale\StringStorageException
202    *   In case of failures, an exception is thrown.
203    */
204   public function save();
205
206   /**
207    * Deletes string object from storage.
208    *
209    * @return $this
210    *
211    * @throws \Drupal\locale\StringStorageException
212    *   In case of failures, an exception is thrown.
213    */
214   public function delete();
215
216 }