original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: called on each iteration to get the next row
  does validation and casting on the row.
  
  @return mixed[]
  
  @throws Exceptions\FieldValidationException
  @throws Exceptions\DataSourceException
docstring_tokens: called on each iteration to get the next row does validation and casting on the row .