mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-11-13 13:57:20 +00:00
Rename and Change Visibility Of 2 Xls Writer Properties
BIFFWriter defines two properties, `_data` and `_datasize` as public. There is no reason for them to be public, and no reason for the leading underscore. Change them to protected, and change their names.
This commit is contained in:
@@ -190,7 +190,7 @@ class Xls extends BaseWriter
|
||||
$worksheetSizes = [];
|
||||
for ($i = 0; $i < $countSheets; ++$i) {
|
||||
$this->writerWorksheets[$i]->close();
|
||||
$worksheetSizes[] = $this->writerWorksheets[$i]->_datasize;
|
||||
$worksheetSizes[] = $this->writerWorksheets[$i]->getBiffDataSize();
|
||||
}
|
||||
|
||||
// add binary data for global workbook stream
|
||||
|
||||
@@ -19,12 +19,12 @@ class BIFFwriter
|
||||
/**
|
||||
* The string containing the data of the BIFF stream.
|
||||
*/
|
||||
public ?string $_data;
|
||||
protected ?string $biffData;
|
||||
|
||||
/**
|
||||
* The size of the data in bytes. Should be the same as strlen($this->_data).
|
||||
* The size of the data in bytes. Should be the same as strlen($this->biffData).
|
||||
*/
|
||||
public int $_datasize;
|
||||
protected int $biffDataSize;
|
||||
|
||||
/**
|
||||
* The maximum length for a BIFF record (excluding record header and length field). See addContinue().
|
||||
@@ -38,8 +38,8 @@ class BIFFwriter
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_data = '';
|
||||
$this->_datasize = 0;
|
||||
$this->biffData = '';
|
||||
$this->biffDataSize = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,12 +76,12 @@ class BIFFwriter
|
||||
if (strlen($data) - 4 > $this->limit) {
|
||||
$data = $this->addContinue($data);
|
||||
}
|
||||
$this->_data .= $data;
|
||||
$this->_datasize += strlen($data);
|
||||
$this->biffData .= $data;
|
||||
$this->biffDataSize += strlen($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* General storage function like append, but returns string instead of modifying $this->_data.
|
||||
* General storage function like append, but returns string instead of modifying $this->biffData.
|
||||
*
|
||||
* @param string $data binary data to write
|
||||
*/
|
||||
@@ -90,7 +90,7 @@ class BIFFwriter
|
||||
if (strlen($data) - 4 > $this->limit) {
|
||||
$data = $this->addContinue($data);
|
||||
}
|
||||
$this->_datasize += strlen($data);
|
||||
$this->biffDataSize += strlen($data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -181,4 +181,9 @@ class BIFFwriter
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
public function getBiffDataSize(): int
|
||||
{
|
||||
return $this->biffDataSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,9 +427,9 @@ class Workbook extends BIFFwriter
|
||||
}
|
||||
|
||||
// Add part 3 of the Workbook globals
|
||||
$this->_data .= $part3;
|
||||
$this->biffData .= $part3;
|
||||
|
||||
return $this->_data;
|
||||
return $this->biffData;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -440,7 +440,7 @@ class Workbook extends BIFFwriter
|
||||
$boundsheet_length = 10; // fixed length for a BOUNDSHEET record
|
||||
|
||||
// size of Workbook globals part 1 + 3
|
||||
$offset = $this->_datasize;
|
||||
$offset = $this->biffDataSize;
|
||||
|
||||
// add size of Workbook globals part 2, the length of the SHEET records
|
||||
$total_worksheets = count($this->spreadsheet->getAllSheets());
|
||||
|
||||
@@ -605,9 +605,9 @@ class Worksheet extends BIFFwriter
|
||||
public function getData(): string
|
||||
{
|
||||
// Return data stored in memory
|
||||
if (isset($this->_data)) {
|
||||
$tmp = $this->_data;
|
||||
$this->_data = null;
|
||||
if (isset($this->biffData)) {
|
||||
$tmp = $this->biffData;
|
||||
$this->biffData = null;
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user