6
6
7
7
/**
8
8
* Interface for Type objects.
9
- *
10
- * @api
11
9
*/
12
10
interface TypeInterface
13
11
{
@@ -20,71 +18,95 @@ interface TypeInterface
20
18
* MIME type string to be parsed.
21
19
* @param class-string<MimeMapInterface>|null $mapClass
22
20
* (Optional) The FQCN of the map class to use.
21
+ *
22
+ * @api
23
23
*/
24
24
public function __construct (string $ typeString , ?string $ mapClass = null );
25
25
26
26
/**
27
27
* Gets a MIME type's media.
28
28
*
29
29
* Note: 'media' refers to the portion before the first slash.
30
+ *
31
+ * @api
30
32
*/
31
33
public function getMedia (): string ;
32
34
33
35
/**
34
36
* Sets a MIME type's media.
37
+ *
38
+ * @api
35
39
*/
36
40
public function setMedia (string $ media ): TypeInterface ;
37
41
38
42
/**
39
43
* Checks if the MIME type has media comment.
44
+ *
45
+ * @api
40
46
*/
41
47
public function hasMediaComment (): bool ;
42
48
43
49
/**
44
50
* Gets the MIME type's media comment.
45
51
*
46
52
* @throws UndefinedException
53
+ *
54
+ * @api
47
55
*/
48
56
public function getMediaComment (): string ;
49
57
50
58
/**
51
59
* Sets the MIME type's media comment.
52
60
*
53
61
* @param string $comment (optional) a comment; when missing any existing comment is removed.
62
+ *
63
+ * @api
54
64
*/
55
65
public function setMediaComment (?string $ comment = null ): TypeInterface ;
56
66
57
67
/**
58
68
* Gets a MIME type's subtype.
69
+ *
70
+ * @api
59
71
*/
60
72
public function getSubType (): string ;
61
73
62
74
/**
63
75
* Sets a MIME type's subtype.
76
+ *
77
+ * @api
64
78
*/
65
79
public function setSubType (string $ subType ): TypeInterface ;
66
80
67
81
/**
68
82
* Checks if the MIME type has subtype comment.
83
+ *
84
+ * @api
69
85
*/
70
86
public function hasSubTypeComment (): bool ;
71
87
72
88
/**
73
89
* Gets the MIME type's subtype comment.
74
90
*
75
91
* @throws UndefinedException
92
+ *
93
+ * @api
76
94
*/
77
95
public function getSubTypeComment (): string ;
78
96
79
97
/**
80
98
* Sets the MIME type's subtype comment.
81
99
*
82
100
* @param string|null $comment (optional) a comment; when missing any existing comment is removed.
101
+ *
102
+ * @api
83
103
*/
84
104
public function setSubTypeComment (?string $ comment = null ): TypeInterface ;
85
105
86
106
/**
87
107
* Checks if the MIME type has any parameter.
108
+ *
109
+ * @api
88
110
*/
89
111
public function hasParameters (): bool ;
90
112
@@ -94,30 +116,40 @@ public function hasParameters(): bool;
94
116
* @return TypeParameter[]
95
117
*
96
118
* @throws UndefinedException
119
+ *
120
+ * @api
97
121
*/
98
122
public function getParameters (): array ;
99
123
100
124
/**
101
125
* Checks if the MIME type has a parameter.
102
126
*
103
127
* @throws UndefinedException
128
+ *
129
+ * @api
104
130
*/
105
131
public function hasParameter (string $ name ): bool ;
106
132
107
133
/**
108
134
* Get a MIME type's parameter.
109
135
*
110
136
* @throws UndefinedException
137
+ *
138
+ * @api
111
139
*/
112
140
public function getParameter (string $ name ): TypeParameter ;
113
141
114
142
/**
115
143
* Add a parameter to this type
144
+ *
145
+ * @api
116
146
*/
117
147
public function addParameter (string $ name , string $ value , ?string $ comment = null ): void ;
118
148
119
149
/**
120
150
* Remove a parameter from this type.
151
+ *
152
+ * @api
121
153
*/
122
154
public function removeParameter (string $ name ): void ;
123
155
@@ -128,6 +160,8 @@ public function removeParameter(string $name): void;
128
160
*
129
161
* @param int $format
130
162
* The format of the output string.
163
+ *
164
+ * @api
131
165
*/
132
166
public function toString (int $ format = Type::FULL_TEXT ): string ;
133
167
@@ -136,23 +170,31 @@ public function toString(int $format = Type::FULL_TEXT): string;
136
170
*
137
171
* Note: Experimental types are denoted by a leading 'x-' in the media or
138
172
* subtype, e.g. text/x-vcard or x-world/x-vrml.
173
+ *
174
+ * @api
139
175
*/
140
176
public function isExperimental (): bool ;
141
177
142
178
/**
143
179
* Is this a vendor MIME type?
144
180
*
145
181
* Note: Vendor types are denoted with a leading 'vnd. in the subtype.
182
+ *
183
+ * @api
146
184
*/
147
185
public function isVendor (): bool ;
148
186
149
187
/**
150
188
* Is this a wildcard type?
189
+ *
190
+ * @api
151
191
*/
152
192
public function isWildcard (): bool ;
153
193
154
194
/**
155
195
* Is this an alias?
196
+ *
197
+ * @api
156
198
*/
157
199
public function isAlias (): bool ;
158
200
@@ -168,6 +210,8 @@ public function isAlias(): bool;
168
210
*
169
211
* @return bool
170
212
* True if there was a match, false otherwise.
213
+ *
214
+ * @api
171
215
*/
172
216
public function wildcardMatch (string $ wildcard ): bool ;
173
217
@@ -180,11 +224,15 @@ public function wildcardMatch(string $wildcard): bool;
180
224
* @throws MappingException if no mapping found.
181
225
*
182
226
* @return array<int,int|string>
227
+ *
228
+ * @api
183
229
*/
184
230
public function buildTypesList (): array ;
185
231
186
232
/**
187
233
* Checks if a description for the MIME type exists.
234
+ *
235
+ * @api
188
236
*/
189
237
public function hasDescription (): bool ;
190
238
@@ -197,6 +245,8 @@ public function hasDescription(): bool;
197
245
* appended with a comma. Defaults to false.
198
246
*
199
247
* @throws MappingException if no description found.
248
+ *
249
+ * @api
200
250
*/
201
251
public function getDescription (bool $ includeAcronym = false ): string ;
202
252
@@ -209,13 +259,17 @@ public function getDescription(bool $includeAcronym = false): string;
209
259
* @throws MappingException on error.
210
260
*
211
261
* @return list<string>
262
+ *
263
+ * @api
212
264
*/
213
265
public function getAliases (): array ;
214
266
215
267
/**
216
268
* Returns the MIME type's preferred file extension.
217
269
*
218
270
* @throws MappingException if no mapping found.
271
+ *
272
+ * @api
219
273
*/
220
274
public function getDefaultExtension (): string ;
221
275
@@ -227,6 +281,8 @@ public function getDefaultExtension(): string;
227
281
* @throws MappingException if no mapping found.
228
282
*
229
283
* @return list<string>
284
+ *
285
+ * @api
230
286
*/
231
287
public function getExtensions (): array ;
232
288
}
0 commit comments