Code Duplication    Length = 22-23 lines in 3 locations

devices/ms/Device_W10.php 1 location

@@ 472-494 (lines=23) @@
469
        fclose($fileHandle);
470
    }
471
472
    private function writeProfilesNSH($wlanProfiles, $caArray, $wired = 0) {
473
        $this->loggerInstance->debug(4, "writeProfilesNSH");
474
        $this->loggerInstance->debug(4, $wlanProfiles);
475
        $fcontentsProfile = '';
476
        foreach ($wlanProfiles as $wlanProfile) {
477
            $fcontentsProfile .= "!insertmacro define_wlan_profile $wlanProfile\n";
478
        }
479
480
        $fileHandleProfiles = fopen('profiles.nsh', 'w');
481
        fwrite($fileHandleProfiles, $fcontentsProfile);
482
        fclose($fileHandleProfiles);
483
484
        $fcontentsCerts = '';
485
        $fileHandleCerts = fopen('certs.nsh', 'w');
486
        if ($caArray) {
487
            foreach ($caArray as $certAuthority) {
488
                $store = $certAuthority['root'] ? "root" : "ca";
489
                $fcontentsCerts .= '!insertmacro install_ca_cert "' . $certAuthority['file'] . '" "' . $certAuthority['sha1'] . '" "' . $store . "\"\n";
490
            }
491
            fwrite($fileHandleCerts, $fcontentsCerts);
492
        }
493
        fclose($fileHandleCerts);
494
    }
495
496
//private function write
497

devices/ms/Device_W8.php 1 location

@@ 407-428 (lines=22) @@
404
        fclose($fileHandle);
405
    }
406
407
    private function writeProfilesNSH($wlanProfiles, $caArray, $wired = 0) {
408
        $this->loggerInstance->debug(4, "writeProfilesNSH");
409
        $this->loggerInstance->debug(4, $wlanProfiles);
410
        $fcontentsProfile = '';
411
        foreach ($wlanProfiles as $wlanProfile) {
412
            $fcontentsProfile .= "!insertmacro define_wlan_profile $wlanProfile\n";
413
        }
414
415
        $fileHandleProfiles = fopen('profiles.nsh', 'w');
416
        fwrite($fileHandleProfiles, $fcontentsProfile);
417
        fclose($fileHandleProfiles);
418
419
        $fcontentsCerts = '';
420
        $fileHandleCerts = fopen('certs.nsh', 'w');
421
        if ($caArray) {
422
            foreach ($caArray as $certAuthority) {
423
                $store = $certAuthority['root'] ? "root" : "ca";
424
                $fcontentsCerts .= '!insertmacro install_ca_cert "' . $certAuthority['file'] . '" "' . $certAuthority['sha1'] . '" "' . $store . "\"\n";
425
            }
426
            fwrite($fileHandleCerts, $fcontentsCerts);
427
        }
428
        fclose($fileHandleCerts);
429
    }
430
431
//private function write

devices/ms/Device_Vista7.php 1 location

@@ 446-467 (lines=22) @@
443
        fclose($fileHandle);
444
    }
445
446
    private function writeProfilesNSH($wlanProfiles, $caArray, $wired = 0) {
447
        $this->loggerInstance->debug(4, "writeProfilesNSH");
448
        $this->loggerInstance->debug(4, $wlanProfiles);
449
        $contentWlan = '';
450
        foreach ($wlanProfiles as $wlanProfile) {
451
            $contentWlan .= "!insertmacro define_wlan_profile $wlanProfile\n";
452
        }
453
454
        $fileHandleProfiles = fopen('profiles.nsh', 'w');
455
        fwrite($fileHandleProfiles, $contentWlan);
456
        fclose($fileHandleProfiles);
457
458
        $contentCerts = '';
459
        $fileHandleCerts = fopen('certs.nsh', 'w');
460
        if ($caArray) {
461
            foreach ($caArray as $certAuthority) {
462
                $store = $certAuthority['root'] ? "root" : "ca";
463
                $contentCerts .= '!insertmacro install_ca_cert "' . $certAuthority['file'] . '" "' . $certAuthority['sha1'] . '" "' . $store . "\"\n";
464
            }
465
            fwrite($fileHandleCerts, $contentCerts);
466
        }
467
        fclose($fileHandleCerts);
468
    }
469
470
    private function copyFiles($eap) {