private function parseSysLog()
 {
     /*
      * For parsing the syslog looking for sensord entries
      * POTENTIALLY BUGGY -- only tested on debian/ubuntu flavored syslogs
      * Also slow as balls as it parses the entire syslog instead of
      * using something like tail
      */
     $file = '/var/log/syslog';
     if (!is_file($file) || !is_readable($file)) {
         return array();
     }
     $devices = array();
     foreach (LinfoCommon::getLines($file) as $line) {
         if (preg_match('/\\w+\\s*\\d+ \\d{2}:\\d{2}:\\d{2} \\w+ sensord:\\s*(.+):\\s*(.+)/i', trim($line), $match) == 1) {
             // Replace current record of dev with updated temp
             $devices[$match[1]] = $match[2];
         }
     }
     $return = array();
     foreach ($devices as $dev => $stat) {
         $return[] = array('path' => 'N/A', 'name' => $dev, 'temp' => $stat, 'unit' => '');
     }
     return $return;
 }
 private function _call()
 {
     $this->_res = array();
     foreach ($this->_servers as $name => $path) {
         $lines = LinfoCommon::getLines($path);
         if (count($lines) == 0) {
             continue;
         }
         $info = self::readgamestat($lines);
         $this->_res[] = array('name' => $name, 'info' => $info);
     }
 }
 /**
  * @test
  */
 public function getLines()
 {
     $lines = array("lineone\n", "linetwo\n", "line3\n");
     $file = LINFO_TESTDIR . '/files/lines.txt';
     $this->assertEquals($lines, LinfoCommon::getLines($file));
 }
 private function parseSysLogData()
 {
     $file = '/var/log/syslog';
     if (!is_file($file) || !is_readable($file)) {
         return array();
     }
     $devices = array();
     foreach (LinfoCommon::getLines($file) as $line) {
         if (preg_match('/\\w+\\s*\\d+ \\d{2}:\\d{2}:\\d{2} \\w+ hddtemp\\[\\d+\\]: (.+): (.+): (\\d+) ([CF])/i', trim($line), $match) == 1) {
             // Replace current record of dev with updated temp
             $devices[$match[1]] = array($match[2], $match[3], $match[4]);
         }
     }
     $return = array();
     foreach ($devices as $dev => $stat) {
         $return[] = array('path' => $dev, 'name' => $stat[0], 'temp' => $stat[1], 'unit' => strtoupper($stat[2]));
     }
     return $return;
 }