1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Damianopetrungaro\PHPCommitizen; |
6
|
|
|
|
7
|
|
|
class Configuration |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var int |
11
|
|
|
*/ |
12
|
|
|
private $minLengthType; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var int |
16
|
|
|
*/ |
17
|
|
|
private $maxLengthType; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var bool |
21
|
|
|
*/ |
22
|
|
|
private $acceptExtraType; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var array |
26
|
|
|
*/ |
27
|
|
|
private $types; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var int |
31
|
|
|
*/ |
32
|
|
|
private $minLengthScope; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var int |
36
|
|
|
*/ |
37
|
|
|
private $maxLengthScope; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var bool |
41
|
|
|
*/ |
42
|
|
|
private $acceptExtraScope; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var array |
46
|
|
|
*/ |
47
|
|
|
private $scopes; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var int |
51
|
|
|
*/ |
52
|
|
|
private $minLengthDescription; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var int |
56
|
|
|
*/ |
57
|
|
|
private $maxLengthDescription; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var int |
61
|
|
|
*/ |
62
|
|
|
private $minLengthSubject; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var int |
66
|
|
|
*/ |
67
|
|
|
private $maxLengthSubject; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var int |
71
|
|
|
*/ |
72
|
|
|
private $wrapWidthBody; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var int |
76
|
|
|
*/ |
77
|
|
|
private $wrapWidthFooter; |
78
|
|
|
|
79
|
2 |
|
private function __construct( |
80
|
|
|
int $minLengthType, |
81
|
|
|
int $maxLengthType, |
82
|
|
|
bool $acceptExtraType, |
83
|
|
|
array $types, |
84
|
|
|
int $minLengthScope, |
85
|
|
|
int $maxLengthScope, |
86
|
|
|
bool $acceptExtraScope, |
87
|
|
|
array $scopes, |
88
|
|
|
int $minLengthDescription, |
89
|
|
|
int $maxLengthDescription, |
90
|
|
|
int $minLengthSubject, |
91
|
|
|
int $maxLengthSubject, |
92
|
|
|
int $wrapWidthBody, |
93
|
|
|
int $wrapWidthFooter |
94
|
|
|
) |
95
|
|
|
{ |
96
|
2 |
|
$this->minLengthType = $minLengthType; |
97
|
2 |
|
$this->maxLengthType = $maxLengthType; |
98
|
2 |
|
$this->acceptExtraType = $acceptExtraType; |
99
|
2 |
|
$this->types = $types; |
100
|
2 |
|
$this->minLengthScope = $minLengthScope; |
101
|
2 |
|
$this->maxLengthScope = $maxLengthScope; |
102
|
2 |
|
$this->acceptExtraScope = $acceptExtraScope; |
103
|
2 |
|
$this->scopes = $scopes; |
104
|
2 |
|
$this->minLengthDescription = $minLengthDescription; |
105
|
2 |
|
$this->maxLengthDescription = $maxLengthDescription; |
106
|
2 |
|
$this->minLengthSubject = $minLengthSubject; |
107
|
2 |
|
$this->maxLengthSubject = $maxLengthSubject; |
108
|
2 |
|
$this->wrapWidthBody = $wrapWidthBody; |
109
|
2 |
|
$this->wrapWidthFooter = $wrapWidthFooter; |
110
|
2 |
|
} |
111
|
|
|
|
112
|
2 |
|
public static function fromArray(array $configuration): self |
113
|
|
|
{ |
114
|
2 |
|
return new self( |
115
|
2 |
|
$configuration['type']['lengthMin'], |
116
|
2 |
|
$configuration['type']['lengthMax'], |
117
|
2 |
|
$configuration['type']['acceptExtra'], |
118
|
2 |
|
$configuration['type']['values'], |
119
|
2 |
|
$configuration['scope']['lengthMin'], |
120
|
2 |
|
$configuration['scope']['lengthMax'], |
121
|
2 |
|
$configuration['scope']['acceptExtra'], |
122
|
2 |
|
$configuration['scope']['values'], |
123
|
2 |
|
$configuration['description']['lengthMin'], |
124
|
2 |
|
$configuration['description']['lengthMax'], |
125
|
2 |
|
$configuration['subject']['lengthMin'], |
126
|
2 |
|
$configuration['subject']['lengthMax'], |
127
|
2 |
|
$configuration['body']['wrap'], |
128
|
2 |
|
$configuration['footer']['wrap'] |
129
|
|
|
); |
130
|
|
|
} |
131
|
|
|
|
132
|
2 |
|
public function minLengthType(): int |
133
|
|
|
{ |
134
|
2 |
|
return $this->minLengthType; |
135
|
|
|
} |
136
|
|
|
|
137
|
2 |
|
public function maxLengthType(): int |
138
|
|
|
{ |
139
|
2 |
|
return $this->maxLengthType; |
140
|
|
|
} |
141
|
|
|
|
142
|
2 |
|
public function acceptExtraType(): bool |
143
|
|
|
{ |
144
|
2 |
|
return $this->acceptExtraType; |
145
|
|
|
} |
146
|
|
|
|
147
|
2 |
|
public function types(): array |
148
|
|
|
{ |
149
|
2 |
|
return $this->types; |
150
|
|
|
} |
151
|
|
|
|
152
|
2 |
|
public function minLengthScope(): int |
153
|
|
|
{ |
154
|
2 |
|
return $this->minLengthScope; |
155
|
|
|
} |
156
|
|
|
|
157
|
2 |
|
public function maxLengthScope(): int |
158
|
|
|
{ |
159
|
2 |
|
return $this->maxLengthScope; |
160
|
|
|
} |
161
|
|
|
|
162
|
2 |
|
public function acceptExtraScope(): bool |
163
|
|
|
{ |
164
|
2 |
|
return $this->acceptExtraScope; |
165
|
|
|
} |
166
|
|
|
|
167
|
2 |
|
public function scopes(): array |
168
|
|
|
{ |
169
|
2 |
|
return $this->scopes; |
170
|
|
|
} |
171
|
|
|
|
172
|
2 |
|
public function minLengthDescription(): int |
173
|
|
|
{ |
174
|
2 |
|
return $this->minLengthDescription; |
175
|
|
|
} |
176
|
|
|
|
177
|
2 |
|
public function maxLengthDescription(): int |
178
|
|
|
{ |
179
|
2 |
|
return $this->maxLengthDescription; |
180
|
|
|
} |
181
|
|
|
|
182
|
2 |
|
public function minLengthSubject(): int |
183
|
|
|
{ |
184
|
2 |
|
return $this->minLengthSubject; |
185
|
|
|
} |
186
|
|
|
|
187
|
2 |
|
public function maxLengthSubject(): int |
188
|
|
|
{ |
189
|
2 |
|
return $this->maxLengthSubject; |
190
|
|
|
} |
191
|
|
|
|
192
|
2 |
|
public function wrapWidthBody(): int |
193
|
|
|
{ |
194
|
2 |
|
return $this->wrapWidthBody; |
195
|
|
|
} |
196
|
|
|
|
197
|
2 |
|
public function wrapWidthFooter(): int |
198
|
|
|
{ |
199
|
2 |
|
return $this->wrapWidthFooter; |
200
|
|
|
} |
201
|
|
|
} |