| Conditions | 1 |
| Paths | 1 |
| Total Lines | 383 |
| Code Lines | 245 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 101 | public static function listDevices() { |
||
| 102 | return [ |
||
| 103 | 'w10'=>[ |
||
| 104 | 'group' => "microsoft", |
||
| 105 | 'display'=>_("MS Windows 10"), |
||
| 106 | 'match'=>'Windows NT 10', |
||
| 107 | 'directory'=>'ms', |
||
| 108 | 'module'=>'W10', |
||
| 109 | 'signer'=>'ms_windows_sign', |
||
| 110 | 'options'=>[ |
||
| 111 | 'sign'=>1, |
||
| 112 | 'device_id'=>'W10', |
||
| 113 | 'mime'=>'application/x-dosexec', |
||
| 114 | ], |
||
| 115 | ], |
||
| 116 | |||
| 117 | 'w8'=>[ |
||
| 118 | 'group' => "microsoft", |
||
| 119 | 'display'=>_("MS Windows 8, 8.1"), |
||
| 120 | 'match'=>'Windows NT 6[._][23]', |
||
| 121 | 'directory'=>'ms', |
||
| 122 | 'module'=>'W8', |
||
| 123 | 'signer'=>'ms_windows_sign', |
||
| 124 | 'options'=>[ |
||
| 125 | 'sign'=>1, |
||
| 126 | 'device_id'=>'W8', |
||
| 127 | 'mime'=>'application/x-dosexec', |
||
| 128 | ], |
||
| 129 | ], |
||
| 130 | |||
| 131 | 'w7'=>[ |
||
| 132 | 'group' => "microsoft", |
||
| 133 | 'display'=>_("MS Windows 7"), |
||
| 134 | 'match'=>'Windows NT 6[._]1', |
||
| 135 | 'directory'=>'ms', |
||
| 136 | 'module'=>'Vista7', |
||
| 137 | 'signer'=>'ms_windows_sign', |
||
| 138 | 'options'=>[ |
||
| 139 | 'sign'=>1, |
||
| 140 | 'device_id'=>'W7', |
||
| 141 | 'mime'=>'application/x-dosexec', |
||
| 142 | ], |
||
| 143 | ], |
||
| 144 | |||
| 145 | 'vista'=>[ |
||
| 146 | 'group' => "microsoft", |
||
| 147 | 'display'=>_("MS Windows Vista"), |
||
| 148 | 'match'=>'Windows NT 6[._]0', |
||
| 149 | 'directory'=>'ms', |
||
| 150 | 'module'=>'Vista7', |
||
| 151 | 'signer'=>'ms_windows_sign', |
||
| 152 | 'options'=>[ |
||
| 153 | 'sign'=>1, |
||
| 154 | 'device_id'=>'Vista', |
||
| 155 | 'mime'=>'application/x-dosexec', |
||
| 156 | ], |
||
| 157 | ], |
||
| 158 | |||
| 159 | 'win-rt'=>[ |
||
| 160 | 'group' => "microsoft", |
||
| 161 | 'display'=>_("Windows RT"), |
||
| 162 | 'directory'=>'redirect_dev', |
||
| 163 | 'module'=>'RedirectDev', |
||
| 164 | 'options'=>[ |
||
| 165 | 'hidden'=>0, |
||
| 166 | 'redirect'=>1, |
||
| 167 | ], |
||
| 168 | ], |
||
| 169 | |||
| 170 | |||
| 171 | 'apple_hi_sierra'=>array( |
||
| 172 | 'group' => "apple", |
||
| 173 | 'display'=>_("Apple macOS High Sierra"), |
||
| 174 | 'match'=>'Mac OS X 10[._]13', |
||
| 175 | 'directory'=>'apple_mobileconfig', |
||
| 176 | 'module'=>'mobileconfig_os_x', |
||
| 177 | 'signer'=>'mobileconfig_sign', |
||
| 178 | 'options'=>array( |
||
| 179 | 'sign'=>1, |
||
| 180 | 'device_id'=>'OS_X', |
||
| 181 | 'mime'=>'application/x-apple-aspen-config', |
||
| 182 | ), |
||
| 183 | ), |
||
| 184 | |||
| 185 | |||
| 186 | 'apple_sierra'=>array( |
||
| 187 | 'group' => "apple", |
||
| 188 | 'display'=>_("Apple macOS Sierra"), |
||
| 189 | 'match'=>'Mac OS X 10[._]12', |
||
| 190 | 'directory'=>'apple_mobileconfig', |
||
| 191 | 'module'=>'mobileconfig_os_x', |
||
| 192 | 'signer'=>'mobileconfig_sign', |
||
| 193 | 'options'=>array( |
||
| 194 | 'sign'=>1, |
||
| 195 | 'device_id'=>'OS_X', |
||
| 196 | 'mime'=>'application/x-apple-aspen-config', |
||
| 197 | ), |
||
| 198 | ), |
||
| 199 | |||
| 200 | |||
| 201 | 'apple_el_cap'=>[ |
||
| 202 | 'group' => "apple", |
||
| 203 | 'display'=>_("Apple OS X El Capitan"), |
||
| 204 | 'match'=>'Mac OS X 10[._]11', |
||
| 205 | 'directory'=>'apple_mobileconfig', |
||
| 206 | 'module'=>'mobileconfig_os_x', |
||
| 207 | 'signer'=>'mobileconfig_sign', |
||
| 208 | 'options'=>array( |
||
| 209 | 'sign'=>1, |
||
| 210 | 'device_id'=>'OS_X', |
||
| 211 | 'mime'=>'application/x-apple-aspen-config', |
||
| 212 | ), |
||
| 213 | ], |
||
| 214 | |||
| 215 | 'apple_yos'=>[ |
||
| 216 | 'group' => "apple", |
||
| 217 | 'display'=>_("Apple OS X Yosemite"), |
||
| 218 | 'match'=>'Mac OS X 10[._]10', |
||
| 219 | 'directory'=>'apple_mobileconfig', |
||
| 220 | 'module'=>'mobileconfig_os_x', |
||
| 221 | 'signer'=>'mobileconfig_sign', |
||
| 222 | 'options'=>[ |
||
| 223 | 'sign'=>1, |
||
| 224 | 'device_id'=>'OS_X', |
||
| 225 | 'mime'=>'application/x-apple-aspen-config', |
||
| 226 | ], |
||
| 227 | ], |
||
| 228 | |||
| 229 | 'apple_mav'=>[ |
||
| 230 | 'group' => "apple", |
||
| 231 | 'display'=>_("Apple OS X Mavericks"), |
||
| 232 | 'match'=>'Mac OS X 10[._]9', |
||
| 233 | 'directory'=>'apple_mobileconfig', |
||
| 234 | 'module'=>'mobileconfig_os_x', |
||
| 235 | 'signer'=>'mobileconfig_sign', |
||
| 236 | 'options'=>[ |
||
| 237 | 'sign'=>1, |
||
| 238 | 'device_id'=>'OS_X', |
||
| 239 | 'mime'=>'application/x-apple-aspen-config', |
||
| 240 | ], |
||
| 241 | ], |
||
| 242 | |||
| 243 | 'apple_m_lion'=>[ |
||
| 244 | 'group' => "apple", |
||
| 245 | 'display'=>_("Apple OS X Mountain Lion"), |
||
| 246 | 'match'=>'Mac OS X 10[._]8', |
||
| 247 | 'directory'=>'apple_mobileconfig', |
||
| 248 | 'module'=>'mobileconfig_os_x', |
||
| 249 | 'signer'=>'mobileconfig_sign', |
||
| 250 | 'options'=>[ |
||
| 251 | 'sign'=>1, |
||
| 252 | 'device_id'=>'OS_X', |
||
| 253 | 'mime'=>'application/x-apple-aspen-config', |
||
| 254 | ], |
||
| 255 | ], |
||
| 256 | |||
| 257 | 'apple_lion'=>[ |
||
| 258 | 'group' => "apple", |
||
| 259 | 'display'=>_("Apple OS X Lion"), |
||
| 260 | 'match'=>'Mac OS X 10[._]7', |
||
| 261 | 'directory'=>'apple_mobileconfig', |
||
| 262 | 'module'=>'mobileconfig_os_x', |
||
| 263 | 'signer'=>'mobileconfig_sign', |
||
| 264 | 'options'=>[ |
||
| 265 | 'sign'=>1, |
||
| 266 | 'device_id'=>'OS_X', |
||
| 267 | 'mime'=>'application/x-apple-aspen-config', |
||
| 268 | ], |
||
| 269 | ], |
||
| 270 | |||
| 271 | 'mobileconfig'=>[ |
||
| 272 | 'group' => "apple", |
||
| 273 | 'display'=>_("Apple iOS mobile devices"), |
||
| 274 | 'match'=>'(iPad|iPhone|iPod);.*OS ([7-9]|1[0-5])_', |
||
| 275 | 'directory'=>'apple_mobileconfig', |
||
| 276 | 'module'=>'mobileconfig_ios', |
||
| 277 | 'signer'=>'mobileconfig_sign', |
||
| 278 | 'options'=>[ |
||
| 279 | 'sign'=>1, |
||
| 280 | 'device_id'=>'iOS', |
||
| 281 | 'mime'=>'application/x-apple-aspen-config', |
||
| 282 | ], |
||
| 283 | ], |
||
| 284 | |||
| 285 | 'mobileconfig-56'=>[ |
||
| 286 | 'group' => "apple", |
||
| 287 | 'display'=>_("Apple iOS mobile devices (iOS 5 and 6)"), |
||
| 288 | 'match'=>'(iPad|iPhone|iPod);.*OS [56]_', |
||
| 289 | 'directory'=>'apple_mobileconfig', |
||
| 290 | 'module'=>'mobileconfig_ios_56', |
||
| 291 | 'signer'=>'mobileconfig_sign', |
||
| 292 | 'options'=>[ |
||
| 293 | 'sign'=>1, |
||
| 294 | 'device_id'=>'iOS', |
||
| 295 | 'mime'=>'application/x-apple-aspen-config', |
||
| 296 | ], |
||
| 297 | ], |
||
| 298 | |||
| 299 | |||
| 300 | 'linux'=>[ |
||
| 301 | 'group' => "linux", |
||
| 302 | 'display'=>_("Linux"), |
||
| 303 | 'match'=>'Linux(?!.*Android)', |
||
| 304 | 'directory'=>'linux', |
||
| 305 | 'module' => 'Linux', |
||
| 306 | 'options'=>[ |
||
| 307 | 'mime'=>'application/x-sh', |
||
| 308 | ], |
||
| 309 | ], |
||
| 310 | |||
| 311 | 'chromeos'=>[ |
||
| 312 | 'group' => "chrome", |
||
| 313 | 'display'=>_("Chrome OS"), |
||
| 314 | 'match'=>'CrOS', |
||
| 315 | 'directory'=>'chromebook', |
||
| 316 | 'module'=>'chromebook', |
||
| 317 | 'options'=>[ |
||
| 318 | 'mime'=>'application/x-onc', |
||
| 319 | 'message'=>sprintf(_("After downloading the file, open the Chrome browser and browse to this URL: <a href='chrome://net-internals/#chromeos'>chrome://net-internals/#chromeos</a>. Then, use the 'Import ONC file' button. The import is silent; the new network definitions will be added to the preferred networks.")), |
||
| 320 | ], |
||
| 321 | ], |
||
| 322 | |||
| 323 | 'android_marshmallow'=>[ |
||
| 324 | 'group' => "android", |
||
| 325 | 'display'=>_("Android 6.0 Marshmallow"), |
||
| 326 | 'match'=>'Android 6\.[0-9]', |
||
| 327 | 'directory'=>'xml', |
||
| 328 | 'module'=>'Lollipop', |
||
| 329 | 'options'=>[ |
||
| 330 | 'mime'=>'application/eap-config', |
||
| 331 | 'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."), |
||
| 332 | "eduroamCAT", |
||
| 333 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
||
| 334 | "<a target='_blank' href='unbeknownst'>Amazon Appstore</a>", |
||
| 335 | "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
||
| 336 | ], |
||
| 337 | ], |
||
| 338 | |||
| 339 | 'android_lollipop'=>[ |
||
| 340 | 'group' => "android", |
||
| 341 | 'display'=>_("Android 5.0 Lollipop"), |
||
| 342 | 'match'=>'Android 5\.[0-9]', |
||
| 343 | 'directory'=>'xml', |
||
| 344 | 'module'=>'Lollipop', |
||
| 345 | 'options'=>[ |
||
| 346 | 'mime'=>'application/eap-config', |
||
| 347 | 'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."), |
||
| 348 | "eduroamCAT", |
||
| 349 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
||
| 350 | "<a target='_blank' href='unbeknownst'>Amazon Appstore</a>", |
||
| 351 | "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
||
| 352 | ], |
||
| 353 | ], |
||
| 354 | |||
| 355 | 'android_kitkat'=>[ |
||
| 356 | 'group' => "android", |
||
| 357 | 'display'=>_("Android 4.4 KitKat"), |
||
| 358 | 'match'=>'Android 4\.[4-9]', |
||
| 359 | 'directory'=>'xml', |
||
| 360 | 'module'=>'KitKat', |
||
| 361 | 'options'=>[ |
||
| 362 | 'mime'=>'application/eap-config', |
||
| 363 | 'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."), |
||
| 364 | "eduroamCAT", |
||
| 365 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
||
| 366 | "<a target='_blank' href='unbeknownst'>Amazon Appstore</a>", |
||
| 367 | "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
||
| 368 | ], |
||
| 369 | ], |
||
| 370 | |||
| 371 | |||
| 372 | 'android_43'=>[ |
||
| 373 | 'group' => "android", |
||
| 374 | 'display'=>_("Android 4.3"), |
||
| 375 | 'match'=>'Android 4\.3', |
||
| 376 | 'directory'=>'xml', |
||
| 377 | 'module'=>'KitKat', |
||
| 378 | 'options'=>[ |
||
| 379 | 'mime'=>'application/eap-config', |
||
| 380 | 'message'=>sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from %s, %s and %s, and will use the configuration file downloaded from CAT to create all necessary settings."), |
||
| 381 | "eduroamCAT", |
||
| 382 | "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>", |
||
| 383 | "<a target='_blank' href='unbeknownst'>Amazon Appstore</a>", |
||
| 384 | "<a target='_blank' href='eduroamCAT-stable.apk'>"._("as local download")."</a>"), |
||
| 385 | ], |
||
| 386 | ], |
||
| 387 | |||
| 388 | 'android_legacy'=>[ |
||
| 389 | 'group' => "android", |
||
| 390 | 'display'=>_("Android"), |
||
| 391 | 'match'=>'Android', |
||
| 392 | 'directory'=>'redirect_dev', |
||
| 393 | 'module'=>'RedirectDev', |
||
| 394 | 'options'=>[ |
||
| 395 | 'redirect'=>1, |
||
| 396 | ], |
||
| 397 | ], |
||
| 398 | |||
| 399 | 'eap-config'=>[ |
||
| 400 | 'group' => "eap-config", |
||
| 401 | 'display'=>_("EAP config"), |
||
| 402 | 'directory'=>'xml', |
||
| 403 | 'module'=>'XML_ALL', |
||
| 404 | 'options'=>[ |
||
| 405 | 'mime'=>'application/eap-config', |
||
| 406 | 'message'=>sprintf(_("This option provides a generic EAP config XML file, which can be consumed by dedicated applications like eduroamCAT for Android and Linux platforms. This is still an experimental feature.")), |
||
| 407 | ], |
||
| 408 | ], |
||
| 409 | |||
| 410 | 'test'=>[ |
||
| 411 | 'group' => "other", |
||
| 412 | 'display'=>_("Test"), |
||
| 413 | 'directory'=>'test_module', |
||
| 414 | 'module'=>'TestModule', |
||
| 415 | 'options'=>[ |
||
| 416 | 'hidden'=>1, |
||
| 417 | ], |
||
| 418 | ], |
||
| 419 | |||
| 420 | |||
| 421 | /* |
||
| 422 | |||
| 423 | 'xml-ttls-pap'=>array( |
||
| 424 | 'group' => "generic", |
||
| 425 | 'display'=>_("Generic profile TTLS-PAP"), |
||
| 426 | 'directory'=>'xml', |
||
| 427 | 'module'=>'XML_TTLS_PAP', |
||
| 428 | 'options'=>array( |
||
| 429 | 'mime'=>'application/eap-config', |
||
| 430 | ), |
||
| 431 | ), |
||
| 432 | |||
| 433 | 'xml-ttls-mschap2'=>array( |
||
| 434 | 'group' => "generic", |
||
| 435 | 'display'=>_("Generic profile TTLS-MSCHAPv2"), |
||
| 436 | 'directory'=>'xml', |
||
| 437 | 'module'=>'XML_TTLS_MSCHAP2', |
||
| 438 | 'options'=>array( |
||
| 439 | 'mime'=>'application/eap-config', |
||
| 440 | ), |
||
| 441 | ), |
||
| 442 | |||
| 443 | 'xml-peap'=>array( |
||
| 444 | 'group' => "generic", |
||
| 445 | 'display'=>_("Generic profile PEAP"), |
||
| 446 | 'directory'=>'xml', |
||
| 447 | 'module'=>'XML_PEAP', |
||
| 448 | 'options'=>array( |
||
| 449 | 'mime'=>'application/eap-config', |
||
| 450 | ), |
||
| 451 | ), |
||
| 452 | |||
| 453 | 'xml-tls'=>array( |
||
| 454 | 'group' => "generic", |
||
| 455 | 'display'=>_("Generic profile TLS"), |
||
| 456 | 'directory'=>'xml', |
||
| 457 | 'module'=>'XML_TLS', |
||
| 458 | 'options'=>array( |
||
| 459 | 'mime'=>'application/eap-config', |
||
| 460 | ), |
||
| 461 | ), |
||
| 462 | |||
| 463 | 'xml-pwd'=>array( |
||
| 464 | 'group' => "generic", |
||
| 465 | 'display'=>_("Generic profile PWD"), |
||
| 466 | 'directory'=>'xml', |
||
| 467 | 'module'=>'XML_PWD', |
||
| 468 | 'options'=>array( |
||
| 469 | 'mime'=>'application/eap-config', |
||
| 470 | ), |
||
| 471 | ), |
||
| 472 | 'xml-all'=>array( |
||
| 473 | 'group' => "generic", |
||
| 474 | 'display'=>_("Generic profile ALL EAPs"), |
||
| 475 | 'directory'=>'xml', |
||
| 476 | 'module'=>'XML_ALL', |
||
| 477 | 'options'=>array( |
||
| 478 | 'mime'=>'application/eap-config', |
||
| 479 | ), |
||
| 480 | ), |
||
| 481 | */ |
||
| 482 | ]; |
||
| 483 | } |
||
| 484 | } |
||
| 485 |