1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* This file is part of phpDocumentor. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @link http://phpdoc.org |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace phpDocumentor\Configuration\Factory; |
15
|
|
|
|
16
|
|
|
use phpDocumentor\Dsn; |
17
|
|
|
use phpDocumentor\Path; |
18
|
|
|
use function getcwd; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Expected phpDocumentor2 configuration arrays used for unit testing. |
22
|
|
|
*/ |
23
|
|
|
final class Version2ExpectedArray |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* Provides the default phpDocumentor2 configuration array. |
27
|
|
|
* |
28
|
|
|
* @return array |
29
|
|
|
*/ |
30
|
|
|
public static function getDefaultArray() : array |
31
|
|
|
{ |
32
|
|
|
return [ |
33
|
|
|
'phpdocumentor' => [ |
34
|
|
|
'title' => 'my-doc', |
35
|
|
|
'use-cache' => true, |
36
|
|
|
'paths' => [ |
37
|
|
|
'output' => new Dsn('build/docs'), |
38
|
|
|
'cache' => new Path('build/cache'), |
39
|
|
|
], |
40
|
|
|
'versions' => [ |
41
|
|
|
'1.0.0' => [ |
42
|
|
|
'folder' => '', |
43
|
|
|
'api' => [ |
44
|
|
|
[ |
45
|
|
|
'format' => 'php', |
46
|
|
|
'source' => [ |
47
|
|
|
'dsn' => new Dsn('file://' . getcwd()), |
48
|
|
|
'paths' => [0 => 'src'], |
49
|
|
|
], |
50
|
|
|
'ignore' => [ |
51
|
|
|
'hidden' => true, |
52
|
|
|
'symlinks' => true, |
53
|
|
|
'paths' => [], |
54
|
|
|
], |
55
|
|
|
'extensions' => [ |
56
|
|
|
0 => 'php', |
57
|
|
|
1 => 'php3', |
58
|
|
|
2 => 'phtml', |
59
|
|
|
], |
60
|
|
|
'visibility' => ['public', 'protected', 'private'], |
61
|
|
|
'default-package-name' => 'Default', |
62
|
|
|
'include-source' => false, |
63
|
|
|
'markers' => [ |
64
|
|
|
0 => 'TODO', |
65
|
|
|
1 => 'FIXME', |
66
|
|
|
], |
67
|
|
|
'encoding' => 'utf-8', |
68
|
|
|
'ignore-tags' => [], |
69
|
|
|
'validate' => false, |
70
|
|
|
], |
71
|
|
|
], |
72
|
|
|
], |
73
|
|
|
], |
74
|
|
|
'templates' => [ |
75
|
|
|
['name' => 'clean'], |
76
|
|
|
], |
77
|
|
|
], |
78
|
|
|
]; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Provides the phpDocumentor2 configuration array with multiple ignore paths. |
83
|
|
|
* |
84
|
|
|
* @return array |
85
|
|
|
*/ |
86
|
|
|
public static function getArrayWithMultipleIgnorePaths() : array |
87
|
|
|
{ |
88
|
|
|
return [ |
89
|
|
|
'phpdocumentor' => [ |
90
|
|
|
'title' => 'my-doc', |
91
|
|
|
'use-cache' => true, |
92
|
|
|
'paths' => [ |
93
|
|
|
'output' => new Dsn('build/docs'), |
94
|
|
|
'cache' => new Path('/build/cache'), |
95
|
|
|
], |
96
|
|
|
'versions' => [ |
97
|
|
|
'1.0.0' => [ |
98
|
|
|
'folder' => '', |
99
|
|
|
'api' => [ |
100
|
|
|
[ |
101
|
|
|
'format' => 'php', |
102
|
|
|
'source' => [ |
103
|
|
|
'dsn' => new Dsn('file://' . getcwd()), |
104
|
|
|
'paths' => [0 => 'src'], |
105
|
|
|
], |
106
|
|
|
'ignore' => [ |
107
|
|
|
'hidden' => true, |
108
|
|
|
'symlinks' => true, |
109
|
|
|
'paths' => [ |
110
|
|
|
0 => 'vendor/*', |
111
|
|
|
1 => 'logs/*', |
112
|
|
|
], |
113
|
|
|
], |
114
|
|
|
'extensions' => [ |
115
|
|
|
0 => 'php', |
116
|
|
|
1 => 'php3', |
117
|
|
|
2 => 'phtml', |
118
|
|
|
], |
119
|
|
|
'visibility' => ['public', 'protected', 'private'], |
120
|
|
|
'default-package-name' => 'Default', |
121
|
|
|
'include-source' => false, |
122
|
|
|
'markers' => [ |
123
|
|
|
0 => 'TODO', |
124
|
|
|
1 => 'FIXME', |
125
|
|
|
], |
126
|
|
|
'encoding' => 'utf-8', |
127
|
|
|
'ignore-tags' => [], |
128
|
|
|
'validate' => false, |
129
|
|
|
], |
130
|
|
|
], |
131
|
|
|
], |
132
|
|
|
], |
133
|
|
|
'templates' => [ |
134
|
|
|
['name' => 'clean'], |
135
|
|
|
], |
136
|
|
|
], |
137
|
|
|
]; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public static function getCustomTargetConfig() : array |
141
|
|
|
{ |
142
|
|
|
return [ |
143
|
|
|
'phpdocumentor' => [ |
144
|
|
|
'title' => 'my-doc', |
145
|
|
|
'use-cache' => true, |
146
|
|
|
'paths' => [ |
147
|
|
|
'output' => new Dsn('build/api/docs'), |
148
|
|
|
'cache' => new Path('/tmp/phpdoc-doc-cache'), |
149
|
|
|
], |
150
|
|
|
'versions' => [ |
151
|
|
|
'1.0.0' => [ |
152
|
|
|
'folder' => '', |
153
|
|
|
'api' => [ |
154
|
|
|
[ |
155
|
|
|
'format' => 'php', |
156
|
|
|
'source' => [ |
157
|
|
|
'dsn' => new Dsn('file://' . getcwd()), |
158
|
|
|
'paths' => [0 => 'src'], |
159
|
|
|
], |
160
|
|
|
'ignore' => [ |
161
|
|
|
'hidden' => true, |
162
|
|
|
'symlinks' => true, |
163
|
|
|
'paths' => [], |
164
|
|
|
], |
165
|
|
|
'extensions' => [ |
166
|
|
|
0 => 'php', |
167
|
|
|
1 => 'php3', |
168
|
|
|
2 => 'phtml', |
169
|
|
|
], |
170
|
|
|
'visibility' => ['public', 'protected', 'private'], |
171
|
|
|
'default-package-name' => 'Default', |
172
|
|
|
'include-source' => false, |
173
|
|
|
'markers' => [ |
174
|
|
|
0 => 'TODO', |
175
|
|
|
1 => 'FIXME', |
176
|
|
|
], |
177
|
|
|
'encoding' => 'utf-8', |
178
|
|
|
'ignore-tags' => [], |
179
|
|
|
'validate' => false, |
180
|
|
|
], |
181
|
|
|
], |
182
|
|
|
], |
183
|
|
|
], |
184
|
|
|
'templates' => [ |
185
|
|
|
['name' => 'clean'], |
186
|
|
|
], |
187
|
|
|
], |
188
|
|
|
]; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Provides a configuration with visibility |
193
|
|
|
* |
194
|
|
|
* @return array |
195
|
|
|
*/ |
196
|
|
|
public static function getDefinedVisibility() : array |
197
|
|
|
{ |
198
|
|
|
return [ |
199
|
|
|
'phpdocumentor' => [ |
200
|
|
|
'title' => 'my-doc', |
201
|
|
|
'use-cache' => true, |
202
|
|
|
'paths' => [ |
203
|
|
|
'output' => new Dsn('build/docs'), |
204
|
|
|
'cache' => new Path('/tmp/phpdoc-doc-cache'), |
205
|
|
|
], |
206
|
|
|
'versions' => [ |
207
|
|
|
'1.0.0' => [ |
208
|
|
|
'folder' => '', |
209
|
|
|
'api' => [ |
210
|
|
|
[ |
211
|
|
|
'format' => 'php', |
212
|
|
|
'source' => [ |
213
|
|
|
'dsn' => new Dsn('file://' . getcwd()), |
214
|
|
|
'paths' => [0 => 'src'], |
215
|
|
|
], |
216
|
|
|
'ignore' => [ |
217
|
|
|
'hidden' => true, |
218
|
|
|
'symlinks' => true, |
219
|
|
|
'paths' => [], |
220
|
|
|
], |
221
|
|
|
'extensions' => [ |
222
|
|
|
0 => 'php', |
223
|
|
|
1 => 'php3', |
224
|
|
|
2 => 'phtml', |
225
|
|
|
], |
226
|
|
|
'visibility' => ['public', 'protected'], |
227
|
|
|
'default-package-name' => 'Default', |
228
|
|
|
'include-source' => false, |
229
|
|
|
'markers' => [ |
230
|
|
|
0 => 'TODO', |
231
|
|
|
1 => 'FIXME', |
232
|
|
|
], |
233
|
|
|
'encoding' => 'utf-8', |
234
|
|
|
'ignore-tags' => [], |
235
|
|
|
'validate' => false, |
236
|
|
|
], |
237
|
|
|
], |
238
|
|
|
], |
239
|
|
|
], |
240
|
|
|
'templates' => [ |
241
|
|
|
['name' => 'clean'], |
242
|
|
|
], |
243
|
|
|
], |
244
|
|
|
]; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* Provides the phpDocumentor2 configuration with encoding. |
249
|
|
|
* |
250
|
|
|
* @return array |
251
|
|
|
*/ |
252
|
|
|
public static function getCustomEncoding() : array |
253
|
|
|
{ |
254
|
|
|
return [ |
255
|
|
|
'phpdocumentor' => [ |
256
|
|
|
'title' => 'my-doc', |
257
|
|
|
'use-cache' => true, |
258
|
|
|
'paths' => [ |
259
|
|
|
'output' => new Dsn('build/docs'), |
260
|
|
|
'cache' => new Path('/tmp/phpdoc-doc-cache'), |
261
|
|
|
], |
262
|
|
|
'versions' => [ |
263
|
|
|
'1.0.0' => [ |
264
|
|
|
'folder' => '', |
265
|
|
|
'api' => [ |
266
|
|
|
[ |
267
|
|
|
'format' => 'php', |
268
|
|
|
'source' => [ |
269
|
|
|
'dsn' => new Dsn('file://' . getcwd()), |
270
|
|
|
'paths' => [0 => 'src'], |
271
|
|
|
], |
272
|
|
|
'ignore' => [ |
273
|
|
|
'hidden' => true, |
274
|
|
|
'symlinks' => true, |
275
|
|
|
'paths' => [], |
276
|
|
|
], |
277
|
|
|
'extensions' => [ |
278
|
|
|
0 => 'php', |
279
|
|
|
1 => 'php3', |
280
|
|
|
2 => 'phtml', |
281
|
|
|
], |
282
|
|
|
'visibility' => ['public', 'protected', 'private'], |
283
|
|
|
'default-package-name' => 'Default', |
284
|
|
|
'include-source' => false, |
285
|
|
|
'markers' => [ |
286
|
|
|
0 => 'TODO', |
287
|
|
|
1 => 'FIXME', |
288
|
|
|
], |
289
|
|
|
'encoding' => 'ISO-8859-1', |
290
|
|
|
'ignore-tags' => [], |
291
|
|
|
'validate' => false, |
292
|
|
|
], |
293
|
|
|
], |
294
|
|
|
], |
295
|
|
|
], |
296
|
|
|
'templates' => [ |
297
|
|
|
['name' => 'clean'], |
298
|
|
|
], |
299
|
|
|
], |
300
|
|
|
]; |
301
|
|
|
} |
302
|
|
|
} |
303
|
|
|
|