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   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 42
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 3 1
A toString() 0 12 2
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