EasyCSV\Reader::getRow PHP Method

getRow() public method

public getRow ( ) : array | boolean
return array | boolean
    public function getRow()
    {
        $this->init();
        if ($this->isEof()) {
            return false;
        }
        $row = $this->getCurrentRow();
        $isEmpty = $this->rowIsEmpty($row);
        if ($this->isEof() === false) {
            $this->handle->next();
        }
        if ($isEmpty === false) {
            return $this->headers && is_array($this->headers) ? array_combine($this->headers, $row) : $row;
        } elseif ($isEmpty) {
            // empty row, transparently try the next row
            return $this->getRow();
        } else {
            return false;
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @dataProvider getReadersNoHeadersFirstRow
  */
 public function testAdvanceToNoHeadersFirstRow(Reader $reader)
 {
     $row = array(0 => 'Some Meta Data', 1 => '', 2 => '');
     $actualRow = $reader->getRow();
     $this->assertEquals($row, $actualRow);
     // give it the ol' one-two-switcharoo
     $reader->advanceTo(3);
     $reader->getRow();
     $reader->advanceTo(0);
     $this->assertEquals($row, $reader->getRow());
 }
All Usage Examples Of EasyCSV\Reader::getRow