mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-05 06:58:15 +00:00
Merge pull request #3347 from ConnectGrid/optimize-worksheet-from-array
Check $strictNullComparison outside of loops
This commit is contained in:
@@ -2784,23 +2784,30 @@ class Worksheet implements IComparable
|
||||
[$startColumn, $startRow] = Coordinate::coordinateFromString($startCell);
|
||||
|
||||
// Loop through $source
|
||||
foreach ($source as $rowData) {
|
||||
$currentColumn = $startColumn;
|
||||
foreach ($rowData as $cellValue) {
|
||||
if ($strictNullComparison) {
|
||||
if ($strictNullComparison) {
|
||||
foreach ($source as $rowData) {
|
||||
$currentColumn = $startColumn;
|
||||
foreach ($rowData as $cellValue) {
|
||||
if ($cellValue !== $nullValue) {
|
||||
// Set cell value
|
||||
$this->getCell($currentColumn . $startRow)->setValue($cellValue);
|
||||
}
|
||||
} else {
|
||||
++$currentColumn;
|
||||
}
|
||||
++$startRow;
|
||||
}
|
||||
} else {
|
||||
foreach ($source as $rowData) {
|
||||
$currentColumn = $startColumn;
|
||||
foreach ($rowData as $cellValue) {
|
||||
if ($cellValue != $nullValue) {
|
||||
// Set cell value
|
||||
$this->getCell($currentColumn . $startRow)->setValue($cellValue);
|
||||
}
|
||||
++$currentColumn;
|
||||
}
|
||||
++$currentColumn;
|
||||
++$startRow;
|
||||
}
|
||||
++$startRow;
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user