public function rows(array $options = [])
{
if (!$this->isComplete()) {
throw new GoogleException('The query has not completed yet.');
}
if (!isset($this->info['rows'])) {
return;
}
$schema = $this->info['schema']['fields'];
while (true) {
$options['pageToken'] = isset($this->info['pageToken']) ? $this->info['pageToken'] : null;
foreach ($this->info['rows'] as $row) {
$mergedRow = [];
if ($row === null) {
continue;
}
if (!array_key_exists('f', $row)) {
throw new GoogleException('Bad response - missing key "f" for a row.');
}
foreach ($row['f'] as $key => $value) {
$fieldSchema = $schema[$key];
$mergedRow[$fieldSchema['name']] = $this->mapper->fromBigQuery($value, $fieldSchema);
}
(yield $mergedRow);
}
if (!$options['pageToken']) {
return;
}
$this->info = $this->connection->getQueryResults($options + $this->identity);
}
}