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();
|
||||
if (!empty($autoFilterRange)) {
|
||||
if ($pNumCols != 0) {
|
||||
$autoFilterColumns = array_keys($autoFilter->getColumns());
|
||||
$autoFilterColumns = $autoFilter->getColumns();
|
||||
if (count($autoFilterColumns) > 0) {
|
||||
sscanf($pBefore, '%[A-Z]%d', $column, $row);
|
||||
$columnIndex = Cell::columnIndexFromString($column);
|
||||
|
@ -559,7 +559,7 @@ class ReferenceHelper
|
|||
$deleteColumn = $columnIndex + $pNumCols - 1;
|
||||
$deleteCount = abs($pNumCols);
|
||||
for ($i = 1; $i <= $deleteCount; ++$i) {
|
||||
if (in_array(Cell::stringFromColumnIndex($deleteColumn), $autoFilterColumns)) {
|
||||
if (isset($autoFilterColumns[Cell::stringFromColumnIndex($deleteColumn)])) {
|
||||
$autoFilter->clearColumn(Cell::stringFromColumnIndex($deleteColumn));
|
||||
}
|
||||
++$deleteColumn;
|
||||
|
|
|
@ -518,8 +518,10 @@ class Worksheet extends BIFFwriter
|
|||
foreach ($conditionalStyles as $conditional) {
|
||||
if ($conditional->getConditionType() == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION
|
||||
|| $conditional->getConditionType() == \PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS) {
|
||||
if (!in_array($conditional->getHashCode(), $arrConditional)) {
|
||||
$arrConditional[] = $conditional->getHashCode();
|
||||
if (!isset($arrConditional[$conditional->getHashCode()])) {
|
||||
// This hash code has been handled
|
||||
$arrConditional[$conditional->getHashCode()] = true;
|
||||
|
||||
// Write CFRULE record
|
||||
$this->writeCFRule($conditional);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue