Path::getMimes()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 453
Code Lines 451

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 451
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 453
rs 8

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * Platine Stdlib
5
 *
6
 * Platine Stdlib is a the collection of frequently used php features
7
 *
8
 * This content is released under the MIT License (MIT)
9
 *
10
 * Copyright (c) 2020 Platine Stdlib
11
 *
12
 * Permission is hereby granted, free of charge, to any person obtaining a copy
13
 * of this software and associated documentation files (the "Software"), to deal
14
 * in the Software without restriction, including without limitation the rights
15
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
 * copies of the Software, and to permit persons to whom the Software is
17
 * furnished to do so, subject to the following conditions:
18
 *
19
 * The above copyright notice and this permission notice shall be included in all
20
 * copies or substantial portions of the Software.
21
 *
22
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
 * SOFTWARE.
29
 */
30
31
/**
32
 *  @file Path.php
33
 *
34
 *  The Path (File System, directory, file, etc.) helper class
35
 *
36
 *  @package    Platine\Stdlib\Helper
37
 *  @author Platine Developers Team
38
 *  @copyright  Copyright (c) 2020
39
 *  @license    http://opensource.org/licenses/MIT  MIT License
40
 *  @link   https://www.platine-php.com
41
 *  @version 1.0.0
42
 *  @filesource
43
 */
44
45
declare(strict_types=1);
46
47
namespace Platine\Stdlib\Helper;
48
49
use InvalidArgumentException;
50
51
/**
52
 * @class Path
53
 * @package Platine\Stdlib\Helper
54
 */
55
class Path
56
{
57
    /**
58
     * normalize the path by replace the "\" to "/"
59
     * @param string $path
60
     * @param bool $suffix
61
     * @return string
62
     */
63
    public static function normalizePath(string $path, bool $suffix = false): string
64
    {
65
        // Fix issue for path that contains wrapper like file://
66
        $replace = str_replace('\\', '/', $path) . ($suffix ? '/' : '');
67
        $temp = (array) explode('://', $path);
68
        if (isset($temp[1])) {
69
            $replace = sprintf(
70
                '%s://%s',
71
                $temp[0],
72
                str_replace('\\', '/', $temp[1]) . ($suffix ? '/' : '')
73
            );
74
        }
75
76
        return $replace;
77
    }
78
79
    /**
80
     * normalize the path by replace the "\", "/" to DIRECTORY_SEPARATOR value
81
     * @param string $path
82
     * @param bool $suffix
83
     * @return string
84
     */
85
    public static function normalizePathDS(string $path, bool $suffix = false): string
86
    {
87
        // Fix issue for path that contains wrapper like file://
88
        $replace = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path)
89
                . ($suffix ? DIRECTORY_SEPARATOR : '');
90
        $temp = (array) explode('://', $path);
91
        if (isset($temp[1])) {
92
            $replace = sprintf(
93
                '%s://%s',
94
                $temp[0],
95
                str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $temp[1])
96
                . ($suffix ? DIRECTORY_SEPARATOR : '')
97
            );
98
        }
99
100
        return $replace;
101
    }
102
103
    /**
104
     * Whether the given path is an absolute path
105
     * @param string $path
106
     * @return bool
107
     */
108
    public static function isAbsolutePath(string $path): bool
109
    {
110
        if (empty($path)) {
111
            return false;
112
        }
113
114
        if (
115
            strpos($path, '/') === 0 //Linux/Mac
116
            || preg_match('#^[a-z]:[\/|\\\]{1}.+#i', $path) === 1 //Windows
117
        ) {
118
            return true;
119
        }
120
121
        return false;
122
    }
123
124
    /**
125
     * Return the real path for the given path
126
     * @param string $path
127
     * @return string
128
     */
129
    public static function realPath(string $path): string
130
    {
131
        $normalizedPath = self::normalizePathDS($path, false);
132
        $realPath = realpath($normalizedPath);
133
        if ($realPath === false) {
134
            throw new InvalidArgumentException(sprintf(
135
                'Path [%s] does not exists',
136
                $normalizedPath
137
            ));
138
        }
139
140
        return self::normalizePathDS($realPath, false);
141
    }
