Use `isset()` instead of `in_array()` for increased performance and code simplification
Closes #82 Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
parent
6b77a30093
commit
99e5a8e919
|
@ -547,7 +547,7 @@ class ReferenceHelper
|
||||||
$autoFilterRange = $autoFilter->getRange();
|
$autoFilterRange = $autoFilter->getRange();
|
||||||
if (!empty($autoFilterRange)) {
|
if (!empty($autoFilterRange)) {
|
||||||
if ($pNumCols != 0) {
|
if ($pNumCols != 0) {
|
||||||
$autoFilterColumns = array_keys($autoFilter->getColumns());
|
$autoFilterColumns = $autoFilter->getColumns();
|
||||||
if (count($autoFilterColumns) > 0) {
|
if (count($autoFilterColumns) > 0) {
|
||||||
sscanf($pBefore, '%[A-Z]%d', $column, $row);
|
sscanf($pBefore, '%[A-Z]%d', $column, $row);
|
||||||
$columnIndex = Cell::columnIndexFromString($column);
|
$columnIndex = Cell::columnIndexFromString($column);
|
||||||
|
@ -559,7 +559,7 @@ class ReferenceHelper
|
||||||
$deleteColumn = $columnIndex + $pNumCols - 1;
|
$deleteColumn = $columnIndex + $pNumCols - 1;
|
||||||
$deleteCount = abs($pNumCols);
|
$deleteCount = abs($pNumCols);
|
||||||
for ($i = 1; $i <= $deleteCount; ++$i) {
|
for ($i = 1; $i <= $deleteCount; ++$i) {
|
||||||
if (in_array(Cell::stringFromColumnIndex($deleteColumn), $autoFilterColumns)) {
|
if (isset($autoFilterColumns[Cell::stringFromColumnIndex($deleteColumn)])) {
|
||||||
$autoFilter->clearColumn(Cell::stringFromColumnIndex($deleteColumn));
|
$autoFilter->clearColumn(Cell::stringFromColumnIndex($deleteColumn));
|
||||||
}
|
}
|
||||||
++$deleteColumn;
|
++$deleteColumn;
|
||||||
|
|
|
@ -518,8 +518,10 @@ class Worksheet extends BIFFwriter
|
||||||
foreach ($conditionalStyles as $conditional) {
|
foreach ($conditionalStyles as $conditional) {
|
||||||
if ($conditional->getConditionType() == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION
|
if ($conditional->getConditionType() == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION
|
||||||
|| $conditional->getConditionType() == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS) {
|
|| $conditional->getConditionType() == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS) {
|
||||||
if (!in_array($conditional->getHashCode(), $arrConditional)) {
|
if (!isset($arrConditional[$conditional->getHashCode()])) {
|
||||||
$arrConditional[] = $conditional->getHashCode();
|
// This hash code has been handled
|
||||||
|
$arrConditional[$conditional->getHashCode()] = true;
|
||||||
|
|
||||||
// Write CFRULE record
|
// Write CFRULE record
|
||||||
$this->writeCFRule($conditional);
|
$this->writeCFRule($conditional);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue