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

DocumentTypeMap   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 24
loc 24
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMap() 12 12 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * DocumentTypeMap.
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 general document filetypes.
16
 */
17 View Code Duplication
class DocumentTypeMap implements TypeMapInterface
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
    /**
20
     * {@inheritdoc}
21
     *
22
     * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
23
     * @see https://tools.ietf.org/html/rfc7763
24
     * @see https://www.iana.org/assignments/media-types/application/pdf
25
     * @see http://docutils.sourceforge.net/FAQ.html
26
     * @see https://www.thoughtco.com/mime-types-by-content-type-3469108
27
     */
28 9
    public function getMap()
29
    {
30
        return [
31 9
            new Type(['md'], 'text/markdown'),
32 9
            new Type(['pdf'], 'application/pdf'),
33 9
            new Type(['ps', 'eps'], 'application/postscript'),
34 9
            new Type(['rst'], 'text/x-rst'),
35 9
            new Type(['rtf'], 'application/rtf'),
36 9
            new Type(['tex'], 'text/x-tex'),
37 9
            new Type(['txt'], 'text/plain'),
38 9
        ];
39
    }
40
}
41