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
Push — master ( f46caf...34ae45 )
by Rubens
01:50
created

Vindi::setApiKey()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Vindi;
4
5
class Vindi
0 ignored issues
show
Coding Style introduced by
Since you have declared the constructor as private, maybe you should also declare the class as final.
Loading history...
6
{
7
    /**
8
     * The Environment variable name or argument for API URI.
9
     *
10
     * @var string
11
     */
12
    const VINDI_API_URI = 'VINDI_API_URI';
13
14
    /**
15
     * The Environment variable name or argument for API Key.
16
     *
17
     * @var string
18
     */
19
    const VINDI_API_KEY = 'VINDI_API_KEY';
20
21
    /**
22
     * API KEY to be set on instances
23
     *
24
     * @var string
25
     */
26
    private static $vindi_api_key;
27
28
    /**
29
     * URI to be set on instances
30
     * Ex.: https://sandbox-app.vindi.com.br/api/v1/
31
     *
32
     * @var string;
33
     */
34
    private static $vindi_api_uri;
35
36
    /**
37
     * This Package SDK Version.
38
     *
39
     * @var string
40
     */
41
    public static $sdkVersion = '1.1.0';
42
43
    /**
44
     * The Environment variable name for API Time Out.
45
     *
46
     * @var string
47
     */
48
    public static $apiTimeOutEnvVar = 'VINDI_API_TIME_OUT';
49
50
    /**
51
     * Vindi constructor.
52
     */
53
    private function __construct()
54
    {
55
    }
56
57
    /**
58
     * Set API KEY
59
     *
60
     * @param $vindi_api_key
61
     */
62 2
    public static function setApiKey($vindi_api_key)
63
    {
64 2
        if (null === self::$vindi_api_key) {
65 2
            self::$vindi_api_key = $vindi_api_key;
66 2
        }
67 2
    }
68
69
    /**
70
     * Set API URI
71
     *
72
     * @param $vindi_api_uri
73
     */
74 2
    public static function setApiUri($vindi_api_uri)
75
    {
76 2
        if (null === self::$vindi_api_uri) {
77 2
            self::$vindi_api_uri = $vindi_api_uri;
78 2
        }
79 2
    }
80
81
    /**
82
     * Get Vindi API URI from environment.
83
     *
84
     * @return string
85
     */
86 432
    public static function getApiUri()
87
    {
88 432
        if (null !== self::$vindi_api_uri) {
89 2
            return self::$vindi_api_uri;
90
        }
91
92 432
        if (!empty(getenv(static::VINDI_API_URI))) {
93 2
            return getenv(static::VINDI_API_URI);
94
        }
95
96 432
        return 'https://app.vindi.com.br/api/v1/';
97
    }
98
99
    /**
100
     * Get Vindi API Key from environment.
101
     *
102
     * @return string
103
     */
104 432
    public static function getApiKey()
105
    {
106 432
        if (null !== self::$vindi_api_key) {
107 2
            return self::$vindi_api_key;
108
        }
109
110 432
        return getenv(static::VINDI_API_KEY);
111
    }
112
113
    /**
114
     * Get Vindi API Time Out from environment.
115
     *
116
     * @return string
117
     */
118 432
    public static function getApiTimeOut()
119
    {
120 432
        if (empty(getenv(static::$apiTimeOutEnvVar))) {
121 432
            return 60;
122
        }
123 2
        return getenv(static::$apiTimeOutEnvVar);
124
    }
125
126
    /**
127
     * Get CA Bundle Path.
128
     *
129
     * @return string
130
     */
131 432
    public static function getCertPath()
132
    {
133 432
        return realpath(sprintf('%s/%s', dirname(__FILE__), '/../data/ssl/ca-bundle.crt'));
134
    }
135
}
136