142
143
    /**
144
     * Returns canonicalized absolute pathname
145
     * Convert 'this/is/../a/./test/.///is' to 'this/a/test/is'
146
     *
147
     * @param string $path
148
     * @param bool $filter
149
     * @return string
150
     */
151
    public static function convert2Absolute(string $path, bool $filter = true): string
152
    {
153
        $normalizedPath = static::normalizePath($path);
154
        if (strpos($normalizedPath, '..') === false) {
155
            return $normalizedPath;
156
        }
157
158
        $first = '';
159
        $parts = explode('/', $normalizedPath);
160
161
        if ($filter) {
162
            $first = $normalizedPath[0] === '/' ? '/' : '';
163
            $parts = array_filter($parts);
164
        }
165
166
        $absolutes = [];
167
        foreach ($parts as $part) {
168
            if ($part === '.') {
169
                continue;
170
            }
171
172
            if ($part === '..') {
173
                array_pop($absolutes);
174
            } else {
175
                $absolutes[] = $part;
176
            }
177
        }
178
179
        return $first . implode('/', $absolutes);
180
    }
181
182
    /**
183
     * Return the mime type for the given extension
184
     * @param string $extension
185
     * @return string
186
     */
187
    public static function getMimeByExtension(string $extension): string
188
    {
189
        $mimes = self::getMimes();
190
191
        return $mimes[$extension] ?? 'text/plain';
192
    }
193
194
    /**
195
     *  List of mime type
196
     * @return array<string, string>
197
     */
198
    private static function getMimes(): array
