Code Duplication    Length = 22-23 lines in 3 locations

devices/ms/Device_Vista7.php 1 location

@@ 483-504 (lines=22) @@
480
        fclose($fileHandle);
481
    }
482
483
    private function writeProfilesNSH($wlanProfiles, $caArray, $wired = 0) {
484
        $this->loggerInstance->debug(4, "writeProfilesNSH");
485
        $this->loggerInstance->debug(4, $wlanProfiles);
486
        $contentWlan = '';
487
        foreach ($wlanProfiles as $wlanProfile) {
488
            $contentWlan .= "!insertmacro define_wlan_profile $wlanProfile\n";
489
        }
490
491
        $fileHandleProfiles = fopen('profiles.nsh', 'w');
492
        fwrite($fileHandleProfiles, $contentWlan);
493
        fclose($fileHandleProfiles);
494
495
        $contentCerts = '';
496
        $fileHandleCerts = fopen('certs.nsh', 'w');
497
        if ($caArray) {
498
            foreach ($caArray as $certAuthority) {
499
                $store = $certAuthority['root'] ? "root" : "ca";
500
                $contentCerts .= '!insertmacro install_ca_cert "' . $certAuthority['file'] . '" "' . $certAuthority['sha1'] . '" "' . $store . "\"\n";
501
            }
502
            fwrite($fileHandleCerts, $contentCerts);
503
        }
504
        fclose($fileHandleCerts);
505
    }
506
507
    private function copyFiles($eap) {

devices/ms/Device_W8.php 1 location

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

devices/ms/Device_W10.php 1 location

@@ 507-529 (lines=23) @@
504
        fclose($fileHandle);
505
    }
506
507
    private function writeProfilesNSH($wlanProfiles, $caArray, $wired = 0) {
508
        $this->loggerInstance->debug(4, "writeProfilesNSH");
509
        $this->loggerInstance->debug(4, $wlanProfiles);
510
        $fcontentsProfile = '';
511
        foreach ($wlanProfiles as $wlanProfile) {
512
            $fcontentsProfile .= "!insertmacro define_wlan_profile $wlanProfile\n";
513
        }
514
515
        $fileHandleProfiles = fopen('profiles.nsh', 'w');
516
        fwrite($fileHandleProfiles, $fcontentsProfile);
517
        fclose($fileHandleProfiles);
518
519
        $fcontentsCerts = '';
520
        $fileHandleCerts = fopen('certs.nsh', 'w');
521
        if ($caArray) {
522
            foreach ($caArray as $certAuthority) {
523
                $store = $certAuthority['root'] ? "root" : "ca";
524
                $fcontentsCerts .= '!insertmacro install_ca_cert "' . $certAuthority['file'] . '" "' . $certAuthority['sha1'] . '" "' . $store . "\"\n";
525
            }
526
            fwrite($fileHandleCerts, $fcontentsCerts);
527
        }
528
        fclose($fileHandleCerts);
529
    }
530
531
//private function write
532