Completed
Push — master ( de84eb...d1f862 )
by Jaap
18s queued 11s
created

Version3ExpectedArrays::getDefaultArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 54

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 54
rs 9.0036
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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
/**
17
 * Expected phpDocumentor3 configuration arrays used for unit testing.
18
 */
19
final class Version3ExpectedArrays
20
{
21
    /**
22
     * Provides the default phpDocumentor3 configuration array.
23
     *
24
     * @return array
25
     */
26
    public static function getDefaultArray() : array
27
    {
28
        return [
29
            'phpdocumentor' => [
30
                'use-cache' => true,
31
                'paths' => [
32
                    'output' => 'file://build/docs',
33
                    'cache' => '/tmp/phpdoc-doc-cache',
34
                ],
35
                'versions' => [
36
                    '1.0.0' => [
37
                        'folder' => 'latest',
38
                        'api' => [
39
                            0 => [
40
                                'format' => 'php',
41
                                'source' => [
42
                                    'dsn' => 'file://.',
43
                                    'paths' => [0 => 'src'],
44
                                ],
45
                                'ignore' => [
46
                                    'hidden' => true,
47
                                    'paths' => [0 => 'src/ServiceDefinitions.php'],
48
                                ],
49
                                'extensions' => [
50
                                    0 => 'php',
51
                                    1 => 'php3',
52
                                    2 => 'phtml',
53
                                ],
54
                                'visibility' => ['public'],
55
                                'default-package-name' => 'Default',
56
                                'include-source' => false,
57
                                'markers' => [
58
                                    0 => 'TODO',
59
                                    1 => 'FIXME',
60
                                ],
61
                            ],
62
                        ],
63
                        'guide' => [
64
                            0 => [
65
                                'format' => 'rst',
66
                                'source' => [
67
                                    'dsn' => 'file://../phpDocumentor/phpDocumentor2',
68
                                    'paths' => [0 => 'docs'],
69
                                ],
70
                            ],
71
                        ],
72
                    ],
73
                ],
74
                'templates' => [
75
                    ['name' => 'clean'],
76
                ],
77
            ],
78
        ];
79
    }
80
81
    /**
82
     * Provides a phpDocumentor3 configuration array that contains empty extensions and empty markers.
83
     *
84
     * @return array
85
     */
86
    public static function getArrayWithEmptyExtensionsAndMarkers() : array
87
    {
88
        return [
89
            'phpdocumentor' => [
90
                'use-cache' => true,
91
                'paths' => [
92
                    'output' => 'file://build/docs',
93
                    'cache' => '/tmp/phpdoc-doc-cache',
94
                ],
95
                'versions' => [
96
                    '' => [
97
                        'folder' => '',
98
                        'api' => [
99
                            0 => [
100
                                'format' => 'php',
101
                                'source' => [
102
                                    'dsn' => 'file://.',
103
                                    'paths' => [0 => '.'],
104
                                ],
105
                                'ignore' => [
106
                                    'hidden' => false,
107
                                    'paths' => [],
108
                                ],
109
                                'extensions' => [],
110
                                'visibility' => ['public'],
111
                                'default-package-name' => 'Default',
112
                                'include-source' => false,
113
                                'markers' => [],
114
                            ],
115
                        ],
116
                    ],
117
                ],
118
                'templates' => [
119
                    ['name' => 'clean'],
120
                ],
121
            ],
122
        ];
123
    }
124
125
    /**
126
     * Provides a phpDocumentor3 configuration array that contains multiple versions.
127
     *
128
     * @return array
129
     */
130
    public static function getArrayWithMultipleVersions() : array
131
    {
132
        return [
133
            'phpdocumentor' => [
134
                'use-cache' => true,
135
                'paths' => [
136
                    'output' => 'file://build/docs',
137
                    'cache' => '/tmp/phpdoc-doc-cache',
138
                ],
139
                'versions' => [
140
                    '1.0.0' => ['folder' => 'earliest'],
141
                    '2.0.0' => ['folder' => 'latest'],
142
                ],
143
                'templates' => [
144
                    ['name' => 'clean'],
145
                ],
146
            ],
147
        ];
148
    }
149
150
    public static function getArrayWithMultipleApis() : array
151
    {
152
        return [
153
            'phpdocumentor' => [
154
                'use-cache' => true,
155
                'paths' => [
156
                    'output' => 'file://build/docs',
157
                    'cache' => '/tmp/phpdoc-doc-cache',
158
                ],
159
                'versions' => [
160
                    '1.0.0' => [
161
                        'folder' => 'latest',
162
                        'api' => [
163
                            0 => [
164
                                'format' => 'php',
165
                                'source' => [
166
                                    'dsn' => 'file://.',
167
                                    'paths' => [0 => 'src'],
168
                                ],
169
                                'ignore' => [
170
                                    'hidden' => true,
171
                                    'paths' => [0 => 'src/ServiceDefinitions.php'],
172
                                ],
173
                                'extensions' => [
174
                                    0 => 'php',
175
                                    1 => 'php3',
176
                                    2 => 'phtml',
177
                                ],
178
                                'visibility' => ['public'],
179
                                'default-package-name' => 'Default',
180
                                'include-source' => true,
181
                                'markers' => [
182
                                    0 => 'TODO',
183
                                    1 => 'FIXME',
184
                                ],
185
                            ],
186
                            1 => [
187
                                'format' => 'php3',
188
                                'source' => [
189
                                    'dsn' => 'file://.',
190
                                    'paths' => [0 => 'src'],
191
                                ],
192
                                'ignore' => [
193
                                    'hidden' => true,
194
                                    'paths' => [0 => 'src/ServiceDefinitions.php'],
195
                                ],
196
                                'extensions' => [
197
                                    0 => 'php',
198
                                    1 => 'php3',
199
                                    2 => 'phtml',
200
                                ],
201
                                'visibility' => ['public'],
202
                                'default-package-name' => 'Default',
203
                                'include-source' => false,
204
                                'markers' => [
205
                                    0 => 'TODO',
206
                                    1 => 'FIXME',
207
                                ],
208
                            ],
209
                        ],
210
                    ],
211
                ],
212
                'templates' => [
213
                    ['name' => 'clean'],
214
                ],
215
            ],
216
        ];
217
    }
218
219
    public static function getArrayWithMultipleGuides() : array
220
    {
221
        return [
222
            'phpdocumentor' => [
223
                'use-cache' => true,
224
                'paths' => [
225
                    'output' => 'file://build/docs',
226
                    'cache' => '/tmp/phpdoc-doc-cache',
227
                ],
228
                'versions' => [
229
                    '1.0.0' => [
230
                        'folder' => 'latest',
231
                        'guide' => [
232
                            0 => [
233
                                'format' => 'rst',
234
                                'source' => [
235
                                    'dsn' => 'file://../phpDocumentor/phpDocumentor2',
236
                                    'paths' => [0 => 'docs'],
237
                                ],
238
                            ],
239
                            1 => [
240
                                'format' => 'rst',
241
                                'source' => [
242
                                    'dsn' => 'file://../phpDocumentor/phpDocumentor3',
243
                                    'paths' => [0 => 'docs'],
244
                                ],
245
                            ],
246
                        ],
247
                    ],
248
                ],
249
                'templates' => [
250
                    ['name' => 'clean'],
251
                ],
252
            ],
253
        ];
254
    }
255
256
    public static function getArrayWithMultipleTemplates() : array
257
    {
258
        return [
259
            'phpdocumentor' => [
260
                'use-cache' => true,
261
                'paths' => [
262
                    'output' => 'file://build/docs',
263
                    'cache' => '/tmp/phpdoc-doc-cache',
264
                ],
265
                'versions' => [
266
                    '1.0.0' => [
267
                        'folder' => 'latest',
268
                        'api' => [
269
                            0 => [
270
                                'format' => 'php',
271
                                'source' => [
272
                                    'dsn' => 'file://.',
273
                                    'paths' => [0 => 'src'],
274
                                ],
275
                                'ignore' => [
276
                                    'hidden' => true,
277
                                    'paths' => [],
278
                                ],
279
                                'extensions' => [
280
                                    0 => 'php',
281
                                    1 => 'php3',
282
                                    2 => 'phtml',
283
                                ],
284
                                'visibility' => ['public', 'protected', 'private'],
285
                                'default-package-name' => 'Default',
286
                                'include-source' => false,
287
                                'markers' => [
288
                                    0 => 'TODO',
289
                                    1 => 'FIXME',
290
                                ],
291
                                'encoding' => 'utf8',
292
                                'ignore-tags' => [],
293
                                'validate' => false,
294
                            ],
295
                        ],
296
                        'guide' => [
297
                            0 => [
298
                                'format' => 'rst',
299
                                'source' => [
300
                                    'dsn' => 'file://.',
301
                                    'paths' => [0 => 'docs'],
302
                                ],
303
                            ],
304
                        ],
305
                    ],
306
                ],
307
                'templates' => [
308
                    0 => [
309
                        'name' => 'clean',
310
                        'location' =>
311
                            'https://github.com/phpDocumentor/phpDocumentor2/tree/develop/data/templates/clean',
312
                    ],
313
                    1 => [
314
                        'name' => 'tainted',
315
                        'location' =>
316
                            'https://github.com/phpDocumentor/phpDocumentor2/tree/develop/data/templates/tainted',
317
                    ],
318
                ],
319
            ],
320
        ];
321
    }
322
}
323