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.
Test Setup Failed
Push — master ( fe4962...3aa77f )
by Thijs
04:04
created

PlatformConfig::setUserName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace WebservicesNl\Platform\Webservices;
4
5
use WebservicesNl\Common\Exception\Client\InputException;
6
use WebservicesNl\Platform\AbstractConfig;
7
8
/**
9
 * Platform Config file.
10
 * Webservices config file for connecting to the Webservices Platform.
11
 */
12
class PlatformConfig extends AbstractConfig
13
{
14
    const DEFAULT_RESPONSE_TIMEOUT = 20;
15
    const PLATFORM_NAME = 'Webservices';
16
    const RETRY_MINUTES = 60;
17
18
    /**
19
     * Connection timeout in seconds.
20
     *
21
     * @var int
22
     */
23
    private $connectionTimeout = 5;
24
25
    /**
26
     * Webservices provided password (mandatory).
27
     *
28
     * @var string
29
     */
30
    private $password;
31
32
    /**
33
     * Response timeout in seconds. (Webservices specific).
34
     *
35
     * @var int
36
     */
37
    private $responseTimeout = self::DEFAULT_RESPONSE_TIMEOUT;
38
39
    /**
40
     * Threshold when to try server again after failure (in minutes).
41
     *
42
     * @var int
43
     */
44
    private $retryMinutes = self::RETRY_MINUTES;
45
46
    /**
47
     * Webservices provided username (mandatory).
48
     *
49
     * @var string
50
     */
51
    private $userName;
52
53
    /**
54
     * WebservicesConfig constructor.
55
     *
56
     * @param array $settings
57
     *
58
     * @return PlatformConfig
59
     * @throws InputException
60
     */
61
    public function loadFromArray(array $settings = [])
62
    {
63
        $settings = array_filter($settings);
64
        if (!array_key_exists('username', $settings) || !array_key_exists('password', $settings)) {
65
            throw new InputException('Not all mandatory config credentials are set');
66
        }
67
        $this->password = $settings['password'];
68
        $this->userName = $settings['username'];
69
70
        return $this;
71
    }
72
73
74
    /**
75
     * Get the connection timeout.
76
     *
77
     * @return int
78
     */
79
    public function getConnectionTimeout()
80
    {
81
        return $this->connectionTimeout;
82
    }
83
84
    /**
85
     * Set connection timeout.
86
     *
87
     * @param int $connectionTimeout
88
     */
89
    public function setConnectionTimeout($connectionTimeout)
90
    {
91
        $this->connectionTimeout = $connectionTimeout;
92
    }
93
94
    /**
95
     * Get the password.
96
     *
97
     * @return string
98
     */
99
    public function getPassword()
100
    {
101
        return $this->password;
102
    }
103
104
    /**
105
     * Set the password.
106
     *
107
     * @param string $password
108
     */
109
    public function setPassword($password)
110
    {
111
        $this->password = $password;
112
    }
113
114
    /**
115
     * Return the timeout.
116
     *
117
     * @return int
118
     */
119
    public function getResponseTimeout()
120
    {
121
        return $this->responseTimeout;
122
    }
123
124
    /**
125
     * Set response timeout.
126
     *
127
     * @param int $responseTimeout
128
     */
129
    public function setResponseTimeout($responseTimeout)
130
    {
131
        $this->responseTimeout = $responseTimeout;
132
    }
133
134
    /**
135
     * Return the retry minutes
136
     *
137
     * @return int
138
     */
139
    public function getRetryMinutes()
140
    {
141
        return $this->retryMinutes;
142
    }
143
144
    /**
145
     * set retryMinutes.
146
     *
147
     * @param int $retryMinutes
148
     */
149
    public function setRetryMinutes($retryMinutes)
150
    {
151
        $this->retryMinutes = $retryMinutes;
152
    }
153
154
    /**
155
     * Return the username.
156
     *
157
     * @return string
158
     */
159
    public function getUserName()
160
    {
161
        return $this->userName;
162
    }
163
164
    /**
165
     * Set username.
166
     *
167
     * @param string $userName
168
     */
169
    public function setUserName($userName)
170
    {
171
        $this->userName = $userName;
172
    }
173
174
    /**
175
     * {@inheritdoc}
176
     * @return array
177
     */
178
    public function toArray()
179
    {
180
        return array_filter(
181
            [
182
                'connectionTimoout' => $this->getConnectionTimeout(),
183
                'password'          => $this->getPassword(),
184
                'responseTimeout'   => $this->getResponseTimeout(),
185
                'retryMinutes'      => $this->getRetryMinutes(),
186
                'userName'          => $this->getUserName(),
187
            ]
188
        );
189
    }
190
191
    /**
192
     * {@inheritdoc}
193
     * @return string
194
     */
195
    public function getConnectorName()
196
    {
197
        return __NAMESPACE__ . '\Connector';
198
    }
199
}
200