Code Duplication    Length = 14-14 lines in 4 locations

phpsysinfo/includes/xml/class.XML.inc.php 4 locations

@@ 435-448 (lines=14) @@
432
                $mbinfo_data = new $mbinfoclass();
433
                $mbinfo_detail = $mbinfo_data->getMBInfo();
434
435
                foreach ($mbinfo_detail->getMbTemp() as $dev) {
436
                    if ($temp == null) {
437
                        $temp = $mbinfo->addChild('Temperature');
438
                    }
439
                    $item = $temp->addChild('Item');
440
                    $item->addAttribute('Label', $dev->getName());
441
                    $item->addAttribute('Value', $dev->getValue());
442
                    if ($dev->getMax() !== null) {
443
                        $item->addAttribute('Max', $dev->getMax());
444
                    }
445
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
446
                        $item->addAttribute('Event', $dev->getEvent());
447
                    }
448
                }
449
450
                foreach ($mbinfo_detail->getMbFan() as $dev) {
451
                    if ($fan == null) {
@@ 450-463 (lines=14) @@
447
                    }
448
                }
449
450
                foreach ($mbinfo_detail->getMbFan() as $dev) {
451
                    if ($fan == null) {
452
                        $fan = $mbinfo->addChild('Fans');
453
                    }
454
                    $item = $fan->addChild('Item');
455
                    $item->addAttribute('Label', $dev->getName());
456
                    $item->addAttribute('Value', $dev->getValue());
457
                    if ($dev->getMin() !== null) {
458
                        $item->addAttribute('Min', $dev->getMin());
459
                    }
460
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
461
                        $item->addAttribute('Event', $dev->getEvent());
462
                    }
463
                }
464
465
                foreach ($mbinfo_detail->getMbVolt() as $dev) {
466
                    if ($volt == null) {
@@ 483-496 (lines=14) @@
480
                    }
481
                }
482
483
                foreach ($mbinfo_detail->getMbPower() as $dev) {
484
                    if ($power == null) {
485
                        $power = $mbinfo->addChild('Power');
486
                    }
487
                    $item = $power->addChild('Item');
488
                    $item->addAttribute('Label', $dev->getName());
489
                    $item->addAttribute('Value', $dev->getValue());
490
                    if ($dev->getMax() !== null) {
491
                        $item->addAttribute('Max', $dev->getMax());
492
                    }
493
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
494
                        $item->addAttribute('Event', $dev->getEvent());
495
                    }
496
                }
497
498
                foreach ($mbinfo_detail->getMbCurrent() as $dev) {
499
                    if ($current == null) {
@@ 498-511 (lines=14) @@
495
                    }
496
                }
497
498
                foreach ($mbinfo_detail->getMbCurrent() as $dev) {
499
                    if ($current == null) {
500
                        $current = $mbinfo->addChild('Current');
501
                    }
502
                    $item = $current->addChild('Item');
503
                    $item->addAttribute('Label', $dev->getName());
504
                    $item->addAttribute('Value', $dev->getValue());
505
                    if ($dev->getMax() !== null) {
506
                        $item->addAttribute('Max', $dev->getMax());
507
                    }
508
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
509
                        $item->addAttribute('Event', $dev->getEvent());
510
                    }
511
                }
512
            }
513
        }
514
    }