Code Duplication    Length = 18-19 lines in 5 locations

phpsysinfo/includes/mb/class.freeipmi.inc.php 1 location

@@ 38-55 (lines=18) @@
35
    /**
36
     * fill the private content var through command or data access
37
     */
38
    public function __construct()
39
    {
40
        parent::__construct();
41
        switch (defined('PSI_SENSOR_FREEIPMI_ACCESS')?strtolower(PSI_SENSOR_FREEIPMI_ACCESS):'command') {
42
        case 'command':
43
            CommonFunctions::executeProgram('ipmi-sensors', '--output-sensor-thresholds', $lines);
44
            $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
45
            break;
46
        case 'data':
47
            if (CommonFunctions::rfts(APP_ROOT.'/data/freeipmi.txt', $lines)) {
48
                $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
49
            }
50
            break;
51
        default:
52
            $this->error->addConfigError('__construct()', 'PSI_SENSOR_FREEIPMI_ACCESS');
53
            break;
54
        }
55
    }
56
57
    /**
58
     * get temperature information

phpsysinfo/includes/mb/class.healthd.inc.php 1 location

@@ 38-56 (lines=19) @@
35
    /**
36
     * fill the private content var through command or data access
37
     */
38
    public function __construct()
39
    {
40
        parent::__construct();
41
        switch (defined('PSI_SENSOR_HEALTHD_ACCESS')?strtolower(PSI_SENSOR_HEALTHD_ACCESS):'command') {
42
        case 'command':
43
            $lines = "";
44
            CommonFunctions::executeProgram('healthdc', '-t', $lines);
45
            $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
46
            break;
47
        case 'data':
48
            if (CommonFunctions::rfts(APP_ROOT.'/data/healthd.txt', $lines)) {
49
                $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
50
            }
51
            break;
52
        default:
53
            $this->error->addConfigError('__construct()', 'PSI_SENSOR_HEALTHD_ACCESS');
54
            break;
55
        }
56
    }
57
58
    /**
59
     * get temperature information

phpsysinfo/includes/mb/class.ipmi.inc.php 1 location

@@ 38-55 (lines=18) @@
35
    /**
36
     * fill the private content var through command or data access
37
     */
38
    public function __construct()
39
    {
40
        parent::__construct();
41
        switch (defined('PSI_SENSOR_IPMI_ACCESS')?strtolower(PSI_SENSOR_IPMI_ACCESS):'command') {
42
        case 'command':
43
            CommonFunctions::executeProgram('ipmitool', 'sensor', $lines);
44
            $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
45
            break;
46
        case 'data':
47
            if (CommonFunctions::rfts(APP_ROOT.'/data/ipmi.txt', $lines)) {
48
                $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
49
            }
50
            break;
51
        default:
52
            $this->error->addConfigError('__construct()', 'PSI_SENSOR_IPMI_ACCESS');
53
            break;
54
        }
55
    }
56
57
    /**
58
     * get temperature information

phpsysinfo/includes/mb/class.ipmiutil.inc.php 1 location

@@ 38-55 (lines=18) @@
35
    /**
36
     * fill the private content var through command or data access
37
     */
38
    public function __construct()
39
    {
40
        parent::__construct();
41
        switch (defined('PSI_SENSOR_IPMIUTIL_ACCESS')?strtolower(PSI_SENSOR_IPMIUTIL_ACCESS):'command') {
42
        case 'command':
43
            CommonFunctions::executeProgram('ipmiutil', 'sensor -stw', $lines);
44
            $this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
45
            break;
46
        case 'data':
47
            if (CommonFunctions::rfts(APP_ROOT.'/data/ipmiutil.txt', $lines)) {
48
                $this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
49
            }
50
            break;
51
        default:
52
            $this->error->addConfigError('__construct()', 'PSI_SENSOR_IPMIUTIL_ACCESS');
53
            break;
54
        }
55
    }
56
57
    /**
58
     * get temperature information

phpsysinfo/includes/mb/class.k8temp.inc.php 1 location

@@ 38-56 (lines=19) @@
35
    /**
36
     * fill the private array
37
     */
38
    public function __construct()
39
    {
40
        parent::__construct();
41
        switch (defined('PSI_SENSOR_K8TEMP_ACCESS')?strtolower(PSI_SENSOR_K8TEMP_ACCESS):'command') {
42
        case 'command':
43
            $lines = "";
44
            CommonFunctions::executeProgram('k8temp', '', $lines);
45
            $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
46
            break;
47
        case 'data':
48
            if (CommonFunctions::rfts(APP_ROOT.'/data/k8temp.txt', $lines)) {
49
                $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
50
            }
51
            break;
52
        default:
53
            $this->error->addConfigError('__construct()', 'PSI_SENSOR_K8TEMP_ACCESS');
54
            break;
55
        }
56
    }
57
58
    /**
59
     * get temperature information