Completed
Push — master ( 6ea9b4...222850 )
by Andreas
04:32
created

MsOfficeTypeMap::getMap()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 24
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 30
ccs 24
cts 24
cp 1
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 24
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * MsOfficeTypeMap.
4
 *
5
 * @copyright 2018 Institute of Legal Medicine, Medical University of Innsbruck
6
 * @author Andreas Erhard <[email protected]>
7
 * @license LGPL-3.0-only
8
 * @link http://www.gerichtsmedizin.at/
9
 *
10
 * @package fileinfo
11
 */
12
namespace Gmi\Toolkit\Fileinfo\Type;
13
14
/**
15
 * Type mapping provider for Microsoft Office filetypes.
16
 */
17
class MsOfficeTypeMap implements TypeMapInterface
18
{
19
    /**
20
     * {@inheritdoc}
21
     *
22
     * @see https://technet.microsoft.com/en-us/library/ee309278(office.12).aspx
23
     * @see https://blogs.msdn.microsoft.com/vsofficedeveloper/2008/05/08/office-2007-file-format-mime-types-for-http-content-streaming-2/
24
     * @see https://www.askingbox.com/info/mime-types-of-microsoft-office-file-formats
25
     */
26 9
    public function getMap()
27
    {
28
        return [
29 9
            new Type(['doc', 'dot'], 'application/msword'),
30 9
            new Type(['docx'], 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'),
31 9
            new Type(['dotx'], 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'),
32 9
            new Type(['docm'], 'application/vnd.ms-word.document.macroEnabled.12'),
33 9
            new Type(['dotm'], 'application/vnd.ms-word.template.macroEnabled.12'),
34
35 9
            new Type(['xls', 'xlt', 'xla'], 'application/vnd.ms-excel'),
36 9
            new Type(['xlsx'], 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'),
37 9
            new Type(['xltx'], 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'),
38 9
            new Type(['xlsm'], 'application/vnd.ms-excel.sheet.macroEnabled.12'),
39 9
            new Type(['xltm'], 'application/vnd.ms-excel.template.macroEnabled.12'),
40 9
            new Type(['xlam'], 'application/vnd.ms-excel.addin.macroEnabled.12'),
41 9
            new Type(['xlsb'], 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'),
42
43 9
            new Type(['ppt','pot', 'pps', 'ppa'], 'application/vnd.ms-powerpoint'),
44 9
            new Type(['pptx'], 'application/vnd.openxmlformats-officedocument.presentationml.presentation'),
45 9
            new Type(['potx'], 'application/vnd.openxmlformats-officedocument.presentationml.template'),
46 9
            new Type(['ppsx'], 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'),
47 9
            new Type(['ppam'], 'application/vnd.ms-powerpoint.addin.macroEnabled.12'),
48 9
            new Type(['pptm'], 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'),
49 9
            new Type(['potm'], 'application/vnd.ms-powerpoint.template.macroEnabled.12'),
50 9
            new Type(['ppsm'], 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'),
51
52 9
            new Type(['mdb', 'ade', 'adp', 'adn', 'mde', 'mdf', 'mdn', 'mdt', 'mdw'], 'application/vnd.ms-access'),
53 9
            new Type(['accda', 'accdb', 'accde', 'accdr', 'accdt'], 'application/vnd.ms-access'),
54 9
        ];
55
    }
56
}
57