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.
Passed
Pull Request — master (#134)
by Yong
04:07
created

Format::create()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AlibabaCloud\Client;
4
5
/**
6
 * Class Format
7
 *
8
 * @package AlibabaCloud\Client
9
 */
10
class Format
11
{
12
    /**
13
     * @var string
14
     */
15
    private $format;
16
17
    /**
18
     * Format constructor.
19
     *
20
     * @param string $format
21
     */
22 21
    private function __construct($format)
23
    {
24 21
        $this->format = $format;
25 21
    }
26
27
    /**
28
     * @param $format
29
     *
30
     * @return Format
31
     */
32 21
    public static function create($format)
33
    {
34 21
        return new static($format);
35
    }
36
37
    /**
38
     * @return mixed|string
39
     */
40 21
    public function toString()
41
    {
42 21
        $key = \strtoupper($this->format);
43
44
        $list = [
45 21
            'JSON' => 'application/json',
46
            'XML'  => 'application/xml'
47 21
        ];
48
49 21
        return isset($list[$key]) ? $list[$key] : 'application/octet-stream';
50
    }
51
}
52