Passed
Push — main ( e317c4...c54022 )
by Greg
06:31
created

GovIdType::values()   B

Complexity

Conditions 2
Paths 1

Size

Total Lines 283
Code Lines 275

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 275
nc 1
nop 0
dl 0
loc 283
rs 8
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
/**
4
 * webtrees: online genealogy
5
 * Copyright (C) 2023 webtrees development team
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 * GNU General Public License for more details.
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
 */
17
18
declare(strict_types=1);
19
20
namespace Fisharebest\Webtrees\Elements;
21
22
use Fisharebest\Webtrees\I18N;
23
24
use function is_int;
25
26
/**
27
 * GOV ID, for TYPE_OF_LOCATION
28
 */
29
class GovIdType extends AbstractElement
30
{
31
    /**
32
     * A list of controlled values for this element
33
     *
34
     * @return array<int|string,string>
35
     */
36
    public function values(): array
37
    {
38
        $values = [
39
            ''  => '',
40
            1   => 'Amt',
41
            2   => 'Amtsbezirk',
42
            3   => 'Magistrates’ Court',
43
            4   => 'Bauerschaft',
44
            5   => 'district',
45
            6   => 'diocese',
46
            7   => 'federal state',
47
            8   => 'castle',
48
            9   => 'deanery',
49
            10  => 'Departement',
50
            11  => 'diocese',
51
            12  => 'Dompfarrei',
52
            13  => 'filial church',
53
            14  => 'Flecken',
54
            15  => 'field name',
55
            16  => 'free state',
56
            17  => 'building',
57
            18  => 'municipality',
58
            19  => 'Gerichtsbezirk',
59
            20  => 'countship',
60
            21  => 'manor (building)',
61
            22  => 'dominion',
62
            23  => 'duchy',
63
            24  => 'Farm',
64
            25  => 'canton',
65
            26  => 'church',
66
            27  => 'Kirchenkreis',
67
            28  => 'Kirchenprovinz',
68
            29  => 'parish',
69
            30  => 'monastery (building)',
70
            31  => 'kingdom',
71
            32  => 'county (generic)',
72
            33  => 'electorate',
73
            34  => 'state',
74
            35  => 'national church',
75
            36  => 'rural county (rural)',
76
            37  => 'Oberamt',
77
            38  => 'oblast',
78
            39  => 'place',
79
            40  => 'part of place',
80
            41  => 'Pfarr-Rektorat',
81
            42  => 'parish',
82
            43  => 'Pfarrkuratie',
83
            44  => 'Pfarrverband',
84
            45  => 'province',
85
            46  => 'administrative district',
86
            47  => 'historical region',
87
            48  => 'Samtgemeinde',
88
            49  => 'sprengel',
89
            50  => 'country',
90
            51  => 'town',
91
            52  => 'borough',
92
            53  => 'urban county (city)',
93
            54  => 'part of town',
94
            55  => 'village',
95
            56  => 'republic',
96
            57  => 'Amt',
97
            58  => 'union republic',
98
            59  => 'voivodship',
99
            60  => 'principality',
100
            61  => 'grand duchy',
101
            62  => 'margravate',
102
            63  => 'rayon',
103
            64  => 'Vorwerk',
104
            65  => 'Pfarrdorf',
105
            66  => 'village',
106
            67  => 'solitude',
107
            68  => 'Hauptort',
108
            69  => 'hamlet',
109
            70  => 'bailiwick',
110
            71  => 'confederation',
111
            72  => 'people’s republic',
112
            73  => 'Landdrostei',
113
            74  => 'deprecated',
114
            75  => 'Güterdistrikt',
115
            76  => 'Adeliges Gut',
116
            77  => 'Reichskreis',
117
            78  => 'Amt(administrative division)',
118
            79  => 'hundred',
119
            80  => 'Landschaft',
120
            81  => 'monastery',
121
            82  => 'Domkapitel',
122
            83  => 'Hanseatic city',
123
            84  => 'Kirchspielvogtei',
124
            85  => 'rural municipality',
125
            86  => 'part province',
126
            87  => 'mill',
127
            88  => 'Judet',
128
            89  => 'cemetery',
129
            90  => 'abandoned place',
130
            91  => 'Bistumsregion',
131
            92  => 'Kirchengemeinde',
132
            93  => 'Reichsstadt',
133
            94  => 'Verwaltungsgemeinschaft',
134
            95  => 'county - level city',
135
            96  => 'archbishopric',
136
            97  => 'Bürgermeisterei',
137
            98  => 'veraltet',
138
            99  => 'captaincy',
139
            100 => 'Kreishauptmannschaft',
140
            101 => 'Kreisdirektion',
141
            102 => 'forester’s house',
142
            103 => 'civil registry',
143
            104 => 'veraltet',
144
            105 => 'Landgericht',
145
            107 => 'island',
146
            108 => 'Gutsbezirk',
147
            109 => 'Forstgutsbezirk',
148
            110 => 'district office',
149
            111 => 'Schloss',
150
            112 => 'Gespanschaft',
151
            113 => 'comitatus',
152
            114 => 'Vest',
153
            115 => 'forestry',
154
            116 => 'Oberförsterei',
155
            117 => 'Unterförsterei',
156
            118 => 'train station',
157
            119 => 'stop station',
158
            120 => 'settlement',
159
            121 => 'colony',
160
            122 => 'Verbandsgemeinde',
161
            124 => 'Abbey',
162
            125 => 'imperial abbey',
163
            126 => 'Syssel',
164
            127 => 'Verwaltungsverband',
165
            128 => 'Landgrafschaft',
166
            129 => 'settlement',
167
            130 => 'state',
168
            131 => 'Weichbild',
169
            133 => 'region',
170
            134 => 'arrondissement',
171
            135 => 'canton',
172
            136 => 'commune',
173
            137 => 'region',
174
            138 => 'Oberlandratsbezirk',
175
            139 => 'Einschicht',
176
            140 => 'Einheitsgemeinde',
177
            142 => 'Reichsgau',
178
            143 => 'kommune',
179
            144 => 'Ortschaft',
180
            145 => 'Markt',
181
            146 => 'Bezirkshauptmannschaft',
182
            147 => 'veraltet',
183
            148 => 'Erfüllende Gemeinde',
184
            149 => 'Landratsamt',
185
            150 => 'Stadt',
186
            151 => 'Oberlandesgericht',
187
            152 => 'Landbürgermeisterei',
188
            153 => 'Kommissariat',
189
            154 => 'Honschaft',
190
            155 => 'region',
191
            156 => 'Gemeindebezirk',
192
            157 => 'Guberniya',
193
            158 => 'Gemeindeteil',
194
            159 => 'Khutor',
195
            160 => 'soviet republic',
196
            161 => 'Verwaltungsbezirk',
197
            162 => 'Stadt - und Landgemeinde',
198
            163 => 'Ortsgemeinde',
199
            164 => 'Ortsbezirk',
200
            165 => 'Gnotschaft',
201
            166 => 'ruins',
202
            167 => 'mandate territory',
203
            168 => 'Provinz',
204
            169 => 'Gemeinde',
205
            170 => 'district',
206
            171 => 'Stadthauptmannschaft',
207
            172 => 'Katastralgemeinde',
208
            173 => 'Reichskommissariat',
209
            174 => 'general district',
210
            175 => 'Kreisgebiet',
211
            176 => 'protectorate',
212
            177 => 'Reichsritterschaft',
213
            178 => 'Ritterkanton',
214
            179 => 'Ritterkreis',
215
            180 => 'Marktgemeinde',
216
            181 => 'Rotte',
217
            182 => 'Erzstift',
218
            183 => 'Hochstift',
219
            184 => 'Kammerschreiberei',
220
            185 => 'Klosteramt',
221
            186 => 'Rentkammer',
222
            187 => 'zu überprüfen',
223
            188 => 'Ritterorden',
224
            189 => 'Großpriorat',
225
            190 => 'Ballei',
226
            191 => 'Kommende',
227
            192 => 'zone of occupation',
228
            193 => 'Alm',
229
            194 => 'Distrikts - Amt',
230
            195 => 'veraltet',
231
            196 => 'veraltet',
232
            197 => '',
233
            198 => 'veraltet(früher: Bundesverwaltungsgericht)',
234
            199 => 'veraltet(früher: Landesverwaltungsgericht)',
235
            200 => 'veraltet(früher: Verwaltungsgericht)',
236
            201 => 'Landeskommissarbezirk',
237
            202 => 'Amtsgerichtsbezirk',
238
            203 => 'Domanialamt',
239
            204 => 'Ritterschaftliches Amt',
240
            205 => 'selsoviet',
241
            206 => 'Regionalkirchenamt',
242
            207 => 'Oberamtsbezirk',
243
            210 => 'Kirchenbund',
244
            211 => 'Landgebiet',
245
            212 => 'Landherrenschaft',
246
            213 => 'gorsoviet',
247
            214 => 'realm',
248
            215 => 'Reichshälfte',
249
            216 => 'Landesteil',
250
            217 => 'Direktionsbezirk',
251
            218 => 'Stadt',
252
            219 => 'Expositur',
253
            221 => 'Fylke',
254
            222 => 'Kreis',
255
            223 => 'Landgericht',
256
            224 => 'Pfleggericht',
257
            225 => 'Rentamt',
258
            226 => 'Obmannschaft',
259
            227 => 'Kirchspielslandgemeinde',
260
            228 => 'Gerichtsamt',
261
            229 => 'group of houses',
262
            230 => 'scattered settlement',
263
            231 => 'Höfe',
264
            232 => 'Randort',
265
            233 => 'Flecken',
266
            234 => 'borough',
267
            235 => 'unitary authority',
268
            236 => 'houses',
269
            237 => 'Siedlungsrat',
270
            238 => 'urban - type settlement',
271
            239 => 'Verwaltungsamt',
272
            240 => 'uyezd',
273
            241 => 'Volost',
274
            242 => 'Katasteramt',
275
            243 => 'Propstei',
276
            244 => 'Nebenkirche',
277
            245 => 'chapel',
278
            246 => 'Gromada',
279
            247 => 'Ortsteil',
280
            248 => 'Schulzenamt',
281
            249 => 'Erzbischöfliches Amt',
282
            250 => 'Apostolische Administratur',
283
            251 => 'autonome Gemeinschaft',
284
            252 => 'local government',
285
            253 => 'religious organization',
286
            254 => 'Okrug',
287
            255 => 'Stadtgut',
288
            256 => 'Landesbezirk',
289
            257 => 'Landgemeinde PL',
290
            258 => 'Stadtgemeinde',
291
            259 => 'Landvogteibezirk',
292
            260 => 'Delegaturbezirk',
293
            261 => 'Hofschaft',
294
            262 => 'Stadtteil',
295
            263 => 'Sprengel',
296
            264 => 'Mairie',
297
            265 => 'sultanate',
298
            266 => 'Landratsbezirk',
299
            267 => 'sognekommune',
300
            268 => 'Großgemeinde',
301
            269 => 'Kleingemeinde',
302
            270 => 'Bezirk',
303
            271 => 'Stadt mit Munizipium',
304
            272 => 'Königliche Freistadt',
305
            273 => 'Stadt mit geordnetem Magistrate',
306
            274 => 'unincorporated area',
307
            275 => 'Stadtgemeinde',
308
            276 => 'Hardesvogtei',
309
        ];
310
311
        array_walk($values, static function (string &$value, $key): void {
312
            if (is_int($key)) {
313
                $value .= ' — ' . I18N::number($key);
314
            }
315
        });
316
317
318
        return $values;
319
    }
320
}
321