Code Duplication    Length = 13-14 lines in 2 locations

phpsysinfo/includes/os/class.HPUX.inc.php 1 location

@@ 202-214 (lines=13) @@
199
        $get_type = false;
200
        if (CommonFunctions::rfts('/proc/scsi/scsi', $bufr, 0, 4096, PSI_DEBUG)) {
201
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
202
            foreach ($bufe as $buf) {
203
                if (preg_match('/Vendor: (.*) Model: (.*) Rev: (.*)/i', $buf, $dev)) {
204
                    $get_type = true;
205
                    continue;
206
                }
207
                if ($get_type) {
208
                    preg_match('/Type:\s+(\S+)/i', $buf, $dev_type);
209
                    $dev = new HWDevice();
210
                    $dev->setName($dev[1].' '.$dev[2].' ('.$dev_type[1].')');
211
                    $this->sys->setScsiDevices($dev);
212
                    $get_type = false;
213
                }
214
            }
215
        }
216
    }
217

phpsysinfo/includes/os/class.Linux.inc.php 1 location

@@ 486-499 (lines=14) @@
483
        $device = null;
484
        if (CommonFunctions::executeProgram('lsscsi', '-c', $bufr, PSI_DEBUG) || CommonFunctions::rfts('/proc/scsi/scsi', $bufr, 0, 4096, PSI_DEBUG)) {
485
            $bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
486
            foreach ($bufe as $buf) {
487
                if (preg_match('/Vendor: (.*) Model: (.*) Rev: (.*)/i', $buf, $devices)) {
488
                    $get_type = true;
489
                    $device = $devices;
490
                    continue;
491
                }
492
                if ($get_type) {
493
                    preg_match('/Type:\s+(\S+)/i', $buf, $dev_type);
494
                    $dev = new HWDevice();
495
                    $dev->setName($device[1].' '.$device[2].' ('.$dev_type[1].')');
496
                    $this->sys->setScsiDevices($dev);
497
                    $get_type = false;
498
                }
499
            }
500
        }
501
    }
502