Code Duplication    Length = 14-16 lines in 2 locations

phpsysinfo/includes/os/class.Linux.inc.php 2 locations

@@ 699-714 (lines=16) @@
696
                        $dev->setDrops($ar_buf2[3]+$ar_buf2[6]);
697
                    }
698
                    $was = true;
699
                    if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
700
                        if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/speed', $buf, 1, 4096, false) && (trim($buf)!="")) {
701
                            $speed = trim($buf);
702
                            if ($speed > 1000) {
703
                                $speed = $speed/1000;
704
                                $unit = "G";
705
                            } else {
706
                                $unit = "M";
707
                            }
708
                            if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/duplex', $buf, 1, 4096, false) && (trim($buf)!="")) {
709
                                $speedinfo = $speed.$unit.'b/s '.strtolower(trim($buf));
710
                            } else {
711
                                $speedinfo = $speed.$unit.'b/s';
712
                            }
713
                        }
714
                    }
715
                } else {
716
                    if ($was) {
717
                        if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
@@ 765-778 (lines=14) @@
762
                    $dev->setName($ar_buf[1]);
763
                    $was = true;
764
                    if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
765
                        if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/speed', $buf, 1, 4096, false) && (trim($buf)!="")) {
766
                            $speed = trim($buf);
767
                            if ($speed > 1000) {
768
                                $speed = $speed/1000;
769
                                $unit = "G";
770
                            } else {
771
                                $unit = "M";
772
                            }
773
                            if (CommonFunctions::rfts('/sys/class/net/'.$ar_buf[1].'/duplex', $buf, 1, 4096, false) && (trim($buf)!="")) {
774
                                $speedinfo = $speed.$unit.'b/s '.strtolower(trim($buf));
775
                            } else {
776
                                $speedinfo = $speed.$unit.'b/s';
777
                            }
778
                        }
779
                        if (preg_match('/^'.$ar_buf[1].'\s+Link\sencap:Ethernet\s+HWaddr\s(\S+)/i', $line, $ar_buf2))
780
                            $macaddr = preg_replace('/:/', '-', strtoupper($ar_buf2[1]));
781
                        elseif (preg_match('/^'.$ar_buf[1].':\s+ip\s+(\S+)\s+mask/i', $line, $ar_buf2))