You are here

private static function PHPExcel_Reader_Excel5::_readBIFF8ConstantArray in Loft Data Grids 6.2

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

* read BIFF8 constant value array from array data * returns e.g. array('value' => '{1,2;3,4}', 'size' => 40} * section 2.5.8 * *

Parameters

string $arrayData: * @return array

1 call to PHPExcel_Reader_Excel5::_readBIFF8ConstantArray()
PHPExcel_Reader_Excel5::_createFormulaFromTokens in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Take array of tokens together with additional data for formula and return human readable formula * *

File

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

Class

PHPExcel_Reader_Excel5
PHPExcel_Reader_Excel5

Code

private static function _readBIFF8ConstantArray($arrayData) {

  // offset: 0; size: 1; number of columns decreased by 1
  $nc = ord($arrayData[0]);

  // offset: 1; size: 2; number of rows decreased by 1
  $nr = self::_GetInt2d($arrayData, 1);
  $size = 3;

  // initialize
  $arrayData = substr($arrayData, 3);

  // offset: 3; size: var; list of ($nc + 1) * ($nr + 1) constant values
  $matrixChunks = array();
  for ($r = 1; $r <= $nr + 1; ++$r) {
    $items = array();
    for ($c = 1; $c <= $nc + 1; ++$c) {
      $constant = self::_readBIFF8Constant($arrayData);
      $items[] = $constant['value'];
      $arrayData = substr($arrayData, $constant['size']);
      $size += $constant['size'];
    }
    $matrixChunks[] = implode(',', $items);

    // looks like e.g. '1,"hello"'
  }
  $matrix = '{' . implode(';', $matrixChunks) . '}';
  return array(
    'value' => $matrix,
    'size' => $size,
  );
}