Passed
Push — master ( 2ddebf...84c74c )
by Petr
09:17 queued 01:35
created

CustomList::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace kalanis\kw_mime\Check;
4
5
6
use kalanis\kw_mime\Interfaces\IMimeChecks;
7
use kalanis\kw_paths\ArrayPath;
8
use kalanis\kw_paths\Stuff;
9
10
11
/**
12
 * Class CustomList
13
 * @package kalanis\kw_mime\Check
14
 * Custom list of file extensions
15
 * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
16
 * @link https://mimetype.io/all-types/
17
 * @link https://www.sitepoint.com/mime-types-complete-list/
18
 */
19
class CustomList implements IMimeChecks
20
{
21
    /** @var array<string|int, string> */
22
    protected $mimeTypes = [
23
        'atom' => 'application/atom+xml', // Atom XML
24
        'css' => 'text/css', // Cascading Style Sheets (CSS)
25
        'dtd' => 'application/xml-dtd',
26
        'htm' => 'text/html', // HyperText Markup Language (HTML)
27
        'html' => 'text/html', // HyperText Markup Language (HTML)
28
        'js' => 'text/javascript', // JavaScript
29
        'json' => 'application/json', // JSON format
30
        'jsonld' => 'application/ld+json', // JSON-LD format
31
        'latex' => 'application/x-latex',
32
        'md' => 'text/markdown',
33
        'mjs' => 'text/javascript', // JavaScript module
34
        'mkd' => 'text/markdown',
35
        'php' => 'application/x-httpd-php', // Hypertext Preprocessor
36
        'rdf' => 'application/rdf+xml',
37
        'rtf' => 'application/rtf', // Rich Text Format (RTF)
38
        'rss' => 'application/rss+xml',
39
        'txt' => 'text/plain', // Text, (generally ASCII or ISO 8859-n)
40
        'text' => 'text/plain', // Text, (generally ASCII or ISO 8859-n)
41
        'wml' => 'text/vnd.wap.wml',
42
        'wmls' => 'text/vnd.wap.wmlscript',
43
        'xhtm' => 'application/xhtml+xml',
44
        'xhtml' => 'application/xhtml+xml', // XHTML
45
        'xml' => 'application/xml', // XML
46
        // images
47
        'apng' => 'image/apng',
48
        'avif' => 'image/avif',
49
        'bmp' => 'image/bmp', // Windows OS/2 Bitmap Graphics
50
        'djv' => 'image/vnd.djvu',
51
        'djvu' => 'image/vnd.djvu',
52
        'gif' => 'image/gif', // Graphics Interchange Format (GIF)
53
        'ico' => 'image/vnd.microsoft.icon', // Icon format
54
        'jpe' => 'image/jpeg', // JPEG images
55
        'jpg' => 'image/jpeg', // JPEG images
56
        'jpeg' => 'image/jpeg', // JPEG images
57
        'odg' => 'application/vnd.oasis.opendocument.graphics', // OpenDocument graphics
58
        'odi' => 'application/vnd.oasis.opendocument.image', // OpenDocument image
59
        'pcx' => 'image/x-pcx',
60
        'png' => 'image/png', // Portable Network Graphics
61
        'svg' => 'image/svg+xml', // Scalable Vector Graphics (SVG)
62
        'svgz' => 'image/svg+xml',
63
        'tga' => 'image/x-tga', // Targa image
64
        'tif' => 'image/tiff', // Tagged Image File Format (TIFF)
65
        'tiff' => 'image/tiff', // Tagged Image File Format (TIFF)
66
        'webp' => 'image/webp', // WEBP image
67
        'wbmp' => 'image/vnd.wap.wbmp',
68
        // archives
69
        'arc' => 'application/x-freearc', // Archive document (multiple files embedded)
70
        'arj' => 'application/x-arj-compressed',
71
        'bz' => 'application/x-bzip', // BZip archive
72
        'bz2' => 'application/x-bzip2', // BZip2 archive
73
        'cab' => 'application/vnd.ms-cab-compressed', // Cab archives from Windows installer
74
        'gz' => 'application/gzip', // GZip Compressed Archive
75
        'lha' => 'application/x-lha',
76
        'lzh' => 'application/x-lzh',
77
        'lzx' => 'application/x-lzx',
78
        'rar' => 'application/vnd.rar', // RAR archive
79
        'tar' => 'application/x-tar', // Tape Archive (TAR)
80
        'tgz' => 'application/x-gzip', // GZip Compressed Archive
81
        'z' => 'application/x-compress',
82
        'zip' => 'application/zip', // ZIP archive
83
        '7z' => 'application/x-7z-compressed', // 7-zip archive
84
        // installers
85
        'deb' => 'application/x-debian-package',
86
        'msi' => 'application/x-msdownload', // Microsoft Installer
87
        'mpkg' => 'application/vnd.apple.installer+xml', // Apple Installer Package
88
        'portpkg' => 'application/vnd.macports.portpkg',
89
        'rpa' => 'application/x-redhat-package-manager',
90
        'rpm' => 'application/x-rpm',
91
        'udeb' => 'application/x-debian-package',
92
        // audio/video
93
        'aif' => 'audio/aiff',
94
        'asf' => 'video/x-ms-asf',
95
        'asx' => 'application/x-ms-asf',
96
        'au' => 'audio/basic',
97
        'aac' => 'audio/aac', // AAC audio
98
        'avi' => 'video/x-msvideo', // AVI: Audio Video Interleave
99
        'cda' => 'application/x-cdf', // CD audio
100
        'dvi' => 'application/x-dvi',
101
        'flv' => 'video/x-flv',
102
        'kar' => 'audio/midi',
103
        'm3u' => 'audio/x-mpegurl',
104
        'mid' => 'audio/x-midi', // Musical Instrument Digital Interface (MIDI)
105
        'midi' => 'audio/midi', // Musical Instrument Digital Interface (MIDI)
106
        'mkv' => 'video/x-matroska',
107
        'mov' => 'video/quicktime',
108
        'mp3' => 'audio/mpeg', // MP3 audio
109
        'mp4' => 'video/mp4', // MP4 video
110
        'mp4s' => 'application/mp4',
111
        'mpe' => 'video/mpeg', // MPEG Video
112
        'mpeg' => 'video/mpeg', // MPEG Video
113
        'mpg' => 'video/mpeg',
114
        'oga' => 'audio/ogg', // OGG audio
115
        'ogg' => 'video/ogg',
116
        'ogv' => 'video/ogg', // OGG video
117
        'ogx' => 'application/ogg', // OGG
118
        'opus' => 'audio/opus', // Opus audio
119
        'qt' => 'video/quicktime',
120
        'ra' => 'audio/x-pn-realaudio',
121
        'ram' => 'audio/x-pn-realaudio',
122
        'snd' => 'audio/basic',
123
        'ts' => 'video/mp2t', // MPEG transport stream
124
        'wav' => 'audio/wav', // Waveform Audio Format
125
        'weba' => 'audio/webm', // WEBM audio
126
        'webm' => 'video/webm', // WEBM video
127
        'wma' => 'audio/x-ms-wma',
128
        'wmv' => 'video/x-ms-wmv',
129
        '3gp' => 'video/3gpp', // 3GPP audio/video container
130
        '3g2' => 'video/3gpp2', // 3GPP2 audio/video container
131
        // adobe
132
        'ai' => 'application/postscript',
133
        'eps' => 'application/postscript',
134
        'ps' => 'application/postscript',
135
        'pdf' => 'application/pdf', // Adobe Portable Document Format (PDF)
136
        'psd' => 'image/vnd.adobe.photoshop', // Photoshop image
137
        'swf' => 'application/x-shockwave-flash', // Adobe Flash document
138
        // office
139
        'abw' => 'application/x-abiword', // AbiWord document
140
        'apr' => 'application/vnd.lotus-approach',
141
        'azw' => 'application/vnd.amazon.ebook', // Amazon Kindle eBook format
142
        'bdf' => 'application/x-font-bdf',
143
        'doc' => 'application/msword', // Microsoft Word
144
        'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // Microsoft Word (OpenXML)
145
        'dot' => 'application/msword', // Microsoft Word
146
        'eot' => 'application/vnd.ms-fontobject', // MS Embedded OpenType fonts
147
        'epub' => 'application/epub+zip', // Electronic publication (EPUB)
148
        'gsf' => 'application/x-font-ghostscript',
149
        'ics' => 'text/calendar', // iCalendar format
150
        'lwp' => 'application/vnd.lotus-wordpro',
151
        'mobi' => 'application/x-mobipocket-ebook',
152
        'nsf' => 'application/vnd.lotus-notes',
153
        'odb' => 'application/vnd.oasis.opendocument.database', // OpenDocument database
154
        'odf' => 'application/vnd.oasis.opendocument.formula', // OpenDocument formula
155
        'odp' => 'application/vnd.oasis.opendocument.presentation', // OpenDocument presentation document
156
        'ods' => 'application/vnd.oasis.opendocument.spreadsheet', // OpenDocument spreadsheet document
157
        'odt' => 'application/vnd.oasis.opendocument.text', // OpenDocument text document
158
        'onepkg' => 'application/onenote', // OneNote file
159
        'onetmp' => 'application/onenote', // OneNote file
160
        'onetoc' => 'application/onenote', // OneNote file
161
        'onetoc2' => 'application/onenote', // OneNote file
162
        'org' => 'application/vnd.lotus-organizer',
163
        'otf' => 'font/otf', // OpenType font
164
        'pcf' => 'application/x-font-pcf',
165
        'pot' => 'application/vnd.ms-powerpoint', // Microsoft PowerPoint
166
        'ppa' => 'application/mspowerpoint', // Microsoft PowerPoint
167
        'ppt' => 'application/vnd.ms-powerpoint', // Microsoft PowerPoint
168
        'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', // Microsoft PowerPoint (OpenXML)
169
        'pps' => 'application/vnd.ms-powerpoint', // Microsoft PowerPoint
170
        'prc' => 'application/x-mobipocket-ebook',
171
        'pre' => 'application/vnd.lotus-freelance',
172
        'psf' => 'application/x-font-linux-psf',
173
        'scm' => 'application/vnd.lotus-screencam',
174
        'ttc' => 'font/ttf', // TrueType Font
175
        'ttf' => 'font/ttf', // TrueType Font
176
        'vsd' => 'application/vnd.visio', // Microsoft Visio
177
        'woff' => 'font/woff', // Web Open Font Format (WOFF)
178
        'woff2' => 'font/woff2', // Web Open Font Format (WOFF)
179
        'wp' => 'application/wordperfect',
180
        'wp6' => 'application/wordperfect',
181
        'wri' => 'application/mswrite',
182
        'xla' => 'application/x-msexcel',
183
        'xls' => 'application/vnd.ms-excel', // Microsoft Excel
184
        'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // Microsoft Excel (OpenXML)
185
        'xlst' => 'application/xslt+xml',
186
        '123' => 'application/vnd.lotus-1-2-3',
187
        // tech
188
        'chm' => 'application/vnd.ms-htmlhelp', // help file
189
        'dwg' => 'image/vnd.dwg', // AutoCAD drawing
190
        'gcode' => 'text/x.gcode', // 3D printer file format
191
        'hlp' => 'application/winhlp', // help file
192
        'kml' => 'application/vnd.google-earth.kml+xml',
193
        'kmz' => 'application/vnd.google-earth.kmz',
194
        'ma' => 'application/mathematica',
195
        'mathml' => 'application/mathml+xml',
196
        'mb' => 'application/mathematica',
197
        'mml' => 'application/mathml+xml',
198
        'nb' => 'application/mathematica',
199
        'skp' => 'application/vnd.koan', // Google SketchUp drawing
200
        'xul' => 'application/vnd.mozilla.xul+xml', // XUL
201
        // programming and system
202
        'ami' => 'application/vnd.amiga.ami',
203
        'application' => 'application/x-ms-application',
204
        'apk' => 'application/vnd.android.package-archive', // Android package archive
205
        'asc' => 'application/pgp-signature', // PGP key
206
        'bin' => 'application/octet-stream', // Any kind of binary data
207
        'c' => 'text/plain',
208
        'cer' => 'application/pkix-cert',
209
        'csh' => 'application/x-csh', // C-Shell script
210
        'csv' => 'text/csv', // Comma-separated values (CSV)
211
        'cpp' => 'text/x-c',
212
        'cpt' => 'application/mac-compactpro',
213
        'class' => 'application/java-vm',
214
        'conf' => 'text/plain',
215
        'crt' => 'application/x-x509-ca-cert',
216
        'c++' => 'text/plain',
217
        'exe' => 'application/octet-stream',
218
        'ecma' => 'application/ecmascript',
219
        'hqx' => 'application/mac-binhex40',
220
        'inf' => 'application/inf',
221
        'jar' => 'application/java-archive', // Java Archive (JAR)
222
        'java' => 'text/x-java-source',
223
        'list' => 'text/plain',
224
        'lst' => 'text/plain',
225
        'mdb' => 'application/x-msaccess', // Access DB
226
        'meta' => 'text/metadata',
227
        'mime' => 'www/mime',
228
        'pas' => 'text/pascal',
229
        'pl' => 'application/x-perl',
230
        'pm' => 'application/x-perl',
231
        'py' => 'text/x-script.python',
232
        'pyc' => 'application/x-python-code',
233
        'pyo' => 'application/x-python-code',
234
        'pfx' => 'application/x-pkcs12',
235
        'pgp' => 'application/pgp-encrypted', // PGP key
236
        'p7b' => 'application/x-pkcs7-certificates', // PKCS certificate
237
        'p7s' => 'application/pkcs7-signature', // PKCS signature
238
        'p10' => 'application/pkcs10', // PKCS key
239
        'p12' => 'application/x-pkcs12',
240
        'sh' => 'application/x-sh', // Bourne shell script
241
        'ser' => 'application/java-serialized-object',
242
        'sig' => 'application/pgp-signature', // PGP key
243
        'spc' => 'application/x-pkcs7-certificates', // PKCS certificate
244
        'sqlite' => 'application/vnd.sqlite3', // SQLite
245
        'sqlite3' => 'application/vnd.sqlite3', // SQLite
246
        'torrent' => 'application/x-bittorrent', // torrent files
247
        // custom
248
        'phpkg' => 'application/x-php-package', // php package for KWCMS
249
        // from sitepoint
250
        '3dm' => 'x-world/x-3dmf',
251
        '3dmf' => 'x-world/x-3dmf',
252
        'aab' => 'application/x-authorware-bin',
253
        'aam' => 'application/x-authorware-map',
254
        'aas' => 'application/x-authorware-seg',
255
        'abc' => 'text/vnd.abc',
256
        'acgi' => 'text/html',
257
        'afl' => 'video/animaflex',
258
        'aifc' => 'audio/aiff',
259
        'aiff' => 'audio/aiff',
260
        'aim' => 'application/x-aim',
261
        'aip' => 'text/x-audiosoft-intra',
262
        'ani' => 'application/x-navi-animation',
263
        'aos' => 'application/x-nokia-9000-communicator-add-on-software',
264
        'aps' => 'application/mime',
265
        'art' => 'image/x-jg',
266
        'asm' => 'text/x-asm',
267
        'asp' => 'text/asp',
268
        'avs' => 'video/avs-video',
269
        'bcpio' => 'application/x-bcpio',
270
        'bm' => 'image/bmp',
271
        'boo' => 'application/book',
272
        'book' => 'application/book',
273
        'boz' => 'application/x-bzip2',
274
        'bsh' => 'application/x-bsh',
275
        'cat' => 'application/vnd.ms-pki.seccat',
276
        'cc' => 'text/plain',
277
        'ccad' => 'application/clariscad',
278
        'cco' => 'application/x-cocoa',
279
        'cdf' => 'application/x-cdf',
280
        'cha' => 'application/x-chat',
281
        'chat' => 'application/x-chat',
282
        'cpio' => 'application/x-cpio',
283
        'crl' => 'application/pkcs-crl',
284
        'dcr' => 'application/x-director',
285
        'deepv' => 'application/x-deepv',
286
        'def' => 'text/plain',
287
        'der' => 'application/x-x509-ca-cert',
288
        'dif' => 'video/x-dv',
289
        'dir' => 'application/x-director',
290
        'dl' => 'video/dl',
291
        'dp' => 'application/commonground',
292
        'drw' => 'application/drafting',
293
        'dv' => 'video/x-dv',
294
        'dwf' => 'model/vnd.dwf',
295
        'dxf' => 'image/vnd.dwg',
296
        'dxr' => 'application/x-director',
297
        'el' => 'text/x-script.elisp',
298
        'elc' => 'application/x-elc',
299
        'env' => 'application/x-envoy',
300
        'es' => 'application/x-esrehber',
301
        'etx' => 'text/x-setext',
302
        'evy' => 'application/x-envoy',
303
        'f' => 'text/x-fortran',
304
        'f77' => 'text/x-fortran',
305
        'f90' => 'text/x-fortran',
306
        'fdf' => 'application/vnd.fdf',
307
        'fli' => 'video/x-fli',
308
        'flo' => 'image/florian',
309
        'flx' => 'text/vnd.fmi.flexstor',
310
        'fmf' => 'video/x-atomic3d-feature',
311
        'for' => 'text/x-fortran',
312
        'fpx' => 'image/vnd.fpx',
313
        'frl' => 'application/freeloader',
314
        'funk' => 'audio/make',
315
        'g' => 'text/plain',
316
        'g3' => 'image/g3fax',
317
        'gl' => 'video/x-gl',
318
        'gsd' => 'audio/x-gsm',
319
        'gsm' => 'audio/x-gsm',
320
        'gsp' => 'application/x-gsp',
321
        'gss' => 'application/x-gss',
322
        'gtar' => 'application/x-gtar',
323
        'h' => 'text/plain',
324
        'hdf' => 'application/x-hdf',
325
        'help' => 'application/x-helpfile',
326
        'hgl' => 'application/vnd.hp-hpgl',
327
        'hh' => 'text/plain',
328
        'hlb' => 'text/x-script',
329
        'hpg' => 'application/vnd.hp-hpgl',
330
        'hpgl' => 'application/vnd.hp-hpgl',
331
        'hta' => 'application/hta',
332
        'htc' => 'text/x-component',
333
        'htmls' => 'text/html',
334
        'htt' => 'text/webviewhtml',
335
        'htx' => 'text/html',
336
        'ice' => 'x-conference/x-cooltalk',
337
        'idc' => 'text/plain',
338
        'ief' => 'image/ief',
339
        'iefs' => 'image/ief',
340
        'iges' => 'model/iges',
341
        'igs' => 'model/iges',
342
        'ima' => 'application/x-ima',
343
        'imap' => 'application/x-httpd-imap',
344
        'ins' => 'application/x-internett-signup',
345
        'ip' => 'application/x-ip2',
346
        'isu' => 'video/x-isvideo',
347
        'it' => 'audio/it',
348
        'iv' => 'application/x-inventor',
349
        'ivr' => 'i-world/i-vrml',
350
        'ivy' => 'application/x-livescreen',
351
        'jam' => 'audio/x-jam',
352
        'jav' => 'text/plain',
353
        'jcm' => 'application/x-java-commerce',
354
        'jfif' => 'image/pjpeg',
355
        'jut' => 'image/jutvision',
356
        'ksh' => 'application/x-ksh',
357
        'la' => 'audio/x-nspaudio',
358
        'lam' => 'audio/x-liveaudio',
359
        'lma' => 'audio/x-nspaudio',
360
        'log' => 'text/plain',
361
        'lsp' => 'application/x-lisp',
362
        'lsx' => 'text/x-la-asf',
363
        'ltx' => 'application/x-latex',
364
        'm' => 'text/plain',
365
        'm1v' => 'video/mpeg',
366
        'm2a' => 'audio/mpeg',
367
        'm2v' => 'video/mpeg',
368
        'man' => 'application/x-troff-man',
369
        'map' => 'application/x-navimap',
370
        'mar' => 'text/plain',
371
        'mbd' => 'application/mbedlet',
372
        'mc$' => 'application/x-magic-cap-package-1.0',
373
        'mcd' => 'application/x-mathcad',
374
        'mcp' => 'application/netmc',
375
        'me' => 'application/x-troff-me',
376
        'mht' => 'message/rfc822',
377
        'mhtml' => 'message/rfc822',
378
        'mjf' => 'audio/x-vnd.audioexplosion.mjuicemediafile',
379
        'mjpg' => 'video/x-motion-jpeg',
380
        'mm' => 'application/x-meme',
381
        'mme' => 'application/base64',
382
        'moov' => 'video/quicktime',
383
        'movie' => 'video/x-sgi-movie',
384
        'mpc' => 'application/x-project',
385
        'mpga' => 'audio/mpeg',
386
        'mpp' => 'application/vnd.ms-project',
387
        'mpt' => 'application/x-project',
388
        'mpv' => 'application/x-project',
389
        'mpx' => 'application/x-project',
390
        'mrc' => 'application/marc',
391
        'ms' => 'application/x-troff-ms',
392
        'mv' => 'video/x-sgi-movie',
393
        'my' => 'audio/make',
394
        'mzz' => 'application/x-vnd.audioexplosion.mzz',
395
        'nap' => 'image/naplps',
396
        'naplps' => 'image/naplps',
397
        'nc' => 'application/x-netcdf',
398
        'ncm' => 'application/vnd.nokia.configuration-message',
399
        'nif' => 'image/x-niff',
400
        'niff' => 'image/x-niff',
401
        'nix' => 'application/x-mix-transfer',
402
        'nsc' => 'application/x-conference',
403
        'nvd' => 'application/x-navidoc',
404
        'oda' => 'application/oda',
405
        'omc' => 'application/x-omc',
406
        'omcd' => 'application/x-omcdatamaker',
407
        'omcr' => 'application/x-omcregerator',
408
        'p' => 'text/x-pascal',
409
        'p7a' => 'application/x-pkcs7-signature',
410
        'p7c' => 'application/x-pkcs7-mime',
411
        'p7m' => 'application/x-pkcs7-mime',
412
        'p7r' => 'application/x-pkcs7-certreqresp',
413
        'pbm' => 'image/x-portable-bitmap',
414
        'pcl' => 'application/x-pcl',
415
        'pct' => 'image/x-pict',
416
        'pdb' => 'chemical/x-pdb',
417
        'pfunk' => 'audio/make.my.funk',
418
        'pgm' => 'image/x-portable-greymap',
419
        'pic' => 'image/pict',
420
        'pict' => 'image/pict',
421
        'pkg' => 'application/x-newton-compatible-pkg',
422
        'pko' => 'application/vnd.ms-pki.pko',
423
        'plx' => 'application/x-pixclscript',
424
        'pm4' => 'application/x-pagemaker',
425
        'pm5' => 'application/x-pagemaker',
426
        'pnm' => 'image/x-portable-anymap',
427
        'pov' => 'model/x-pov',
428
        'ppm' => 'image/x-portable-pixmap',
429
        'ppz' => 'application/mspowerpoint',
430
        'prt' => 'application/pro_eng',
431
        'pvu' => 'paleovu/x-pv',
432
        'pwz' => 'application/vnd.ms-powerpoint',
433
        'qcp' => 'audio/vnd.qcelp',
434
        'qd3' => 'x-world/x-3dmf',
435
        'qd3d' => 'x-world/x-3dmf',
436
        'qif' => 'image/x-quicktime',
437
        'qtc' => 'video/x-qtc',
438
        'qti' => 'image/x-quicktime',
439
        'qtif' => 'image/x-quicktime',
440
        'ras' => 'image/cmu-raster',
441
        'rast' => 'image/cmu-raster',
442
        'rexx' => 'text/x-script.rexx',
443
        'rf' => 'image/vnd.rn-realflash',
444
        'rgb' => 'image/x-rgb',
445
        'rm' => 'audio/x-pn-realaudio',
446
        'rmi' => 'audio/mid',
447
        'rmm' => 'audio/x-pn-realaudio',
448
        'rmp' => 'audio/x-pn-realaudio-plugin',
449
        'rng' => 'application/ringing-tones',
450
        'rnx' => 'application/vnd.rn-realplayer',
451
        'roff' => 'application/x-troff',
452
        'rp' => 'image/vnd.rn-realpix',
453
        'rt' => 'text/vnd.rn-realtext',
454
        'rtx' => 'text/richtext',
455
        'rv' => 'video/vnd.rn-realvideo',
456
        's' => 'text/x-asm',
457
        's3m' => 'audio/s3m',
458
        'sbk' => 'application/x-tbook',
459
        'sdml' => 'text/plain',
460
        'sdp' => 'application/x-sdp',
461
        'sdr' => 'application/sounder',
462
        'sea' => 'application/x-sea',
463
        'set' => 'application/set',
464
        'sgm' => 'text/sgml',
465
        'sgml' => 'text/x-sgml',
466
        'shar' => 'application/x-shar',
467
        'shtml' => 'text/html',
468
        'sid' => 'audio/x-psid',
469
        'skd' => 'application/x-koan',
470
        'skm' => 'application/x-koan',
471
        'skt' => 'application/x-koan',
472
        'sl' => 'application/x-seelogo',
473
        'smi' => 'application/smil',
474
        'smil' => 'application/smil',
475
        'sol' => 'application/solids',
476
        'spl' => 'application/futuresplash',
477
        'spr' => 'application/x-sprite',
478
        'sprite' => 'application/x-sprite',
479
        'ssi' => 'text/x-server-parsed-html',
480
        'ssm' => 'application/streamingmedia',
481
        'sst' => 'application/vnd.ms-pki.certstore',
482
        'step' => 'application/step',
483
        'stp' => 'application/step',
484
        'sv4cpio' => 'application/x-sv4cpio',
485
        'sv4crc' => 'application/x-sv4crc',
486
        'svf' => 'image/vnd.dwg',
487
        't' => 'application/x-troff',
488
        'talk' => 'text/x-speech',
489
        'tbk' => 'application/toolbook',
490
        'tcl' => 'text/x-script.tcl',
491
        'tcsh' => 'text/x-script.tcsh',
492
        'tex' => 'application/x-tex',
493
        'texi' => 'application/x-texinfo',
494
        'texinfo' => 'application/x-texinfo',
495
        'tr' => 'application/x-troff',
496
        'tsi' => 'audio/tsp-audio',
497
        'tsv' => 'text/tab-separated-values',
498
        'turbot' => 'image/florian',
499
        'uil' => 'text/x-uil',
500
        'uni' => 'text/uri-list',
501
        'unis' => 'text/uri-list',
502
        'unv' => 'application/i-deas',
503
        'uri' => 'text/uri-list',
504
        'uris' => 'text/uri-list',
505
        'ustar' => 'application/x-ustar',
506
        'uu' => 'text/x-uuencode',
507
        'uue' => 'text/x-uuencode',
508
        'vcd' => 'application/x-cdlink',
509
        'vcs' => 'text/x-vcalendar',
510
        'vda' => 'application/vda',
511
        'vdo' => 'video/vdo',
512
        'vew' => 'application/groupwise',
513
        'viv' => 'video/vnd.vivo',
514
        'vivo' => 'video/vnd.vivo',
515
        'vmd' => 'application/vocaltec-media-desc',
516
        'vmf' => 'application/vocaltec-media-file',
517
        'voc' => 'audio/x-voc',
518
        'vos' => 'video/vosaic',
519
        'vox' => 'audio/voxware',
520
        'vqe' => 'audio/x-twinvq-plugin',
521
        'vqf' => 'audio/x-twinvq',
522
        'vql' => 'audio/x-twinvq-plugin',
523
        'vrml' => 'model/vrml',
524
        'vrt' => 'x-world/x-vrt',
525
        'vst' => 'application/x-visio',
526
        'vsw' => 'application/x-visio',
527
        'w60' => 'application/wordperfect6.0',
528
        'w61' => 'application/wordperfect6.1',
529
        'w6w' => 'application/msword',
530
        'wb1' => 'application/x-qpro',
531
        'web' => 'application/vnd.xara',
532
        'wiz' => 'application/msword',
533
        'wk1' => 'application/x-123',
534
        'wmf' => 'windows/metafile',
535
        'wmlc' => 'application/vnd.wap.wmlc',
536
        'wmlsc' => 'application/vnd.wap.wmlscriptc',
537
        'word' => 'application/msword',
538
        'wp5' => 'application/wordperfect',
539
        'wpd' => 'application/wordperfect',
540
        'wq1' => 'application/x-lotus',
541
        'wrz' => 'model/vrml',
542
        'wsc' => 'text/scriplet',
543
        'wsrc' => 'application/x-wais-source',
544
        'wtk' => 'application/x-wintalk',
545
        'xbm' => 'image/x-xbitmap',
546
        'xdr' => 'video/x-amt-demorun',
547
        'xgz' => 'xgl/drawing',
548
        'xif' => 'image/vnd.xiff',
549
        'xl' => 'application/excel',
550
        'xlb' => 'application/excel',
551
        'xlc' => 'application/excel',
552
        'xld' => 'application/excel',
553
        'xlk' => 'application/excel',
554
        'xll' => 'application/excel',
555
        'xlm' => 'application/excel',
556
        'xlt' => 'application/excel',
557
        'xlv' => 'application/excel',
558
        'xlw' => 'application/excel',
559
        'xm' => 'audio/xm',
560
        'xmz' => 'xgl/movie',
561
        'xpix' => 'application/x-vnd.ls-xpix',
562
        'xpm' => 'image/x-xpixmap',
563
        'xsr' => 'video/x-amt-showrun',
564
        'xwd' => 'image/x-xwd',
565
        'xyz' => 'chemical/x-pdb',
566
        'zoo' => 'application/octet-stream',
567
        'zsh' => 'text/x-script.zsh',
568
    ];
569
570
    /** @var ArrayPath */
571
    protected $pathLib = null;
572
573 10
    public function __construct()
574
    {
575 10
        $this->pathLib = new ArrayPath();
576 10
    }
577
578 1
    public function canUse($source): bool
579
    {
580 1
        return true;
581
    }
582
583 4
    public function getMime(array $path): string
584
    {
585 4
        return $this->mimeByExt(Stuff::fileExt($this->pathLib->setArray($path)->getFileName()));
586
    }
587
588 6
    public function mimeByExt(string $ext): string
589
    {
590 6
        $ext = strtolower($ext);
591 6
        return isset($this->mimeTypes[$ext]) ? $this->mimeTypes[$ext] : 'application/octet-stream';
592
    }
593
}
594