You are here

private static function PHPExcel_Reader_Excel5::_readBIFF8Constant in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php \PHPExcel_Reader_Excel5::_readBIFF8Constant()

* read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value' * section 2.5.7 * returns e.g. array('value' => '5', 'size' => 9) * *

Parameters

string $valueData: * @return array

1 call to PHPExcel_Reader_Excel5::_readBIFF8Constant()
PHPExcel_Reader_Excel5::_readBIFF8ConstantArray in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* read BIFF8 constant value array from array data * returns e.g. array('value' => '{1,2;3,4}', 'size' => 40} * section 2.5.8 * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php, line 6454

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private static function _readBIFF8Constant($valueData) {

  // offset: 0; size: 1; identifier for type of constant
  $identifier = ord($valueData[0]);
  switch ($identifier) {
    case 0x0:

      // empty constant (what is this?)
      $value = '';
      $size = 9;
      break;
    case 0x1:

      // number
      // offset: 1; size: 8; IEEE 754 floating-point value
      $value = self::_extractNumber(substr($valueData, 1, 8));
      $size = 9;
      break;
    case 0x2:

      // string value
      // offset: 1; size: var; Unicode string, 16-bit string length
      $string = self::_readUnicodeStringLong(substr($valueData, 1));
      $value = '"' . $string['value'] . '"';
      $size = 1 + $string['size'];
      break;
    case 0x4:

      // boolean
      // offset: 1; size: 1; 0 = FALSE, 1 = TRUE
      if (ord($valueData[1])) {
        $value = 'TRUE';
      }
      else {
        $value = 'FALSE';
      }
      $size = 9;
      break;
    case 0x10:

      // error code
      // offset: 1; size: 1; error code
      $value = self::_mapErrorCode(ord($valueData[1]));
      $size = 9;
      break;
  }
  return array(
    'value' => $value,
    'size' => $size,
  );
}