Code Duplication    Length = 4-5 lines in 3 locations

phpsysinfo/plugins/bat/class.bat.inc.php 3 locations

@@ 256-260 (lines=5) @@
253
            $roworig = trim($roworig);
254
            if (preg_match('/^[dD]esign capacity:\s*(.*) (.*)$/', $roworig, $data)) {
255
                $bat['design_capacity'] = $data[1];
256
                if (!isset($bat['capacity_unit'])) {
257
                    $bat['capacity_unit'] = trim($data[2]);
258
                } elseif ($bat['capacity_unit'] != trim($data[2])) {
259
                    $bat['capacity_unit'] = "???";
260
                }
261
            } elseif (preg_match('/^[lL]ast full capacity:\s*(.*) (.*)$/', $roworig, $data)) {
262
                $bat['full_capacity'] = $data[1];
263
                if (!isset($bat['capacity_unit'])) {
@@ 263-267 (lines=5) @@
260
                }
261
            } elseif (preg_match('/^[lL]ast full capacity:\s*(.*) (.*)$/', $roworig, $data)) {
262
                $bat['full_capacity'] = $data[1];
263
                if (!isset($bat['capacity_unit'])) {
264
                    $bat['capacity_unit'] = trim($data[2]);
265
                } elseif ($bat['capacity_unit'] != trim($data[2])) {
266
                    $bat['capacity_unit'] = "???";
267
                }
268
            } elseif (preg_match('/^cycle count:\s*(.*)$/', $roworig, $data) && ($data[1]>0)) {
269
                $bat['cycle_count'] = $data[1];
270
            } elseif (preg_match('/^[dD]esign voltage:\s*(.*) (.*)$/', $roworig, $data)) {
@@ 427-430 (lines=4) @@
424
        foreach ($this->_filecontent['state'] as $roworig) {
425
            $roworig = trim($roworig);
426
            if (preg_match('/^remaining capacity:\s*(.*) (.*)$/', $roworig, $data)) {
427
                if (!isset($bat['capacity_unit']) || ($bat['capacity_unit'] == trim($data[2]))) {
428
                    $bat['capacity_unit'] = trim($data[2]);
429
                    $bat['remaining_capacity'] = $data[1];
430
                }
431
            } elseif (preg_match('/^present voltage:\s*(.*) (.*)$/', $roworig, $data)) {
432
                if ($data[2]=="mV") { // uV or mV detection
433
                    $bat['present_voltage'] = $data[1];