Skip to content

Commit

Permalink
Refactored getRow() now that reader offset starts at zero
Browse files Browse the repository at this point in the history
  • Loading branch information
nozavroni committed Jul 25, 2018
1 parent 77acf22 commit faa3e90
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/CSVelte/Reader.php
Expand Up @@ -106,10 +106,8 @@ public function getDialect()
public function getRow($offset = null)
{
if (!is_null($offset)) {
$this->rewind();
$i = 0;
while ($row = $this->getRow()) {
if ($offset === $i++) {
foreach ($this as $key => $row) {
if ($key === $offset) {
return $row;
}
}
Expand Down

0 comments on commit faa3e90

Please sign in to comment.