-
Notifications
You must be signed in to change notification settings - Fork 145
Expand file tree
/
Copy pathProject.php
More file actions
229 lines (192 loc) · 5.93 KB
/
Copy pathProject.php
File metadata and controls
229 lines (192 loc) · 5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?php
declare(strict_types=1);
namespace PHPCensor\Model\Base;
use PHPCensor\Common\Exception\InvalidArgumentException;
use PHPCensor\Model;
use PHPCensor\Traits\Model\HasCreateDateTrait;
use PHPCensor\Traits\Model\HasUserIdTrait;
/**
* @package PHP Censor
* @subpackage Application
*
* @author Dan Cryer <dan@block8.co.uk>
* @author Dmitry Khomutov <poisoncorpsee@gmail.com>
*/
class Project extends Model
{
use HasCreateDateTrait;
use HasUserIdTrait;
public const TYPE_LOCAL = 'local';
public const TYPE_GIT = 'git';
public const TYPE_GITHUB = 'github';
public const TYPE_BITBUCKET = 'bitbucket';
public const TYPE_GITLAB = 'gitlab';
public const TYPE_GOGS = 'gogs';
public const TYPE_HG = 'hg';
public const TYPE_BITBUCKET_HG = 'bitbucket-hg';
public const TYPE_BITBUCKET_SERVER = 'bitbucket-server';
public const TYPE_SVN = 'svn';
public const MIN_BUILD_PRIORITY = 1;
public const MAX_BUILD_PRIORITY = 2000;
public const DEFAULT_BUILD_PRIORITY = 1000;
public const OFFSET_BETWEEN_BUILD_AND_QUEUE = 24;
protected array $data = [
'id' => null,
'title' => null,
'reference' => null,
'default_branch' => null,
'default_branch_only' => 0,
'ssh_private_key' => null,
'ssh_public_key' => null,
'type' => null,
'access_information' => null,
'build_config' => null,
'overwrite_build_config' => 1,
'allow_public_status' => 0,
'archived' => 0,
'group_id' => 1,
'create_date' => null,
'user_id' => null,
];
protected array $dataTypes = [
'allow_public_status' => 'boolean',
'archived' => 'boolean',
'group_id' => 'integer',
'default_branch_only' => 'boolean',
'create_date' => 'datetime',
'user_id' => 'integer',
'access_information' => 'array',
'overwrite_build_config' => 'boolean'
];
public static array $allowedTypes = [
self::TYPE_LOCAL,
self::TYPE_GIT,
self::TYPE_GITHUB,
self::TYPE_BITBUCKET,
self::TYPE_GITLAB,
self::TYPE_GOGS,
self::TYPE_HG,
self::TYPE_BITBUCKET_HG,
self::TYPE_SVN,
self::TYPE_BITBUCKET_SERVER
];
public function getTitle(): ?string
{
return $this->getDataItem('title');
}
public function setTitle(string $value): bool
{
return $this->setDataItem('title', $value);
}
public function getReference(): ?string
{
return $this->getDataItem('reference');
}
public function setReference(string $value): bool
{
return $this->setDataItem('reference', $value);
}
public function getDefaultBranch(): ?string
{
return $this->getDataItem('default_branch');
}
public function setDefaultBranch(string $value): bool
{
return $this->setDataItem('default_branch', $value);
}
public function getDefaultBranchOnly(): bool
{
return $this->getDataItem('default_branch_only');
}
public function setDefaultBranchOnly(bool $value): bool
{
return $this->setDataItem('default_branch_only', $value);
}
public function getSshPrivateKey(): ?string
{
return $this->getDataItem('ssh_private_key');
}
public function setSshPrivateKey(?string $value): bool
{
return $this->setDataItem('ssh_private_key', $value);
}
public function getSshPublicKey(): ?string
{
return $this->getDataItem('ssh_public_key');
}
public function setSshPublicKey(?string $value): bool
{
return $this->setDataItem('ssh_public_key', $value);
}
public function getType(): ?string
{
return $this->getDataItem('type');
}
/**
* @throws InvalidArgumentException
*/
public function setType(string $value): bool
{
if (!\in_array($value, static::$allowedTypes, true)) {
throw new InvalidArgumentException(
'Column "type" must be one of: ' . \join(', ', static::$allowedTypes) . '.'
);
}
return $this->setDataItem('type', $value);
}
/**
* @return mixed
*/
public function getAccessInformation(string $key = null)
{
$data = $this->getDataItem('access_information');
if ($key === null) {
return $data;
}
return $data[$key] ?? null;
}
public function setAccessInformation(array $value): bool
{
return $this->setDataItem('access_information', $value);
}
public function getBuildConfig(): ?string
{
return $this->getDataItem('build_config');
}
public function setBuildConfig(?string $value): bool
{
return $this->setDataItem('build_config', $value);
}
public function getOverwriteBuildConfig(): bool
{
return $this->getDataItem('overwrite_build_config');
}
public function setOverwriteBuildConfig(bool $value): bool
{
return $this->setDataItem('overwrite_build_config', $value);
}
public function getAllowPublicStatus(): bool
{
return $this->getDataItem('allow_public_status');
}
public function setAllowPublicStatus(bool $value): bool
{
return $this->setDataItem('allow_public_status', $value);
}
public function getArchived(): bool
{
return $this->getDataItem('archived');
}
public function setArchived(bool $value): bool
{
return $this->setDataItem('archived', $value);
}
public function getGroupId(): int
{
return $this->getDataItem('group_id');
}
public function setGroupId(int $value): bool
{
return $this->setDataItem('group_id', $value);
}
}