| Conditions | 5 |
| Paths | 10 |
| Total Lines | 289 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
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:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 108 | public function __construct() { |
||
| 109 | parent::__construct(); |
||
| 110 | $olddomain = $this->languageInstance->setTextDomain("user"); |
||
| 111 | $this->CAT_VERSION_STRING = _("Unreleased <a href='https://github.com/GEANT/CAT/tree/master/Changes.md'>Git Revision</a>"); |
||
| 112 | if (CAT::RELEASE_VERSION) { |
||
| 113 | $temp_version = "CAT-" . CAT::VERSION_MAJOR . "." . CAT::VERSION_MINOR; |
||
| 114 | $branch = "release_" . CAT::VERSION_MAJOR . "_" . CAT::VERSION_MINOR; |
||
| 115 | if (CAT::VERSION_PATCH != 0) { |
||
| 116 | $temp_version .= "." . CAT::VERSION_PATCH; |
||
| 117 | } |
||
| 118 | if (CAT::VERSION_EXTRA != "") { |
||
| 119 | $temp_version .= "-" . CAT::VERSION_EXTRA; |
||
| 120 | } |
||
| 121 | $this->CAT_VERSION_STRING = sprintf(_("Release <a href='%s'>%s</a>"), "https://github.com/GEANT/CAT/tree/" . $branch . "/Changes.md", $temp_version); |
||
| 122 | } |
||
| 123 | $this->CAT_COPYRIGHT = CONFIG['APPEARANCE']['productname'] . " - " . $this->CAT_VERSION_STRING . " © " . CAT::COPYRIGHT_MIN_YEAR . "-" . CAT::COPYRIGHT_MAX_YEAR . " " . CAT::COPYRIGHT_HOLDER . "<br/>on behalf of " . CAT::COPYRIGHT_CONSORTIA . "; and others <a href='copyright.php'>Full Copyright and Licenses</a>"; |
||
| 124 | $this->languageInstance->setTextDomain($olddomain); |
||
| 125 | |||
| 126 | /* Federations are created in DB with bootstrapFederation, and listed via listFederations |
||
| 127 | */ |
||
| 128 | $oldlocale = $this->languageInstance->setTextDomain('core'); |
||
| 129 | |||
| 130 | // some config elements are displayable. We need some dummies to |
||
| 131 | // translate the common values for them. If a deployment chooses a |
||
| 132 | // different wording, no translation, sorry |
||
| 133 | |||
| 134 | $dummy_NRO = _("National Roaming Operator"); |
||
| 135 | $dummy_inst1 = _("identity provider"); |
||
| 136 | $dummy_inst2 = _("organisation"); |
||
| 137 | $dummy_inst3 = _("Identity Provider"); |
||
| 138 | // and do something useless with the strings so that there's no "unused" complaint |
||
| 139 | if (strlen($dummy_NRO . $dummy_inst1 . $dummy_inst2 . $dummy_inst3) < 0) { |
||
| 140 | throw new \Exception("Strings are usually not shorter than 0 characters. We've encountered a string blackhole."); |
||
| 141 | } |
||
| 142 | |||
| 143 | $this->nomenclature_fed = _(CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_federation']); |
||
| 144 | $this->nomenclature_inst = _(CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_institution']); |
||
| 145 | $this->knownFederations = [ |
||
| 146 | 'AD' => _("Andorra"), |
||
| 147 | 'AT' => _("Austria"), |
||
| 148 | 'BE' => _("Belgium"), |
||
| 149 | 'BG' => _("Bulgaria"), |
||
| 150 | 'CY' => _("Cyprus"), |
||
| 151 | 'CZ' => _("Czech Republic"), |
||
| 152 | 'DK' => _("Denmark"), |
||
| 153 | 'EE' => _("Estonia"), |
||
| 154 | 'FI' => _("Finland"), |
||
| 155 | 'FR' => _("France"), |
||
| 156 | 'DE' => _("Germany"), |
||
| 157 | 'GR' => _("Greece"), |
||
| 158 | 'HR' => _("Croatia"), |
||
| 159 | 'IE' => _("Ireland"), |
||
| 160 | 'IS' => _("Iceland"), |
||
| 161 | 'IT' => _("Italy"), |
||
| 162 | 'HU' => _("Hungary"), |
||
| 163 | 'LU' => _("Luxembourg"), |
||
| 164 | 'LV' => _("Latvia"), |
||
| 165 | 'LT' => _("Lithuania"), |
||
| 166 | 'MK' => _("Macedonia"), |
||
| 167 | 'RS' => _("Serbia"), |
||
| 168 | 'NL' => _("Netherlands"), |
||
| 169 | 'NO' => _("Norway"), |
||
| 170 | 'PL' => _("Poland"), |
||
| 171 | 'PT' => _("Portugal"), |
||
| 172 | 'RO' => _("Romania"), |
||
| 173 | 'SI' => _("Slovenia"), |
||
| 174 | 'ES' => _("Spain"), |
||
| 175 | 'SE' => _("Sweden"), |
||
| 176 | 'SK' => _("Slovakia"), |
||
| 177 | 'CH' => _("Switzerland"), |
||
| 178 | 'TR' => _("Turkey"), |
||
| 179 | 'UK' => _("United Kingdom"), |
||
| 180 | 'TEST' => 'TEST Country', |
||
| 181 | 'AU' => _("Australia"), |
||
| 182 | 'CA' => _("Canada"), |
||
| 183 | 'IL' => _("Israel"), |
||
| 184 | 'JP' => _("Japan"), |
||
| 185 | 'NZ' => _("New Zealand"), |
||
| 186 | 'US' => _("U.S.A."), |
||
| 187 | 'BR' => _("Brazil"), |
||
| 188 | 'CL' => _("Chile"), |
||
| 189 | 'PE' => _("Peru"), |
||
| 190 | 'VE' => _("Venezuela"), |
||
| 191 | 'DEFAULT' => _("Default"), |
||
| 192 | 'AM' => _("Armenia"), |
||
| 193 | 'AZ' => _("Azerbaijan"), |
||
| 194 | 'BY' => _("Belarus"), |
||
| 195 | 'EC' => _("Ecuador"), |
||
| 196 | 'HK' => _("Hong Kong"), |
||
| 197 | 'KE' => _("Kenya"), |
||
| 198 | 'KG' => _("Kyrgyzstan"), |
||
| 199 | 'KR' => _("Korea"), |
||
| 200 | 'KZ' => _("Kazakhstan"), |
||
| 201 | 'MA' => _("Morocco"), |
||
| 202 | 'MD' => _("Moldova"), |
||
| 203 | 'ME' => _("Montenegro"), |
||
| 204 | 'MO' => _("Macau"), |
||
| 205 | 'MT' => _("Malta"), |
||
| 206 | 'RU' => _("Russia"), |
||
| 207 | 'SG' => _("Singapore"), |
||
| 208 | 'TH' => _("Thailand"), |
||
| 209 | 'TW' => _("Taiwan"), |
||
| 210 | 'ZA' => _("South Africa"), |
||
| 211 | 'AF' => 'Afghanistan', |
||
| 212 | 'AL' => 'Albania', |
||
| 213 | 'DZ' => 'Algeria', |
||
| 214 | 'AS' => 'American Samoa', |
||
| 215 | 'AO' => 'Angola', |
||
| 216 | 'AI' => 'Anguilla', |
||
| 217 | 'AQ' => 'Antarctica', |
||
| 218 | 'AG' => 'Antigua And Barbuda', |
||
| 219 | 'AR' => 'Argentina', |
||
| 220 | 'AW' => 'Aruba', |
||
| 221 | 'BS' => 'Bahamas, The', |
||
| 222 | 'BH' => 'Bahrain', |
||
| 223 | 'BD' => 'Bangladesh', |
||
| 224 | 'BB' => 'Barbados', |
||
| 225 | 'BZ' => 'Belize', |
||
| 226 | 'BJ' => 'Benin', |
||
| 227 | 'BM' => 'Bermuda', |
||
| 228 | 'BT' => 'Bhutan', |
||
| 229 | 'BO' => 'Bolivia', |
||
| 230 | 'BA' => 'Bosnia And Herzegovina', |
||
| 231 | 'BW' => 'Botswana', |
||
| 232 | 'BV' => 'Bouvet Island', |
||
| 233 | 'IO' => 'British Indian Ocean Territory', |
||
| 234 | 'BN' => 'Brunei', |
||
| 235 | 'BF' => 'Burkina Faso', |
||
| 236 | 'MM' => 'Burma', |
||
| 237 | 'BI' => 'Burundi', |
||
| 238 | 'KH' => 'Cambodia', |
||
| 239 | 'CM' => 'Cameroon', |
||
| 240 | 'CV' => 'Cape Verde', |
||
| 241 | 'KY' => 'Cayman Islands', |
||
| 242 | 'CF' => 'Central African Republic', |
||
| 243 | 'TD' => 'Chad', |
||
| 244 | 'CN' => 'China', |
||
| 245 | 'CX' => 'Christmas Island', |
||
| 246 | 'CC' => 'Cocos (keeling) Islands', |
||
| 247 | 'CO' => 'Colombia', |
||
| 248 | 'KM' => 'Comoros', |
||
| 249 | 'CG' => 'Congo (brazzaville) ', |
||
| 250 | 'CD' => 'Congo (kinshasa)', |
||
| 251 | 'CK' => 'Cook Islands', |
||
| 252 | 'CR' => 'Costa Rica', |
||
| 253 | 'CI' => 'CÔte D’ivoire', |
||
| 254 | 'CU' => 'Cuba', |
||
| 255 | 'CW' => 'CuraÇao', |
||
| 256 | 'DJ' => 'Djibouti', |
||
| 257 | 'DM' => 'Dominica', |
||
| 258 | 'DO' => 'Dominican Republic', |
||
| 259 | 'EG' => 'Egypt', |
||
| 260 | 'SV' => 'El Salvador', |
||
| 261 | 'GQ' => 'Equatorial Guinea', |
||
| 262 | 'ER' => 'Eritrea', |
||
| 263 | 'ET' => 'Ethiopia', |
||
| 264 | 'FK' => 'Falkland Islands (islas Malvinas)', |
||
| 265 | 'FO' => 'Faroe Islands', |
||
| 266 | 'FJ' => 'Fiji', |
||
| 267 | 'GF' => 'French Guiana', |
||
| 268 | 'PF' => 'French Polynesia', |
||
| 269 | 'TF' => 'French Southern And Antarctic Lands', |
||
| 270 | 'GA' => 'Gabon', |
||
| 271 | 'GM' => 'Gambia, The', |
||
| 272 | 'GE' => 'Georgia', |
||
| 273 | 'GEANT' => 'The GEANT country', |
||
| 274 | 'GH' => 'Ghana', |
||
| 275 | 'GI' => 'Gibraltar', |
||
| 276 | 'GL' => 'Greenland', |
||
| 277 | 'GD' => 'Grenada', |
||
| 278 | 'GP' => 'Guadeloupe', |
||
| 279 | 'GU' => 'Guam', |
||
| 280 | 'GT' => 'Guatemala', |
||
| 281 | 'GG' => 'Guernsey', |
||
| 282 | 'GN' => 'Guinea', |
||
| 283 | 'GW' => 'Guinea-bissau', |
||
| 284 | 'GY' => 'Guyana', |
||
| 285 | 'HT' => 'Haiti', |
||
| 286 | 'HM' => 'Heard Island And Mcdonald Islands', |
||
| 287 | 'HN' => 'Honduras', |
||
| 288 | 'IN' => 'India', |
||
| 289 | 'ID' => 'Indonesia', |
||
| 290 | 'IR' => 'Iran', |
||
| 291 | 'IQ' => 'Iraq', |
||
| 292 | 'IM' => 'Isle Of Man', |
||
| 293 | 'JM' => 'Jamaica', |
||
| 294 | 'JE' => 'Jersey', |
||
| 295 | 'JO' => 'Jordan', |
||
| 296 | 'KI' => 'Kiribati', |
||
| 297 | 'KP' => 'Korea, North', |
||
| 298 | 'KW' => 'Kuwait', |
||
| 299 | 'LA' => 'Laos', |
||
| 300 | 'LB' => 'Lebanon', |
||
| 301 | 'LS' => 'Lesotho', |
||
| 302 | 'LR' => 'Liberia', |
||
| 303 | 'LY' => 'Libya', |
||
| 304 | 'LI' => 'Liechtenstein', |
||
| 305 | 'MG' => 'Madagascar', |
||
| 306 | 'MW' => 'Malawi', |
||
| 307 | 'MY' => 'Malaysia', |
||
| 308 | 'MV' => 'Maldives', |
||
| 309 | 'ML' => 'Mali', |
||
| 310 | 'MH' => 'Marshall Islands', |
||
| 311 | 'MQ' => 'Martinique', |
||
| 312 | 'MR' => 'Mauritania', |
||
| 313 | 'MU' => 'Mauritius', |
||
| 314 | 'YT' => 'Mayotte', |
||
| 315 | 'MX' => 'Mexico', |
||
| 316 | 'FM' => 'Micronesia, Federated States Of', |
||
| 317 | 'MC' => 'Monaco', |
||
| 318 | 'MN' => 'Mongolia', |
||
| 319 | 'MS' => 'Montserrat', |
||
| 320 | 'MZ' => 'Mozambique', |
||
| 321 | 'NA' => 'Namibia', |
||
| 322 | 'NR' => 'Nauru', |
||
| 323 | 'NP' => 'Nepal', |
||
| 324 | 'NC' => 'New Caledonia', |
||
| 325 | 'NI' => 'Nicaragua', |
||
| 326 | 'NE' => 'Niger', |
||
| 327 | 'NG' => 'Nigeria', |
||
| 328 | 'NU' => 'Niue', |
||
| 329 | 'NF' => 'Norfolk Island', |
||
| 330 | 'MP' => 'Northern Mariana Islands', |
||
| 331 | 'OM' => 'Oman', |
||
| 332 | 'PK' => 'Pakistan', |
||
| 333 | 'PW' => 'Palau', |
||
| 334 | 'PA' => 'Panama', |
||
| 335 | 'PG' => 'Papua New Guinea', |
||
| 336 | 'PY' => 'Paraguay', |
||
| 337 | 'PH' => 'Philippines', |
||
| 338 | 'PN' => 'Pitcairn Islands', |
||
| 339 | 'PR' => 'Puerto Rico', |
||
| 340 | 'QA' => 'Qatar', |
||
| 341 | 'RE' => 'Reunion', |
||
| 342 | 'RW' => 'Rwanda', |
||
| 343 | 'BL' => 'Saint Barthelemy', |
||
| 344 | 'SH' => 'Saint Helena, Ascension, And Tristan Da Cunha', |
||
| 345 | 'KN' => 'Saint Kitts And Nevis', |
||
| 346 | 'LC' => 'Saint Lucia', |
||
| 347 | 'MF' => 'Saint Martin', |
||
| 348 | 'PM' => 'Saint Pierre And Miquelon', |
||
| 349 | 'VC' => 'Saint Vincent And The Grenadines', |
||
| 350 | 'WS' => 'Samoa', |
||
| 351 | 'SM' => 'San Marino', |
||
| 352 | 'ST' => 'Sao Tome And Principe', |
||
| 353 | 'SA' => 'Saudi Arabia', |
||
| 354 | 'SN' => 'Senegal', |
||
| 355 | 'SC' => 'Seychelles', |
||
| 356 | 'SL' => 'Sierra Leone', |
||
| 357 | 'SX' => 'Sint Maarten', |
||
| 358 | 'SB' => 'Solomon Islands', |
||
| 359 | 'SO' => 'Somalia', |
||
| 360 | 'GS' => 'South Georgia And South Sandwich Islands', |
||
| 361 | 'SS' => 'South Sudan', |
||
| 362 | 'LK' => 'Sri Lanka', |
||
| 363 | 'SD' => 'Sudan', |
||
| 364 | 'SR' => 'Suriname', |
||
| 365 | 'SZ' => 'Swaziland', |
||
| 366 | 'SY' => 'Syria', |
||
| 367 | 'TJ' => 'Tajikistan', |
||
| 368 | 'TZ' => 'Tanzania', |
||
| 369 | 'TL' => 'Timor-leste', |
||
| 370 | 'TG' => 'Togo', |
||
| 371 | 'TK' => 'Tokelau', |
||
| 372 | 'TO' => 'Tonga', |
||
| 373 | 'TT' => 'Trinidad And Tobago', |
||
| 374 | 'TN' => 'Tunisia', |
||
| 375 | 'TM' => 'Turkmenistan', |
||
| 376 | 'TC' => 'Turks And Caicos Islands', |
||
| 377 | 'TV' => 'Tuvalu', |
||
| 378 | 'UG' => 'Uganda', |
||
| 379 | 'UA' => 'Ukraine', |
||
| 380 | 'AE' => 'United Arab Emirates', |
||
| 381 | 'GB' => 'United Kingdom', |
||
| 382 | 'UY' => 'Uruguay', |
||
| 383 | 'UZ' => 'Uzbekistan', |
||
| 384 | 'VU' => 'Vanuatu', |
||
| 385 | 'VA' => 'Vatican City', |
||
| 386 | 'VN' => 'Vietnam', |
||
| 387 | 'VG' => 'Virgin Islands, British', |
||
| 388 | 'VI' => 'Virgin Islands, United States ', |
||
| 389 | 'WF' => 'Wallis And Futuna', |
||
| 390 | 'EH' => 'Western Sahara', |
||
| 391 | 'YE' => 'Yemen', |
||
| 392 | 'ZM' => 'Zambia', |
||
| 393 | 'ZW' => 'Zimbabwe', |
||
| 394 | ]; |
||
| 395 | |||
| 396 | $this->languageInstance->setTextDomain($oldlocale); |
||
| 397 | } |
||
| 592 |