GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Mime   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 52
c 0
b 0
f 0
ccs 2
cts 4
cp 0.5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFullMime() 0 4 2
A supportsMimeType() 0 4 1
1
<?php
2
3
namespace MultiHttp;
4
5
6
/**
7
 * Class to organize the Mime stuff a bit more
8
 * @author Nate Good <[email protected]>
9
 */
10
class Mime
11
{
12
    const JSON = 'application/json';
13
    const XML = 'application/xml';
14
    const XHTML = 'application/html+xml';
15
    const FORM = 'application/x-www-form-urlencoded';
16
    const UPLOAD = 'multipart/form-data';
17
    const PLAIN = 'text/plain';
18
    const JS = 'text/javascript';
19
    const HTML = 'text/html';
20
    const YAML = 'application/x-yaml';
21
    const CSV = 'text/csv';
22
23
    /**
24
     * Map short name for a mime type
25
     * to a full proper mime type
26
     */
27
    public static $mimes = array(
28
        'json' => self::JSON,
29
        'xml' => self::XML,
30
        'form' => self::FORM,
31
        'plain' => self::PLAIN,
32
        'text' => self::PLAIN,
33
        'upload' => self::UPLOAD,
34
        'html' => self::HTML,
35
        'xhtml' => self::XHTML,
36
        'js' => self::JS,
37
        'javascript' => self::JS,
38
        'yaml' => self::YAML,
39
        'csv' => self::CSV,
40
    );
41
42
    /**
43
     * Get the full Mime Type name from a "short name".
44
     * Returns the short if no mapping was found.
45
     * @param string $short_name common name for mime type (e.g. json)
46
     * @return string full mime type (e.g. application/json)
47
     */
48 2
    public static function getFullMime($short_name)
49
    {
50 2
        return array_key_exists($short_name, self::$mimes) ? self::$mimes[$short_name] : $short_name;
51
    }
52
53
    /**
54
     * @param string $short_name
55
     * @return bool
56
     */
57
    public static function supportsMimeType($short_name)
58
    {
59
        return array_key_exists($short_name, self::$mimes);
60
    }
61
}
62