Code Duplication    Length = 13-16 lines in 3 locations

phpsysinfo/includes/mb/class.mbmon.inc.php 3 locations

@@ 74-89 (lines=16) @@
71
     *
72
     * @return void
73
     */
74
    private function _temperature()
75
    {
76
        foreach ($this->_lines as $line) {
77
            if (preg_match('/^(TEMP\d*)\s*:\s*(.*)$/D', $line, $data)) {
78
                if ($data[2] <> '0') {
79
                    $dev = new SensorDevice();
80
                    $dev->setName($data[1]);
81
//                    $dev->setMax(70);
82
                    if ($data[2] < 250) {
83
                        $dev->setValue($data[2]);
84
                    }
85
                    $this->mbinfo->setMbTemp($dev);
86
                }
87
            }
88
        }
89
    }
90
91
    /**
92
     * get fan information
@@ 96-109 (lines=14) @@
93
     *
94
     * @return void
95
     */
96
    private function _fans()
97
    {
98
        foreach ($this->_lines as $line) {
99
            if (preg_match('/^(FAN\d*)\s*:\s*(.*)$/D', $line, $data)) {
100
                if ($data[2] <> '0') {
101
                    $dev = new SensorDevice();
102
                    $dev->setName($data[1]);
103
                    $dev->setValue($data[2]);
104
//                    $dev->setMax(3000);
105
                    $this->mbinfo->setMbFan($dev);
106
                }
107
            }
108
        }
109
    }
110
111
    /**
112
     * get voltage information
@@ 116-128 (lines=13) @@
113
     *
114
     * @return void
115
     */
116
    private function _voltage()
117
    {
118
        foreach ($this->_lines as $line) {
119
            if (preg_match('/^(V.*)\s*:\s*(.*)$/D', $line, $data)) {
120
                if ($data[2] <> '+0.00') {
121
                    $dev = new SensorDevice();
122
                    $dev->setName($data[1]);
123
                    $dev->setValue($data[2]);
124
                    $this->mbinfo->setMbVolt($dev);
125
                }
126
            }
127
        }
128
    }
129
130
    /**
131
     * get the information