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.
Completed
Pull Request — master (#136)
by Frank
01:59
created

AbstractParams::idPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace OpenStack\Common\Api;
4
5
abstract class AbstractParams
6
{
7
    // locations
8
    const QUERY = 'query';
9
    const HEADER = 'header';
10
    const URL = 'url';
11
    const JSON = 'json';
12
    const RAW = 'raw';
13
14
    // types
15
    const STRING_TYPE = "string";
16
    const BOOL_TYPE = "boolean";
17
    const BOOLEAN_TYPE = self::BOOL_TYPE;
18
    const OBJECT_TYPE = "object";
19
    const ARRAY_TYPE = "array";
20
    const NULL_TYPE = "NULL";
21
    const INT_TYPE = 'integer';
22
    const INTEGER_TYPE = self::INT_TYPE;
23
24
    public static function isSupportedLocation(string $val): bool
25
    {
26
        return in_array($val, [self::QUERY, self::HEADER, self::URL, self::JSON, self::RAW]);
27
    }
28
29
    public function limit(): array
30
    {
31
        return [
32
            'type'        => self::INT_TYPE,
33
            'location'    => 'query',
34
            'description' => <<<DESC
35
This will limit the total amount of elements returned in a list up to the number specified. For example, specifying a
36
limit of 10 will return 10 elements, regardless of the actual count.
37
DESC
38
        ];
39
    }
40
41
    public function marker(): array
42
    {
43
        return [
44
            'type'        => 'string',
45
            'location'    => 'query',
46
            'description' => <<<DESC
47
Specifying a marker will begin the list from the value specified. Elements will have a particular attribute that
48
identifies them, such as a name or ID. The marker value will search for an element whose identifying attribute matches
49
the marker value, and begin the list from there.
50
DESC
51
        ];
52
    }
53
54
    public function id(string $type): array
55
    {
56
        return [
57
            'description' => sprintf("The unique ID, or identifier, for the %s", $type),
58
            'type'        => self::STRING_TYPE,
59
            'location'    => self::JSON,
60
        ];
61
    }
62
63
    public function idPath(): array
64
    {
65
        return [
66
            'type'        => self::STRING_TYPE,
67
            'location'    => self::URL,
68
            'description' => 'The unique ID of the resource',
69
        ];
70
    }
71
72
    public function name(string $resource): array
73
    {
74
        return [
75
            'description' => sprintf("The name of the %s", $resource),
76
            'type'        => self::STRING_TYPE,
77
            'location'    => self::JSON,
78
        ];
79
    }
80
81
82
    public function sortDir(): array
83
    {
84
        return [
85
            'type'        => self::STRING_TYPE,
86
            'location'    => self::QUERY,
87
            'description' => "Sorts by one or more sets of attribute and sort direction combinations.",
88
            'enum'        => ['asc', 'desc']
89
        ];
90
    }
91
92
    public function sortKey(): array
93
    {
94
        return [
95
            'type'     => self::STRING_TYPE,
96
            'location' => self::QUERY,
97
            'description' => "Sorts by one or more sets of attribute and sort direction combinations.",
98
        ];
99
    }
100
101
    public function allTenants(): array
102
    {
103
        return [
104
            'type'        => self::BOOL_TYPE,
105
            'location'    => self::QUERY,
106
            'sentAs'      => 'all_tenants',
107
            'description' => '(Admin only) Set this to true to pull volume information from all tenants.',
108
        ];
109
    }
110
}
111