199
    {
200
        return  [
201
            '3dm' => 'x-world/x-3dmf',
202
            '3dmf' => 'x-world/x-3dmf',
203
            'a' => 'application/octet-stream',
204
            'aab' => 'application/x-authorware-bin',
205
            'aam' => 'application/x-authorware-map',
206
            'aas' => 'application/x-authorware-seg',
207
            'abc' => 'text/vnd.abc',
208
            'acgi' => 'text/html',
209
            'afl' => 'video/animaflex',
210
            'ai' => 'application/postscript',
211
            'aif' => 'audio/aiff',
212
            'aifc' => 'audio/aiff',
213
            'aiff' => 'audio/aiff',
214
            'aim' => 'application/x-aim',
215
            'aip' => 'text/x-audiosoft-intra',
216
            'ani' => 'application/x-navi-animation',
217
            'aos' => 'application/x-nokia-9000-communicator-add-on-software',
218
            'aps' => 'application/mime',
219
            'arc' => 'application/octet-stream',
220
            'arj' => 'application/octet-stream',
221
            'art' => 'image/x-jg',
222
            'asf' => 'video/x-ms-asf',
223
            'asm' => 'text/x-asm',
224
            'asp' => 'text/asp',
225
            'asx' => 'video/x-ms-asf',
226
            'au' => 'audio/x-au',
227
            'avi' => 'video/avi',
228
            'avs' => 'video/avs-video',
229
            'bcpio' => 'application/x-bcpio',
230
            'bin' => 'application/octet-stream',
231
            'bm' => 'image/bmp',
232
            'bmp' => 'image/bmp',
233
            'boo' => 'application/book',
234
            'book' => 'application/book',
235
            'boz' => 'application/x-bzip2',
236
            'bsh' => 'application/x-bsh',
237
            'bz' => 'application/x-bzip',
238
            'bz2' => 'application/x-bzip2',
239
            'c' => 'text/plain',
240
            'c++' => 'text/plain',
241
            'cat' => 'application/vnd.ms-pki.seccat',
242
            'cc' => 'text/plain',
243
            'ccad' => 'application/clariscad',
244
            'cco' => 'application/x-cocoa',
245
            'cdf' => 'application/cdf',
246
            'cer' => 'application/pkix-cert',
247
            'cha' => 'application/x-chat',
248
            'chat' => 'application/x-chat',
249
            'class' => 'application/java',
250
            'com' => 'application/octet-stream',
251
            'conf' => 'text/plain',
252
            'cpio' => 'application/x-cpio',
253
            'cpp' => 'text/x-c',
254
            'cpt' => 'application/x-cpt',
255
            'crl' => 'application/pkcs-crl',
256
            'crt' => 'application/pkix-cert',
257
            'csh' => 'application/x-csh',
258
            'css' => 'text/css',
259
            'cxx' => 'text/plain',
260
            'dcr' => 'application/x-director',
261
            'deepv' => 'application/x-deepv',
262
            'def' => 'text/plain',
263
            'der' => 'application/x-x509-ca-cert',
264
            'dif' => 'video/x-dv',
265
            'dir' => 'application/x-director',
266
            'dl' => 'video/dl',
267
            'doc' => 'application/msword',
268
            'docx'  => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
269
            'dot' => 'application/msword',
270
            'dp' => 'application/commonground',
271
            'drw' => 'application/drafting',
272
            'dump' => 'application/octet-stream',
273
            'dv' => 'video/x-dv',
274
            'dvi' => 'application/x-dvi',
275
            'dwf' => 'drawing/x-dwf (old)',
276
            'dwg' => 'image/x-dwg',
277
            'dxf' => 'application/dxf',
278
            'dxr' => 'application/x-director',
279
            'el' => 'text/x-script.elisp',
280
            'elc' => 'application/x-elc',
281
            'env' => 'application/x-envoy',
282
            'eps' => 'application/postscript',
283
            'es' => 'application/x-esrehber',
284
            'etx' => 'text/x-setext',
285
            'evy' => 'application/envoy',
286
            'exe' => 'application/octet-stream',
287
            'f' => 'text/plain',
288
            'f77' => 'text/x-fortran',
289
            'f90' => 'text/plain',
290
            'fdf' => 'application/vnd.fdf',
291
            'fif' => 'image/fif',
292
            'fli' => 'video/fli',
293
            'flo' => 'image/florian',
294
            'flx' => 'text/vnd.fmi.flexstor',
295
            'fmf' => 'video/x-atomic3d-feature',
296
            'for' => 'text/plain',
297
            'fpx' => 'image/vnd.fpx',
298
            'frl' => 'application/freeloader',
299
            'funk' => 'audio/make',
300
            'g' => 'text/plain',
301
            'g3' => 'image/g3fax',
302
            'gif' => 'image/gif',
303
            'gl' => 'video/gl',
304
            'gsd' => 'audio/x-gsm',
305
            'gsm' => 'audio/x-gsm',
306
            'gsp' => 'application/x-gsp',
307
            'gss' => 'application/x-gss',
308
            'gtar' => 'application/x-gtar',
309
            'gz' => 'application/x-gzip',
310
            'gzip' => 'application/x-gzip',
311
            'h' => 'text/plain',
312
            'hdf' => 'application/x-hdf',
313
            'help' => 'application/x-helpfile',
314
            'hgl' => 'application/vnd.hp-hpgl',
315
            'hh' => 'text/plain',
316
            'hlb' => 'text/x-script',
317
            'hlp' => 'application/hlp',
318
            'hpg' => 'application/vnd.hp-hpgl',
319
            'hpgl' => 'application/vnd.hp-hpgl',
320
            'hqx' => 'application/binhex',
321
            'hta' => 'application/hta',
322
            'htc' => 'text/x-component',
323
            'htm' => 'text/html',
324
            'html' => 'text/html',
325
            'htmls' => 'text/html',
326
            'htt' => 'text/webviewhtml',
327
            'htx' => 'text/html',
328
            'ice' => 'x-conference/x-cooltalk',
329
            'ico' => 'image/x-icon',
330
            'idc' => 'text/plain',
331
            'ief' => 'image/ief',
332
            'iefs' => 'image/ief',
333
            'iges' => 'application/iges',
334
            'igs' => 'application/iges',
335
            'ima' => 'application/x-ima',
336
            'imap' => 'application/x-httpd-imap',
337
            'inf' => 'application/inf',
338
            'ins' => 'application/x-internett-signup',
339
            'ip' => 'application/x-ip2',
340
            'isu' => 'video/x-isvideo',
341
            'it' => 'audio/it',
342
            'iv' => 'application/x-inventor',
343
            'ivr' => 'i-world/i-vrml',
344
            'ivy' => 'application/x-livescreen',
345
            'jam' => 'audio/x-jam',
346
            'jav' => 'text/plain',
347
            'java' => 'text/plain',
348
            'jcm' => 'application/x-java-commerce',
349
            'jfif' => 'image/jpeg',
350
            'jfif-tbnl' => 'image/jpeg',
351
            'jpe' => 'image/jpeg',
352
            'jpeg' => 'image/jpeg',
353
            'jpg' => 'image/jpeg',
354
            'jps' => 'image/x-jps',
355
            'js' => 'text/javascript',
356
            'jut' => 'image/jutvision',
357
            'kar' => 'audio/midi',
358
            'ksh' => 'application/x-ksh',
359
            'la' => 'audio/nspaudio',
360
            'lam' => 'audio/x-liveaudio',
361
            'latex' => 'application/x-latex',
362
            'lha' => 'application/octet-stream',
363
            'lhx' => 'application/octet-stream',
364
            'list' => 'text/plain',
365
            'lma' => 'audio/nspaudio',
366
            'log' => 'text/plain',
367
            'lsp' => 'application/x-lisp',
368
            'lst' => 'text/plain',
369
            'lsx' => 'text/x-la-asf',
370
            'ltx' => 'application/x-latex',
371
            'lzx' => 'application/lzx',
372
            'm' => 'text/plain',
373
            'm1v' => 'video/mpeg',
374
            'm2a' => 'audio/mpeg',
375
            'm2v' => 'video/mpeg',
376
            'm3u' => 'audio/x-mpequrl',
377
            'man' => 'application/x-troff-man',
378
            'map' => 'application/x-navimap',
379
            'mar' => 'text/plain',
380
            'mbd' => 'application/mbedlet',
381
            'mc$' => 'application/x-magic-cap-package-1.0',
382
            'mcd' => 'application/mcad',
383
            'mcf' => 'text/mcf',
384
            'mcp' => 'application/netmc',
385
            'me' => 'application/x-troff-me',
386
            'mht' => 'message/rfc822',
387
            'mhtml' => 'message/rfc822',
388
            'mid' => 'audio/midi',
389
            'midi' => 'audio/midi',
390
            'mif' => 'application/x-mif',
391
            'mime' => 'www/mime',
392
            'mjf' => 'audio/x-vnd.audioexplosion.mjuicemediafile',
393
            'mjpg' => 'video/x-motion-jpeg',
394
            'mm' => 'application/base64',
395
            'mme' => 'application/base64',
396
            'mod' => 'audio/mod',
397
            'moov' => 'video/quicktime',
398
            'mov' => 'video/quicktime',
399
            'movie' => 'video/x-sgi-movie',
400
            'mp2' => 'video/mpeg',
401
            'mp3' => 'audio/mpeg3',
402
            'mpa' => 'audio/mpeg',
403
            'mpc' => 'application/x-project',
404
            'mpe' => 'video/mpeg',
405
            'mpeg' => 'video/mpeg',
406
            'mpg' => 'video/mpeg',
407
            'mpga' => 'audio/mpeg',
408
            'mpp' => 'application/vnd.ms-project',
409
            'mpt' => 'application/x-project',
410
            'mpv' => 'application/x-project',
411
            'mpx' => 'application/x-project',
412
            'mrc' => 'application/marc',
413
            'ms' => 'application/x-troff-ms',
414
            'mv' => 'video/x-sgi-movie',
415
            'my' => 'audio/make',
416
            'mzz' => 'application/x-vnd.audioexplosion.mzz',
417
            'nap' => 'image/naplps',
418
            'naplps' => 'image/naplps',
419
            'nc' => 'application/x-netcdf',
420
            'ncm' => 'application/vnd.nokia.configuration-message',
421
            'nif' => 'image/x-niff',
422
            'niff' => 'image/x-niff',
423
            'nix' => 'application/x-mix-transfer',
424
            'nsc' => 'application/x-conference',
425
            'nvd' => 'application/x-navidoc',
426
            'o' => 'application/octet-stream',
427
            'oda' => 'application/oda',
428
            'omc' => 'application/x-omc',
429
            'omcd' => 'application/x-omcdatamaker',
430
            'omcr' => 'application/x-omcregerator',
431
            'p' => 'text/x-pascal',
432
            'p10' => 'application/pkcs10',
433
            'p12' => 'application/pkcs-12',
434
            'p7a' => 'application/x-pkcs7-signature',
435
            'p7c' => 'application/pkcs7-mime',
436
            'p7m' => 'application/pkcs7-mime',
437
            'p7r' => 'application/x-pkcs7-certreqresp',
438
            'p7s' => 'application/pkcs7-signature',
439
            'part' => 'application/pro_eng',
440
            'pas' => 'text/pascal',
441
            'pbm' => 'image/x-portable-bitmap',
442
            'pcl' => 'application/x-pcl',
443
            'pct' => 'image/x-pict',
444
            'pcx' => 'image/x-pcx',
445
            'pdb' => 'chemical/x-pdb',
446
            'pdf' => 'application/pdf',
447
            'pfunk' => 'audio/make',
448
            'pgm' => 'image/x-portable-graymap',
449
            'pic' => 'image/pict',
450
            'pict' => 'image/pict',
451
            'pkg' => 'application/x-newton-compatible-pkg',
452
            'pko' => 'application/vnd.ms-pki.pko',
453
            'pl' => 'text/plain',
454
            'plx' => 'application/x-pixclscript',
455
            'pm' => 'image/x-xpixmap',
456
            'pm4' => 'application/x-pagemaker',
457
            'pm5' => 'application/x-pagemaker',
458
            'png' => 'image/png',
459
            'pnm' => 'application/x-portable-anymap',
460
            'pot' => 'application/mspowerpoint',
461
            'pov' => 'model/x-pov',
462
            'ppa' => 'application/vnd.ms-powerpoint',
463
            'ppm' => 'image/x-portable-pixmap',
464
            'pps' => 'application/mspowerpoint',
465
            'ppt' => 'application/mspowerpoint',
466
            'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
467
            'ppz' => 'application/mspowerpoint',
468
            'pre' => 'application/x-freelance',
469
            'prt' => 'application/pro_eng',
470
            'ps' => 'application/postscript',
471
            'psd' => 'application/octet-stream',
472
            'pvu' => 'paleovu/x-pv',
473
            'pwz' => 'application/vnd.ms-powerpoint',
474
            'py' => 'text/x-script.phyton',
475
            'pyc' => 'application/x-bytecode.python',
476
            'qcp' => 'audio/vnd.qcelp',
477
            'qd3' => 'x-world/x-3dmf',
478
            'qd3d' => 'x-world/x-3dmf',
479
            'qif' => 'image/x-quicktime',
480
            'qt' => 'video/quicktime',
481
            'qtc' => 'video/x-qtc',
482
            'qti' => 'image/x-quicktime',
483
            'qtif' => 'image/x-quicktime',
484
            'ra' => 'audio/x-realaudio',
485
            'ram' => 'audio/x-pn-realaudio',
486
            'ras' => 'image/cmu-raster',
487
            'rast' => 'image/cmu-raster',
488
            'rexx' => 'text/x-script.rexx',
489
            'rf' => 'image/vnd.rn-realflash',
490
            'rgb' => 'image/x-rgb',
491
            'rm' => 'application/vnd.rn-realmedia',
492
            'rmi' => 'audio/mid',
493
            'rmm' => 'audio/x-pn-realaudio',
494
            'rmp' => 'audio/x-pn-realaudio',
495
            'rng' => 'application/ringing-tones',
496
            'rnx' => 'application/vnd.rn-realplayer',
497
            'roff' => 'application/x-troff',
498
            'rp' => 'image/vnd.rn-realpix',
499
            'rpm' => 'audio/x-pn-realaudio-plugin',
500
            'rt' => 'text/richtext',
501
            'rtf' => 'application/rtf',
502
            'rtx' => 'application/rtf',
503
            'rv' => 'video/vnd.rn-realvideo',
504
            's' => 'text/x-asm',
505
            's3m' => 'audio/s3m',
506
            'saveme' => 'application/octet-stream',
507
            'sbk' => 'application/x-tbook',
508
            'scm' => 'text/x-script.scheme',
509
            'sdml' => 'text/plain',
510
            'sdp' => 'application/sdp',
511
            'sdr' => 'application/sounder',
512
            'sea' => 'application/sea',
513
            'set' => 'application/set',
514
            'sgm' => 'text/sgml',
515
            'sgml' => 'text/sgml',
516
            'sh' => 'application/x-sh',
517
            'shar' => 'application/x-shar',
518
            'shtml' => 'text/html',
519
            'sid' => 'audio/x-psid',
520
            'sit' => 'application/x-sit',
521
            'skd' => 'application/x-koan',
522
            'skm' => 'application/x-koan',
523
            'skp' => 'application/x-koan',
524
            'skt' => 'application/x-koan',
525
            'sl' => 'application/x-seelogo',
526
            'smi' => 'application/smil',
527
            'smil' => 'application/smil',
528
            'snd' => 'audio/basic',
529
            'sol' => 'application/solids',
530
            'spc' => 'text/x-speech',
531
            'spl' => 'application/futuresplash',
532
            'spr' => 'application/x-sprite',
533
            'sprite' => 'application/x-sprite',
534
            'src' => 'application/x-wais-source',
535
            'ssi' => 'text/x-server-parsed-html',
536
            'ssm' => 'application/streamingmedia',
537
            'sst' => 'application/vnd.ms-pki.certstore',
538
            'step' => 'application/step',
539
            'stl' => 'application/vnd.ms-pki.stl',
540
            'stp' => 'application/step',
541
            'sv4cpio' => 'application/x-sv4cpio',
542
            'sv4crc' => 'application/x-sv4crc',
543
            'svf' => 'image/vnd.dwg',
544
            'svr' => 'application/x-world',
545
            'swf' => 'application/x-shockwave-flash',
546
            't' => 'application/x-troff',
547
            'talk' => 'text/x-speech',
548
            'tar' => 'application/x-tar',
549
            'tbk' => 'application/toolbook',
550
            'tcl' => 'application/x-tcl',
551
            'tcsh' => 'text/x-script.tcsh',
552
            'tex' => 'application/x-tex',
553
            'texi' => 'application/x-texinfo',
554
            'texinfo' => 'application/x-texinfo',
555
            'text' => 'text/plain',
556
            'tgz' => 'application/x-compressed',
557
            'tif' => 'image/tiff',
558
            'tiff' => 'image/tiff',
559
            'tr' => 'application/x-troff',
560
            'tsi' => 'audio/tsp-audio',
561
            'tsp' => 'audio/tsplayer',
562
            'tsv' => 'text/tab-separated-values',
563
            'turbot' => 'image/florian',
564
            'txt' => 'text/plain',
565
            'uil' => 'text/x-uil',
566
            'uni' => 'text/uri-list',
567
            'unis' => 'text/uri-list',
568
            'unv' => 'application/i-deas',
569
            'uri' => 'text/uri-list',
570
            'uris' => 'text/uri-list',
571
            'ustar' => 'application/x-ustar',
572
            'uu' => 'application/octet-stream',
573
            'uue' => 'text/x-uuencode',
574
            'vcd' => 'application/x-cdlink',
575
            'vcs' => 'text/x-vcalendar',
576
            'vda' => 'application/vda',
577
            'vdo' => 'video/vdo',
578
            'vew' => 'application/groupwise',
579
            'viv' => 'video/vnd.vivo',
580
            'vivo' => 'video/vnd.vivo',
581
            'vmd' => 'application/vocaltec-media-desc',
582
            'vmf' => 'application/vocaltec-media-file',
583
            'voc' => 'audio/voc',
584
            'vos' => 'video/vosaic',
585
            'vox' => 'audio/voxware',
586
            'vqe' => 'audio/x-twinvq-plugin',
587
            'vqf' => 'audio/x-twinvq',
588
            'vql' => 'audio/x-twinvq-plugin',
589
            'vrml' => 'application/x-vrml',
590
            'vrt' => 'x-world/x-vrt',
591
            'vsd' => 'application/x-visio',
592
            'vst' => 'application/x-visio',
593
            'vsw' => 'application/x-visio',
594
            'w60' => 'application/wordperfect6.0',
595
            'w61' => 'application/wordperfect6.1',
596
            'w6w' => 'application/msword',
597
            'wav' => 'audio/wav',
598
            'wb1' => 'application/x-qpro',
599
            'wbmp' => 'image/vnd.wap.wbmp',
600
            'web' => 'application/vnd.xara',
601
            'wiz' => 'application/msword',
602
            'wk1' => 'application/x-123',
603
            'wmf' => 'windows/metafile',
604
            'wml' => 'text/vnd.wap.wml',
605
            'wmlc' => 'application/vnd.wap.wmlc',
606
            'wmls' => 'text/vnd.wap.wmlscript',
607
            'wmlsc' => 'application/vnd.wap.wmlscriptc',
608
            'word' => 'application/msword',
609
            'wp' => 'application/wordperfect',
610
            'wp5' => 'application/wordperfect',
611
            'wp6' => 'application/wordperfect',
612
            'wpd' => 'application/wordperfect',
613
            'wq1' => 'application/x-lotus',
614
            'wri' => 'application/mswrite',
615
            'wrl' => 'application/x-world',
616
            'wrz' => 'x-world/x-vrml',
617
            'wsc' => 'text/scriplet',
618
            'wsrc' => 'application/x-wais-source',
619
            'wtk' => 'application/x-wintalk',
620
            'xbm' => 'image/xbm',
621
            'xdr' => 'video/x-amt-demorun',
622
            'xgz' => 'xgl/drawing',
623
            'xif' => 'image/vnd.xiff',
624
            'xl' => 'application/excel',
625
            'xla' => 'application/excel',
626
            'xlb' => 'application/excel',
627
            'xlc' => 'application/excel',
628
            'xld' => 'application/excel',
629
            'xlk' => 'application/excel',
630
            'xll' => 'application/excel',
631
            'xlm' => 'application/excel',
632
            'xls' => 'application/excel',
633
            'xlsx'  => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
634
            'xlt' => 'application/excel',
635
            'xlv' => 'application/excel',
636
            'xlw' => 'application/excel',
637
            'xm' => 'audio/xm',
638
            'xml' => 'text/xml',
639
            'xmz' => 'xgl/movie',
640
            'xpix' => 'application/x-vnd.ls-xpix',
641
            'xpm' => 'image/xpm',
642
            'x-png' => 'image/png',
643
            'xsl'   => 'application/xml',
644
            'xsr' => 'video/x-amt-showrun',
645
            'xwd' => 'image/x-xwd',
646
            'xyz' => 'chemical/x-pdb',
647
            'z' => 'application/x-compressed',
648
            'zip' => 'application/zip',
649
            'zoo' => 'application/octet-stream',
650
            'zsh' => 'text/x-script.zsh'
651
        ];
652
    }
653
}
654