Avoid underscore in property names
This commit is contained in:
parent
c9795e13b5
commit
bd3285b4fa
|
@ -289,21 +289,21 @@ useful:
|
||||||
/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
|
/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
|
||||||
class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
|
class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
|
||||||
{
|
{
|
||||||
private $_startRow = 0;
|
private $startRow = 0;
|
||||||
private $_endRow = 0;
|
private $endRow = 0;
|
||||||
private $_columns = array();
|
private $columns = array();
|
||||||
|
|
||||||
/** Get the list of rows and columns to read */
|
/** Get the list of rows and columns to read */
|
||||||
public function __construct($startRow, $endRow, $columns) {
|
public function __construct($startRow, $endRow, $columns) {
|
||||||
$this->_startRow = $startRow;
|
$this->startRow = $startRow;
|
||||||
$this->_endRow = $endRow;
|
$this->endRow = $endRow;
|
||||||
$this->_columns = $columns;
|
$this->columns = $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '') {
|
public function readCell($column, $row, $worksheetName = '') {
|
||||||
// Only read the rows and columns that were configured
|
// Only read the rows and columns that were configured
|
||||||
if ($row >= $this->_startRow && $row <= $this->_endRow) {
|
if ($row >= $this->startRow && $row <= $this->endRow) {
|
||||||
if (in_array($column,$this->_columns)) {
|
if (in_array($column,$this->columns)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,18 +331,18 @@ $inputFileName = './sampleData/example2.xls';
|
||||||
/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
|
/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */
|
||||||
class ChunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
|
class ChunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
|
||||||
{
|
{
|
||||||
private $_startRow = 0;
|
private $startRow = 0;
|
||||||
private $_endRow = 0;
|
private $endRow = 0;
|
||||||
|
|
||||||
/** Set the list of rows that we want to read */
|
/** Set the list of rows that we want to read */
|
||||||
public function setRows($startRow, $chunkSize) {
|
public function setRows($startRow, $chunkSize) {
|
||||||
$this->_startRow = $startRow;
|
$this->startRow = $startRow;
|
||||||
$this->_endRow = $startRow + $chunkSize;
|
$this->endRow = $startRow + $chunkSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '') {
|
public function readCell($column, $row, $worksheetName = '') {
|
||||||
// Only read the heading row, and the configured rows
|
// Only read the heading row, and the configured rows
|
||||||
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Sample;
|
namespace Samples\Sample12;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Sample;
|
namespace Samples\Sample10;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
||||||
|
@ -13,21 +13,21 @@ $sheetname = 'Data Sheet #3';
|
||||||
|
|
||||||
class MyReadFilter implements IReadFilter
|
class MyReadFilter implements IReadFilter
|
||||||
{
|
{
|
||||||
private $_startRow = 0;
|
private $startRow = 0;
|
||||||
private $_endRow = 0;
|
private $endRow = 0;
|
||||||
private $_columns = [];
|
private $columns = [];
|
||||||
|
|
||||||
public function __construct($startRow, $endRow, $columns)
|
public function __construct($startRow, $endRow, $columns)
|
||||||
{
|
{
|
||||||
$this->_startRow = $startRow;
|
$this->startRow = $startRow;
|
||||||
$this->_endRow = $endRow;
|
$this->endRow = $endRow;
|
||||||
$this->_columns = $columns;
|
$this->columns = $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '')
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
{
|
{
|
||||||
if ($row >= $this->_startRow && $row <= $this->_endRow) {
|
if ($row >= $this->startRow && $row <= $this->endRow) {
|
||||||
if (in_array($column, $this->_columns)) {
|
if (in_array($column, $this->columns)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Sample;
|
namespace Samples\Sample09;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
||||||
|
@ -13,8 +13,8 @@ $inputFileName = __DIR__ . '/sampleData/example2.xls';
|
||||||
/** Define a Read Filter class implementing IReadFilter */
|
/** Define a Read Filter class implementing IReadFilter */
|
||||||
class ChunkReadFilter implements IReadFilter
|
class ChunkReadFilter implements IReadFilter
|
||||||
{
|
{
|
||||||
private $_startRow = 0;
|
private $startRow = 0;
|
||||||
private $_endRow = 0;
|
private $endRow = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We expect a list of the rows that we want to read to be passed into the constructor.
|
* We expect a list of the rows that we want to read to be passed into the constructor.
|
||||||
|
@ -24,14 +24,14 @@ class ChunkReadFilter implements IReadFilter
|
||||||
*/
|
*/
|
||||||
public function __construct($startRow, $chunkSize)
|
public function __construct($startRow, $chunkSize)
|
||||||
{
|
{
|
||||||
$this->_startRow = $startRow;
|
$this->startRow = $startRow;
|
||||||
$this->_endRow = $startRow + $chunkSize;
|
$this->endRow = $startRow + $chunkSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '')
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
{
|
{
|
||||||
// Only read the heading row, and the rows that were configured in the constructor
|
// Only read the heading row, and the rows that were configured in the constructor
|
||||||
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Sample;
|
namespace Samples\Sample12;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
||||||
|
@ -13,8 +13,8 @@ $inputFileName = __DIR__ . '/sampleData/example2.xls';
|
||||||
/** Define a Read Filter class implementing IReadFilter */
|
/** Define a Read Filter class implementing IReadFilter */
|
||||||
class ChunkReadFilter implements IReadFilter
|
class ChunkReadFilter implements IReadFilter
|
||||||
{
|
{
|
||||||
private $_startRow = 0;
|
private $startRow = 0;
|
||||||
private $_endRow = 0;
|
private $endRow = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the list of rows that we want to read.
|
* Set the list of rows that we want to read.
|
||||||
|
@ -24,14 +24,14 @@ class ChunkReadFilter implements IReadFilter
|
||||||
*/
|
*/
|
||||||
public function setRows($startRow, $chunkSize)
|
public function setRows($startRow, $chunkSize)
|
||||||
{
|
{
|
||||||
$this->_startRow = $startRow;
|
$this->startRow = $startRow;
|
||||||
$this->_endRow = $startRow + $chunkSize;
|
$this->endRow = $startRow + $chunkSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '')
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
{
|
{
|
||||||
// Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
|
// Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
|
||||||
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Sample;
|
namespace Samples\Sample14;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
||||||
|
@ -14,8 +14,8 @@ $inputFileName = __DIR__ . '/sampleData/example2.csv';
|
||||||
/** Define a Read Filter class implementing IReadFilter */
|
/** Define a Read Filter class implementing IReadFilter */
|
||||||
class ChunkReadFilter implements IReadFilter
|
class ChunkReadFilter implements IReadFilter
|
||||||
{
|
{
|
||||||
private $_startRow = 0;
|
private $startRow = 0;
|
||||||
private $_endRow = 0;
|
private $endRow = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the list of rows that we want to read.
|
* Set the list of rows that we want to read.
|
||||||
|
@ -25,14 +25,14 @@ class ChunkReadFilter implements IReadFilter
|
||||||
*/
|
*/
|
||||||
public function setRows($startRow, $chunkSize)
|
public function setRows($startRow, $chunkSize)
|
||||||
{
|
{
|
||||||
$this->_startRow = $startRow;
|
$this->startRow = $startRow;
|
||||||
$this->_endRow = $startRow + $chunkSize;
|
$this->endRow = $startRow + $chunkSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readCell($column, $row, $worksheetName = '')
|
public function readCell($column, $row, $worksheetName = '')
|
||||||
{
|
{
|
||||||
// Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
|
// Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
|
||||||
if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
|
if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -803,15 +803,15 @@ class Cell
|
||||||
// Using a lookup cache adds a slight memory overhead, but boosts speed
|
// Using a lookup cache adds a slight memory overhead, but boosts speed
|
||||||
// caching using a static within the method is faster than a class static,
|
// caching using a static within the method is faster than a class static,
|
||||||
// though it's additional memory overhead
|
// though it's additional memory overhead
|
||||||
static $_indexCache = [];
|
static $indexCache = [];
|
||||||
|
|
||||||
if (isset($_indexCache[$pString])) {
|
if (isset($indexCache[$pString])) {
|
||||||
return $_indexCache[$pString];
|
return $indexCache[$pString];
|
||||||
}
|
}
|
||||||
// It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord()
|
// It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord()
|
||||||
// and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant
|
// and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant
|
||||||
// memory overhead either
|
// memory overhead either
|
||||||
static $_columnLookup = [
|
static $columnLookup = [
|
||||||
'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13,
|
'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13,
|
||||||
'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26,
|
'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26,
|
||||||
'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13,
|
'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13,
|
||||||
|
@ -822,17 +822,17 @@ class Cell
|
||||||
// for improved performance
|
// for improved performance
|
||||||
if (isset($pString[0])) {
|
if (isset($pString[0])) {
|
||||||
if (!isset($pString[1])) {
|
if (!isset($pString[1])) {
|
||||||
$_indexCache[$pString] = $_columnLookup[$pString];
|
$indexCache[$pString] = $columnLookup[$pString];
|
||||||
|
|
||||||
return $_indexCache[$pString];
|
return $indexCache[$pString];
|
||||||
} elseif (!isset($pString[2])) {
|
} elseif (!isset($pString[2])) {
|
||||||
$_indexCache[$pString] = $_columnLookup[$pString[0]] * 26 + $_columnLookup[$pString[1]];
|
$indexCache[$pString] = $columnLookup[$pString[0]] * 26 + $columnLookup[$pString[1]];
|
||||||
|
|
||||||
return $_indexCache[$pString];
|
return $indexCache[$pString];
|
||||||
} elseif (!isset($pString[3])) {
|
} elseif (!isset($pString[3])) {
|
||||||
$_indexCache[$pString] = $_columnLookup[$pString[0]] * 676 + $_columnLookup[$pString[1]] * 26 + $_columnLookup[$pString[2]];
|
$indexCache[$pString] = $columnLookup[$pString[0]] * 676 + $columnLookup[$pString[1]] * 26 + $columnLookup[$pString[2]];
|
||||||
|
|
||||||
return $_indexCache[$pString];
|
return $indexCache[$pString];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ class Xls extends BaseReader implements IReader
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_baseCell;
|
private $baseCell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Xls Reader instance.
|
* Create a new Xls Reader instance.
|
||||||
|
@ -3968,14 +3968,14 @@ class Xls extends BaseReader implements IReader
|
||||||
// get the base cell, grab tExp token
|
// get the base cell, grab tExp token
|
||||||
$baseRow = self::getUInt2d($formulaStructure, 3);
|
$baseRow = self::getUInt2d($formulaStructure, 3);
|
||||||
$baseCol = self::getUInt2d($formulaStructure, 5);
|
$baseCol = self::getUInt2d($formulaStructure, 5);
|
||||||
$this->_baseCell = Cell::stringFromColumnIndex($baseCol) . ($baseRow + 1);
|
$this->baseCell = Cell::stringFromColumnIndex($baseCol) . ($baseRow + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||||
if ($isPartOfSharedFormula) {
|
if ($isPartOfSharedFormula) {
|
||||||
// formula is added to this cell after the sheet has been read
|
// formula is added to this cell after the sheet has been read
|
||||||
$this->sharedFormulaParts[$columnString . ($row + 1)] = $this->_baseCell;
|
$this->sharedFormulaParts[$columnString . ($row + 1)] = $this->baseCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
// offset: 16: size: 4; not used
|
// offset: 16: size: 4; not used
|
||||||
|
@ -4078,7 +4078,7 @@ class Xls extends BaseReader implements IReader
|
||||||
$formula = substr($recordData, 8);
|
$formula = substr($recordData, 8);
|
||||||
|
|
||||||
// at this point we only store the shared formula for later use
|
// at this point we only store the shared formula for later use
|
||||||
$this->sharedFormulas[$this->_baseCell] = $formula;
|
$this->sharedFormulas[$this->baseCell] = $formula;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,22 +43,22 @@ class Root extends PPS
|
||||||
/**
|
/**
|
||||||
* @var resource
|
* @var resource
|
||||||
*/
|
*/
|
||||||
private $_FILEH_;
|
private $fileHandle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_tmp_filename;
|
private $tempFilename;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_SMALL_BLOCK_SIZE;
|
private $smallBlockSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_BIG_BLOCK_SIZE;
|
private $bigBlockSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $time_1st A timestamp
|
* @param int $time_1st A timestamp
|
||||||
|
@ -88,30 +88,30 @@ class Root extends PPS
|
||||||
public function save($filename)
|
public function save($filename)
|
||||||
{
|
{
|
||||||
// Initial Setting for saving
|
// Initial Setting for saving
|
||||||
$this->_BIG_BLOCK_SIZE = pow(
|
$this->bigBlockSize = pow(
|
||||||
2,
|
2,
|
||||||
(isset($this->_BIG_BLOCK_SIZE)) ? self::adjust2($this->_BIG_BLOCK_SIZE) : 9
|
(isset($this->bigBlockSize)) ? self::adjust2($this->bigBlockSize) : 9
|
||||||
);
|
);
|
||||||
$this->_SMALL_BLOCK_SIZE = pow(
|
$this->smallBlockSize = pow(
|
||||||
2,
|
2,
|
||||||
(isset($this->_SMALL_BLOCK_SIZE)) ? self::adjust2($this->_SMALL_BLOCK_SIZE) : 6
|
(isset($this->smallBlockSize)) ? self::adjust2($this->smallBlockSize) : 6
|
||||||
);
|
);
|
||||||
|
|
||||||
if (is_resource($filename)) {
|
if (is_resource($filename)) {
|
||||||
$this->_FILEH_ = $filename;
|
$this->fileHandle = $filename;
|
||||||
} elseif ($filename == '-' || $filename == '') {
|
} elseif ($filename == '-' || $filename == '') {
|
||||||
if ($this->tempDirectory === null) {
|
if ($this->tempDirectory === null) {
|
||||||
$this->tempDirectory = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
|
$this->tempDirectory = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
|
||||||
}
|
}
|
||||||
$this->_tmp_filename = tempnam($this->tempDirectory, 'OLE_PPS_Root');
|
$this->tempFilename = tempnam($this->tempDirectory, 'OLE_PPS_Root');
|
||||||
$this->_FILEH_ = fopen($this->_tmp_filename, 'w+b');
|
$this->fileHandle = fopen($this->tempFilename, 'w+b');
|
||||||
if ($this->_FILEH_ == false) {
|
if ($this->fileHandle == false) {
|
||||||
throw new WriterException("Can't create temporary file.");
|
throw new WriterException("Can't create temporary file.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->_FILEH_ = fopen($filename, 'wb');
|
$this->fileHandle = fopen($filename, 'wb');
|
||||||
}
|
}
|
||||||
if ($this->_FILEH_ == false) {
|
if ($this->fileHandle == false) {
|
||||||
throw new WriterException("Can't open $filename. It may be in use or protected.");
|
throw new WriterException("Can't open $filename. It may be in use or protected.");
|
||||||
}
|
}
|
||||||
// Make an array of PPS's (for Save)
|
// Make an array of PPS's (for Save)
|
||||||
|
@ -133,7 +133,7 @@ class Root extends PPS
|
||||||
$this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);
|
$this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);
|
||||||
|
|
||||||
if (!is_resource($filename)) {
|
if (!is_resource($filename)) {
|
||||||
fclose($this->_FILEH_);
|
fclose($this->fileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -157,21 +157,21 @@ class Root extends PPS
|
||||||
if ($raList[$i]->Type == OLE::OLE_PPS_TYPE_FILE) {
|
if ($raList[$i]->Type == OLE::OLE_PPS_TYPE_FILE) {
|
||||||
$raList[$i]->Size = $raList[$i]->getDataLen();
|
$raList[$i]->Size = $raList[$i]->getDataLen();
|
||||||
if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) {
|
if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) {
|
||||||
$iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
|
$iSBcnt += floor($raList[$i]->Size / $this->smallBlockSize)
|
||||||
+ (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0);
|
+ (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
$iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
|
$iBBcnt += (floor($raList[$i]->Size / $this->bigBlockSize) +
|
||||||
(($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
|
(($raList[$i]->Size % $this->bigBlockSize) ? 1 : 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
|
$iSmallLen = $iSBcnt * $this->smallBlockSize;
|
||||||
$iSlCnt = floor($this->_BIG_BLOCK_SIZE / OLE::OLE_LONG_INT_SIZE);
|
$iSlCnt = floor($this->bigBlockSize / OLE::OLE_LONG_INT_SIZE);
|
||||||
$iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0);
|
$iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0);
|
||||||
$iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
|
$iBBcnt += (floor($iSmallLen / $this->bigBlockSize) +
|
||||||
(($iSmallLen % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
|
(($iSmallLen % $this->bigBlockSize) ? 1 : 0));
|
||||||
$iCnt = count($raList);
|
$iCnt = count($raList);
|
||||||
$iBdCnt = $this->_BIG_BLOCK_SIZE / OLE::OLE_PPS_SIZE;
|
$iBdCnt = $this->bigBlockSize / OLE::OLE_PPS_SIZE;
|
||||||
$iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0));
|
$iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0));
|
||||||
|
|
||||||
return [$iSBDcnt, $iBBcnt, $iPPScnt];
|
return [$iSBDcnt, $iBBcnt, $iPPScnt];
|
||||||
|
@ -202,11 +202,11 @@ class Root extends PPS
|
||||||
*/
|
*/
|
||||||
public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
|
public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
|
||||||
{
|
{
|
||||||
$FILE = $this->_FILEH_;
|
$FILE = $this->fileHandle;
|
||||||
|
|
||||||
// Calculate Basic Setting
|
// Calculate Basic Setting
|
||||||
$iBlCnt = $this->_BIG_BLOCK_SIZE / OLE::OLE_LONG_INT_SIZE;
|
$iBlCnt = $this->bigBlockSize / OLE::OLE_LONG_INT_SIZE;
|
||||||
$i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / OLE::OLE_LONG_INT_SIZE;
|
$i1stBdL = ($this->bigBlockSize - 0x4C) / OLE::OLE_LONG_INT_SIZE;
|
||||||
|
|
||||||
$iBdExL = 0;
|
$iBdExL = 0;
|
||||||
$iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
|
$iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
|
||||||
|
@ -281,7 +281,7 @@ class Root extends PPS
|
||||||
*/
|
*/
|
||||||
public function _saveBigData($iStBlk, &$raList)
|
public function _saveBigData($iStBlk, &$raList)
|
||||||
{
|
{
|
||||||
$FILE = $this->_FILEH_;
|
$FILE = $this->fileHandle;
|
||||||
|
|
||||||
// cycle through PPS's
|
// cycle through PPS's
|
||||||
$iCount = count($raList);
|
$iCount = count($raList);
|
||||||
|
@ -291,14 +291,14 @@ class Root extends PPS
|
||||||
if (($raList[$i]->Size >= OLE::OLE_DATA_SIZE_SMALL) || (($raList[$i]->Type == OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) {
|
if (($raList[$i]->Size >= OLE::OLE_DATA_SIZE_SMALL) || (($raList[$i]->Type == OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) {
|
||||||
fwrite($FILE, $raList[$i]->_data);
|
fwrite($FILE, $raList[$i]->_data);
|
||||||
|
|
||||||
if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) {
|
if ($raList[$i]->Size % $this->bigBlockSize) {
|
||||||
fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)));
|
fwrite($FILE, str_repeat("\x00", $this->bigBlockSize - ($raList[$i]->Size % $this->bigBlockSize)));
|
||||||
}
|
}
|
||||||
// Set For PPS
|
// Set For PPS
|
||||||
$raList[$i]->startBlock = $iStBlk;
|
$raList[$i]->startBlock = $iStBlk;
|
||||||
$iStBlk +=
|
$iStBlk +=
|
||||||
(floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
|
(floor($raList[$i]->Size / $this->bigBlockSize) +
|
||||||
(($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
|
(($raList[$i]->Size % $this->bigBlockSize) ? 1 : 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ class Root extends PPS
|
||||||
public function _makeSmallData(&$raList)
|
public function _makeSmallData(&$raList)
|
||||||
{
|
{
|
||||||
$sRes = '';
|
$sRes = '';
|
||||||
$FILE = $this->_FILEH_;
|
$FILE = $this->fileHandle;
|
||||||
$iSmBlk = 0;
|
$iSmBlk = 0;
|
||||||
|
|
||||||
$iCount = count($raList);
|
$iCount = count($raList);
|
||||||
|
@ -323,8 +323,8 @@ class Root extends PPS
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) {
|
if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) {
|
||||||
$iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
|
$iSmbCnt = floor($raList[$i]->Size / $this->smallBlockSize)
|
||||||
+ (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0);
|
+ (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0);
|
||||||
// Add to SBD
|
// Add to SBD
|
||||||
$jB = $iSmbCnt - 1;
|
$jB = $iSmbCnt - 1;
|
||||||
for ($j = 0; $j < $jB; ++$j) {
|
for ($j = 0; $j < $jB; ++$j) {
|
||||||
|
@ -334,8 +334,8 @@ class Root extends PPS
|
||||||
|
|
||||||
// Add to Data String(this will be written for RootEntry)
|
// Add to Data String(this will be written for RootEntry)
|
||||||
$sRes .= $raList[$i]->_data;
|
$sRes .= $raList[$i]->_data;
|
||||||
if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
|
if ($raList[$i]->Size % $this->smallBlockSize) {
|
||||||
$sRes .= str_repeat("\x00", $this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
|
$sRes .= str_repeat("\x00", $this->smallBlockSize - ($raList[$i]->Size % $this->smallBlockSize));
|
||||||
}
|
}
|
||||||
// Set for PPS
|
// Set for PPS
|
||||||
$raList[$i]->startBlock = $iSmBlk;
|
$raList[$i]->startBlock = $iSmBlk;
|
||||||
|
@ -343,7 +343,7 @@ class Root extends PPS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$iSbCnt = floor($this->_BIG_BLOCK_SIZE / OLE::OLE_LONG_INT_SIZE);
|
$iSbCnt = floor($this->bigBlockSize / OLE::OLE_LONG_INT_SIZE);
|
||||||
if ($iSmBlk % $iSbCnt) {
|
if ($iSmBlk % $iSbCnt) {
|
||||||
$iB = $iSbCnt - ($iSmBlk % $iSbCnt);
|
$iB = $iSbCnt - ($iSmBlk % $iSbCnt);
|
||||||
for ($i = 0; $i < $iB; ++$i) {
|
for ($i = 0; $i < $iB; ++$i) {
|
||||||
|
@ -364,13 +364,13 @@ class Root extends PPS
|
||||||
// Save each PPS WK
|
// Save each PPS WK
|
||||||
$iC = count($raList);
|
$iC = count($raList);
|
||||||
for ($i = 0; $i < $iC; ++$i) {
|
for ($i = 0; $i < $iC; ++$i) {
|
||||||
fwrite($this->_FILEH_, $raList[$i]->_getPpsWk());
|
fwrite($this->fileHandle, $raList[$i]->_getPpsWk());
|
||||||
}
|
}
|
||||||
// Adjust for Block
|
// Adjust for Block
|
||||||
$iCnt = count($raList);
|
$iCnt = count($raList);
|
||||||
$iBCnt = $this->_BIG_BLOCK_SIZE / OLE::OLE_PPS_SIZE;
|
$iBCnt = $this->bigBlockSize / OLE::OLE_PPS_SIZE;
|
||||||
if ($iCnt % $iBCnt) {
|
if ($iCnt % $iBCnt) {
|
||||||
fwrite($this->_FILEH_, str_repeat("\x00", ($iBCnt - ($iCnt % $iBCnt)) * OLE::OLE_PPS_SIZE));
|
fwrite($this->fileHandle, str_repeat("\x00", ($iBCnt - ($iCnt % $iBCnt)) * OLE::OLE_PPS_SIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,10 +383,10 @@ class Root extends PPS
|
||||||
*/
|
*/
|
||||||
public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt)
|
public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt)
|
||||||
{
|
{
|
||||||
$FILE = $this->_FILEH_;
|
$FILE = $this->fileHandle;
|
||||||
// Calculate Basic Setting
|
// Calculate Basic Setting
|
||||||
$iBbCnt = $this->_BIG_BLOCK_SIZE / OLE::OLE_LONG_INT_SIZE;
|
$iBbCnt = $this->bigBlockSize / OLE::OLE_LONG_INT_SIZE;
|
||||||
$i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / OLE::OLE_LONG_INT_SIZE;
|
$i1stBdL = ($this->bigBlockSize - 0x4C) / OLE::OLE_LONG_INT_SIZE;
|
||||||
|
|
||||||
$iBdExL = 0;
|
$iBdExL = 0;
|
||||||
$iAll = $iBsize + $iPpsCnt + $iSbdSize;
|
$iAll = $iBsize + $iPpsCnt + $iSbdSize;
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Chart extends WriterPart
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_seriesIndex;
|
private $seriesIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write charts to XML format.
|
* Write charts to XML format.
|
||||||
|
@ -220,7 +220,7 @@ class Chart extends WriterPart
|
||||||
}
|
}
|
||||||
|
|
||||||
$id1 = $id2 = 0;
|
$id1 = $id2 = 0;
|
||||||
$this->_seriesIndex = 0;
|
$this->seriesIndex = 0;
|
||||||
$objWriter->startElement('c:plotArea');
|
$objWriter->startElement('c:plotArea');
|
||||||
|
|
||||||
$layout = $plotArea->getLayout();
|
$layout = $plotArea->getLayout();
|
||||||
|
@ -1096,11 +1096,11 @@ class Chart extends WriterPart
|
||||||
}
|
}
|
||||||
|
|
||||||
$objWriter->startElement('c:idx');
|
$objWriter->startElement('c:idx');
|
||||||
$objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesIdx);
|
$objWriter->writeAttribute('val', $this->seriesIndex + $plotSeriesIdx);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
$objWriter->startElement('c:order');
|
$objWriter->startElement('c:order');
|
||||||
$objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef);
|
$objWriter->writeAttribute('val', $this->seriesIndex + $plotSeriesRef);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART)) {
|
if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART)) {
|
||||||
|
@ -1218,7 +1218,7 @@ class Chart extends WriterPart
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_seriesIndex += $plotSeriesIdx + 1;
|
$this->seriesIndex += $plotSeriesIdx + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Custom;
|
||||||
|
|
||||||
class ComplexAssert
|
class ComplexAssert
|
||||||
{
|
{
|
||||||
private $_errorMessage = '';
|
private $errorMessage = '';
|
||||||
|
|
||||||
public function assertComplexEquals($expected, $actual, $delta = 0)
|
public function assertComplexEquals($expected, $actual, $delta = 0)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ class ComplexAssert
|
||||||
if ($expected === $actual) {
|
if ($expected === $actual) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$this->_errorMessage = 'Expected Error: ' . $actual . ' !== ' . $expected;
|
$this->errorMessage = 'Expected Error: ' . $actual . ' !== ' . $expected;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ class ComplexAssert
|
||||||
|
|
||||||
if (!is_numeric($actualComplex->getReal()) || !is_numeric($expectedComplex->getReal())) {
|
if (!is_numeric($actualComplex->getReal()) || !is_numeric($expectedComplex->getReal())) {
|
||||||
if ($actualComplex->getReal() !== $expectedComplex->getReal()) {
|
if ($actualComplex->getReal() !== $expectedComplex->getReal()) {
|
||||||
$this->_errorMessage = 'Mismatched String: ' . $actualComplex->getReal() . ' !== ' . $expectedComplex->getReal();
|
$this->errorMessage = 'Mismatched String: ' . $actualComplex->getReal() . ' !== ' . $expectedComplex->getReal();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -33,20 +33,20 @@ class ComplexAssert
|
||||||
|
|
||||||
if ($actualComplex->getReal() < ($expectedComplex->getReal() - $delta) ||
|
if ($actualComplex->getReal() < ($expectedComplex->getReal() - $delta) ||
|
||||||
$actualComplex->getReal() > ($expectedComplex->getReal() + $delta)) {
|
$actualComplex->getReal() > ($expectedComplex->getReal() + $delta)) {
|
||||||
$this->_errorMessage = 'Mismatched Real part: ' . $actualComplex->getReal() . ' != ' . $expectedComplex->getReal();
|
$this->errorMessage = 'Mismatched Real part: ' . $actualComplex->getReal() . ' != ' . $expectedComplex->getReal();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($actualComplex->getImaginary() < ($expectedComplex->getImaginary() - $delta) ||
|
if ($actualComplex->getImaginary() < ($expectedComplex->getImaginary() - $delta) ||
|
||||||
$actualComplex->getImaginary() > ($expectedComplex->getImaginary() + $delta)) {
|
$actualComplex->getImaginary() > ($expectedComplex->getImaginary() + $delta)) {
|
||||||
$this->_errorMessage = 'Mismatched Imaginary part: ' . $actualComplex->getImaginary() . ' != ' . $expectedComplex->getImaginary();
|
$this->errorMessage = 'Mismatched Imaginary part: ' . $actualComplex->getImaginary() . ' != ' . $expectedComplex->getImaginary();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($actualComplex->getSuffix() !== $actualComplex->getSuffix()) {
|
if ($actualComplex->getSuffix() !== $actualComplex->getSuffix()) {
|
||||||
$this->_errorMessage = 'Mismatched Suffix: ' . $actualComplex->getSuffix() . ' != ' . $expectedComplex->getSuffix();
|
$this->errorMessage = 'Mismatched Suffix: ' . $actualComplex->getSuffix() . ' != ' . $expectedComplex->getSuffix();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,6 @@ class ComplexAssert
|
||||||
|
|
||||||
public function getErrorMessage()
|
public function getErrorMessage()
|
||||||
{
|
{
|
||||||
return $this->_errorMessage;
|
return $this->errorMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue