src/Csv.php
public function get($index = null, $fetchFields = []) {
	$this->lock();

	if(is_null($index)) {
		$index = $this->file->key();
	}
	else {
		if(!(is_int($index) || ctype_digit($index))
		|| $index < 0) {
			throw new InvalidIndexException($index);
		}
		$index = (int)$index;
	}

	if($index <= $this->file->key() + 1) {
		$this->file->rewind();
	}

	while($index >= $this->file->key()) {
		$this->file->next();
	}

	if(!$this->file->valid()) {
		$this->file->flock(LOCK_UN);
		return false;
	}

	$data = $this->file->current();
	$this->file->flock(LOCK_UN);

	$row = $this->toAssociative($data);
	return $row;
}
public function get($index = null, $fetchFields = []) {
	$this->lock();

	if(is_null($index)) {
		$index = $this->file->key();
	}
	else {
		if(!(is_int($index) || ctype_digit($index))
		|| $index < 0) {
			throw new InvalidIndexException($index);
		}
		$index = (int)$index;
	}

	if($index <= $this->file->key() + 1) {
		$this->file->rewind();
	}

	while($index >= $this->file->key()) {
		$this->file->next();
	}

	if(!$this->file->valid()) {
		$this->file->flock(LOCK_UN);
		return false;
	}

	$data = $this->file->current();
	$this->file->flock(LOCK_UN);

	$row = $this->toAssociative($data);
	return $row;
}
public function get ( $ index = null , $ fetchFields = [ ] ) { $ this -> lock ( ) ; if ( is_null ( $ index ) ) { $ index = $ this -> file -> key ( ) ; } else { if ( ! ( is_int ( $ index ) || ctype_digit ( $ index ) ) || $ index < 0 ) { throw new InvalidIndexException ( $ index ) ; } $ index = ( int ) $ index ; } if ( $ index <= $ this -> file -> key ( ) + 1 ) { $ this -> file -> rewind ( ) ; } while ( $ index >= $ this -> file -> key ( ) ) { $ this -> file -> next ( ) ; } if ( ! $ this -> file -> valid ( ) ) { $ this -> file -> flock ( LOCK_UN ) ; return false ; } $ data = $ this -> file -> current ( ) ; $ this -> file -> flock ( LOCK_UN ) ; $ row = $ this -> toAssociative ( $ data ) ; return $ row ; }
Returns the row at the given index, or the current file pointer position if
not supplied. Optionally supply the headers to retrieve, ignoring any others.

@param null|int $index Zero-based row number (0 is the first row after the
header row)
@param array $fetchFields NOT IMPLEMENTED List of fields to include in
resulting rows

@return array|bool Associative array of fields, or false if index is out
of bounds
Returns the row at the given index or the current file pointer position if not supplied . Optionally supply the headers to retrieve ignoring any others .