|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ConfigToken\ConnectionSettings\Types; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
use ConfigToken\FileClient\Types\GitLabRepoClient; |
|
7
|
|
|
|
|
8
|
|
|
class GitLabRepoConnectionSettings extends GitRepoConnectionSettings |
|
9
|
|
|
{ |
|
10
|
|
|
const API_URL = 'url'; |
|
11
|
|
|
const API_TOKEN = 'api-token'; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Get the file server type identifier corresponding to the client's implementation. |
|
15
|
|
|
* |
|
16
|
|
|
* @return string|null If fallback class for all server types. |
|
17
|
|
|
*/ |
|
18
|
|
|
public static function getServerType() |
|
19
|
|
|
{ |
|
20
|
|
|
return GitLabRepoClient::getServerType(); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Check if the GitLab API URL was set. |
|
25
|
|
|
* |
|
26
|
|
|
* @return boolean |
|
27
|
|
|
*/ |
|
28
|
|
|
public function hasUrl() |
|
29
|
|
|
{ |
|
30
|
|
|
return $this->hasParameter(self::API_URL); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Get the GitLab API URL. |
|
35
|
|
|
* |
|
36
|
|
|
* @return string|null |
|
37
|
|
|
*/ |
|
38
|
|
|
public function getUrl() |
|
39
|
|
|
{ |
|
40
|
|
|
return $this->getParameter(self::API_URL); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Set the GitLab API URL. |
|
45
|
|
|
* |
|
46
|
|
|
* @param string $value The new value. |
|
47
|
|
|
* @return $this |
|
48
|
|
|
*/ |
|
49
|
|
|
public function setUrl($value) |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->setParameter(self::API_URL, $value); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Check if the GitLab API token was set. |
|
56
|
|
|
* |
|
57
|
|
|
* @return boolean |
|
58
|
|
|
*/ |
|
59
|
|
|
public function hasApiToken() |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->hasParameter(self::API_TOKEN); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Get the GitLab API token. |
|
66
|
|
|
* |
|
67
|
|
|
* @return string|null |
|
68
|
|
|
*/ |
|
69
|
|
|
public function getApiToken() |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->getParameter(self::API_TOKEN); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Set the GitLab API token. |
|
76
|
|
|
* |
|
77
|
|
|
* @param string $value The new value. |
|
78
|
|
|
* @return $this |
|
79
|
|
|
*/ |
|
80
|
|
|
public function setApiToken($value) |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->setParameter(self::API_TOKEN, $value); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Get the required keys. |
|
87
|
|
|
* |
|
88
|
|
|
* @return array |
|
89
|
|
|
*/ |
|
90
|
|
|
protected static function getRequiredKeys() |
|
91
|
|
|
{ |
|
92
|
|
|
$result = parent::getRequiredKeys(); |
|
93
|
|
|
$result[] = static::API_URL; |
|
94
|
|
|
$result[] = static::API_TOKEN; |
|
95
|
|
|
return $result; |
|
96
|
|
|
} |
|
97
|
|
|
} |