/**
  * {@inheritdoc}
  */
 public function current()
 {
     if (!$this->worksheet) {
         return;
     }
     $row = [];
     /* @var \PHPExcel_Cell $cell */
     foreach ($this->worksheet->current()->getCellIterator() as $cell) {
         $row[] = $cell->getValue();
     }
     if (!empty($this->columns)) {
         $keysCount = count($keys = array_values($this->columns));
         $valuesCount = count($values = array_intersect_key($row, $this->columns));
         if ($keysCount > $valuesCount) {
             // Line too short
             $values = array_pad($values, $keysCount, null);
         } elseif ($keysCount < $valuesCount) {
             // Line too long
             $values = array_slice($values, 0, $keysCount);
         }
         return array_combine($keys, $values);
     }
     return $row;
 }
 /**
  * @return array
  */
 private function getFilteredArrayForCurrentRow()
 {
     /** @var \PHPExcel_Worksheet_CellIterator $cellIterator */
     $cellIterator = $this->rowIterator->current()->getCellIterator('A', $this->highestDataColumnName);
     $isHeaderRow = !is_array($this->header) || count($this->header) == 0;
     $array = array();
     /** @var \PHPExcel_Cell $cell */
     $cellArray = iterator_to_array($cellIterator);
     if (!$isHeaderRow && $this->removeCellsNotMatchingHeaderColumns) {
         //Remove every cell that is not in a column mapped by the header
         $cellArray = array_intersect_key($cellArray, $this->header);
     }
     foreach ($cellArray as $key => $cell) {
         if ($cell->getDataType() == \PHPExcel_Cell_DataType::TYPE_NULL) {
             //Remove all empty cells. We'll add them back later if necessary
             continue;
         }
         // TODO add a flag to indicate whether to use calculated value or plain value and test it
         /** @var \PHPExcel_Cell $cell */
         if ($cell->getDataType() != \PHPExcel_Cell_DataType::TYPE_FORMULA) {
             $array[$key] = $cell->getCalculatedValue();
             continue;
         }
         //Compute formulas with the cache disabled
         $calculation = \PHPExcel_Calculation::getInstance($cell->getWorksheet()->getParent());
         $calculation->disableCalculationCache();
         $result = $calculation->calculateCellValue($cell, true);
         if (is_array($result)) {
             while (is_array($result)) {
                 $result = array_pop($result);
             }
         }
         $array[$key] = $result;
     }
     //Should we add missing values?
     if (!$isHeaderRow && $this->fillMissingColumns) {
         foreach ($this->header as $index => $value) {
             if (!array_key_exists($index, $array)) {
                 $array[$index] = null;
             }
         }
     }
     return $array;
 }