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 (#40)
by Rubens
01:54
created

Vindi::getApiTimeOut()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

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