/** * Parse a FIT file into data-arrays. * After parsing, the ->records will be filled with the data. When the data * matches the product's profile, the column names will be known and added. * If not the data will still be read, but we won't know what it is, what * scale factor to apply and what unit it is. * * @param string $filepath Absolute path to the .FIT file * @return false When unable to open the file for reading. * @throws \Fit\Exception */ public function parseFile() { try { $this->readFileHeader(); $this->readRecords(); } catch (\Exception $e) { $this->reader->close(); throw $e; } $this->reader->close(); }
/** * Parse a FIT file into data-arrays. * After parsing, the ->records will be filled with the data. When the data * matches the product's profile, the column names will be known and added. * If not the data will still be read, but we won't know what it is, what * scale factor to apply and what unit it is. * * @param string $filepath Absolute path to the .FIT file * @return false When unable to open the file for reading. * @throws \Fit\Exception */ public function parseFile($filepath) { $handle = false; if (is_file($filepath)) { $handle = @fopen($filepath, 'rb'); } if (false === $handle) { \Fit\Exception::create(1003, \Fit\Exception::$codes[1003] . ' filepath: ' . $filepath); } $this->reader = new \Zend_Io_Reader($handle); try { $this->readFileHeader(); $this->readRecords(); } catch (\Exception $e) { $this->reader->close(); throw $e; } $this->reader->close(); }