public function processRow(PHPExcel_Worksheet_Row $row) { $data = array(); $rowData = new DataInput($data); $empty = TRUE; foreach ($this->columnMapping as $c) { list($char, $key) = $c; $cell = $this->getCell($char); $value = $cell->getValue(); if ($value instanceof \PHPExcel_RichText) { $value = $value->getPlainText(); } $style = $this->getStyle($char); $value = $this->filterValue($value, $style); if ($value != NULL) { $empty = FALSE; } $rowData->setDataWithKeys($key, $value); $this->processedColumn($c, $cell, $style, $value, $empty, $rowData, $row); } if (!$empty || $this->getOption('filterEmptyRow', FALSE) == FALSE) { $this->data->setDataWithKeys(array('rows', $row->getRowIndex()), $rowData->toArray()); } else { $this->log .= 'Skipped.Empty: ' . $row->getRowIndex() . "\n"; } }
public function testSetDataWithKeys() { $data = array(); $input = new DataInput($data); $input->setDataWithKeys(array(), array('key1' => 'key1value')); $this->assertEquals('key1value', $input->get('key1')); $this->assertEquals(array('key1' => 'key1value'), $input->get(array())); }