Code Duplication    Length = 24-24 lines in 3 locations

devices/ms/Device_Vista7.php 1 location

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

devices/ms/Device_W10.php 1 location

@@ 466-489 (lines=24) @@
463
        file_put_contents('main.nsh', $fcontents);
464
    }
465
466
    private function writeProfilesNSH($wlanProfiles, $caArray, $wired = 0) {
467
        $this->loggerInstance->debug(4, "writeProfilesNSH");
468
        $this->loggerInstance->debug(4, $wlanProfiles);
469
        $fcontentsProfile = '';
470
        foreach ($wlanProfiles as $wlanProfile) {
471
            $fcontentsProfile .= "!insertmacro define_wlan_profile $wlanProfile\n";
472
        }
473
474
        file_put_contents('profiles.nsh', $fcontentsProfile);        
475
476
        $fcontentsCerts = '';
477
        $fileHandleCerts = fopen('certs.nsh', 'w');
478
        if ($fileHandleCerts === FALSE) {
479
            throw new Exception("Unable to open new file certs.nsh to write CAs.");
480
        }
481
        if ($caArray) {
482
            foreach ($caArray as $certAuthority) {
483
                $store = $certAuthority['root'] ? "root" : "ca";
484
                $fcontentsCerts .= '!insertmacro install_ca_cert "' . $certAuthority['file'] . '" "' . $certAuthority['sha1'] . '" "' . $store . "\"\n";
485
            }
486
            fwrite($fileHandleCerts, $fcontentsCerts);
487
        }
488
        fclose($fileHandleCerts);
489
    }
490
491
//private function write
492

devices/ms/Device_W8.php 1 location

@@ 401-424 (lines=24) @@
398
        file_put_contents('main.nsh', $fcontents);
399
    }
400
401
    private function writeProfilesNSH($wlanProfiles, $caArray, $wired = 0) {
402
        $this->loggerInstance->debug(4, "writeProfilesNSH");
403
        $this->loggerInstance->debug(4, $wlanProfiles);
404
        $fcontentsProfile = '';
405
        foreach ($wlanProfiles as $wlanProfile) {
406
            $fcontentsProfile .= "!insertmacro define_wlan_profile $wlanProfile\n";
407
        }
408
409
        file_put_contents('profiles.nsh', $fcontentsProfile);
410
411
        $fcontentsCerts = '';
412
        $fileHandleCerts = fopen('certs.nsh', 'w');
413
        if ($fileHandleCerts === FALSE) {
414
            throw new Exception("Unable to open new certs.nsh file for writing CAs.");
415
        }
416
        if ($caArray) {
417
            foreach ($caArray as $certAuthority) {
418
                $store = $certAuthority['root'] ? "root" : "ca";
419
                $fcontentsCerts .= '!insertmacro install_ca_cert "' . $certAuthority['file'] . '" "' . $certAuthority['sha1'] . '" "' . $store . "\"\n";
420
            }
421
            fwrite($fileHandleCerts, $fcontentsCerts);
422
        }
423
        fclose($fileHandleCerts);
424
    }
425
426
//private function write
427