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.

Accept::create()   A
last analyzed

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 Accept
7
 *
8
 * @package AlibabaCloud\Client
9
 */
10
class Accept
11
{
12
    /**
13
     * @var string
14
     */
15
    private $format;
16
17
    /**
18
     * Accept constructor.
19
     *
20
     * @param string $format
21
     */
22 22
    private function __construct($format)
23
    {
24 22
        $this->format = $format;
25 22
    }
26
27
    /**
28
     * @param $format
29
     *
30
     * @return Accept
31
     */
32 22
    public static function create($format)
33
    {
34 22
        return new static($format);
35
    }
36
37
    /**
38
     * @return mixed|string
39
     */
40 22
    public function toString()
41
    {
42 22
        $key = \strtoupper($this->format);
43
44
        $list = [
45 22
            'JSON' => 'application/json',
46 22
            'XML'  => 'application/xml',
47 22
            'RAW'  => 'application/octet-stream',
48
            'FORM' => 'application/x-www-form-urlencoded'
49 22
        ];
50
51 22
        return isset($list[$key]) ? $list[$key] : $list['RAW'];
52
    }
53
}
54