public function current()
    {
        if (count($this->castRows) > 0) {
            $row = array_shift($this->castRows);
        } else {
            $row = $this->schema->castRow($this->dataSource->getNextLine());
            foreach ($this->schema->fields() as $field) {
                if ($field->unique()) {
                    if (!array_key_exists($field->name(), $this->uniqueFieldValues)) {
                        $this->uniqueFieldValues[$field->name()] = [];
                    }
                    $value = $row[$field->name()];
                    if (in_array($value, $this->uniqueFieldValues[$field->name()])) {
                        throw new DataSourceException('field must be unique', $this->currentLine);
                    } else {
                        $this->uniqueFieldValues[$field->name()][] = $value;
                    }
                }
            }
        }

        return $row;
    }
public function current()
    {
        if (count($this->castRows) > 0) {
            $row = array_shift($this->castRows);
        } else {
            $row = $this->schema->castRow($this->dataSource->getNextLine());
            foreach ($this->schema->fields() as $field) {
                if ($field->unique()) {
                    if (!array_key_exists($field->name(), $this->uniqueFieldValues)) {
                        $this->uniqueFieldValues[$field->name()] = [];
                    }
                    $value = $row[$field->name()];
                    if (in_array($value, $this->uniqueFieldValues[$field->name()])) {
                        throw new DataSourceException('field must be unique', $this->currentLine);
                    } else {
                        $this->uniqueFieldValues[$field->name()][] = $value;
                    }
                }
            }
        }

        return $row;
    }
public function current ( ) { if ( count ( $ this -> castRows ) > 0 ) { $ row = array_shift ( $ this -> castRows ) ; } else { $ row = $ this -> schema -> castRow ( $ this -> dataSource -> getNextLine ( ) ) ; foreach ( $ this -> schema -> fields ( ) as $ field ) { if ( $ field -> unique ( ) ) { if ( ! array_key_exists ( $ field -> name ( ) , $ this -> uniqueFieldValues ) ) { $ this -> uniqueFieldValues [ $ field -> name ( ) ] = [ ] ; } $ value = $ row [ $ field -> name ( ) ] ; if ( in_array ( $ value , $ this -> uniqueFieldValues [ $ field -> name ( ) ] ) ) { throw new DataSourceException ( 'field must be unique' , $ this -> currentLine ) ; } else { $ this -> uniqueFieldValues [ $ field -> name ( ) ] [ ] = $ value ; } } } } return $ row ; }
called on each iteration to get the next row
does validation and casting on the row.

@return mixed[]

@throws Exceptions\FieldValidationException
@throws Exceptions\DataSourceException
called on each iteration to get the next row does validation and casting on the row .