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

Vindi::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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