/**
* Creates a dataset.
*
* Example:
* ```
* $dataset = $bigQuery->createDataset('aDataset');
* ```
*
* @see https://cloud.google.com/bigquery/docs/reference/v2/datasets/insert Datasets insert API documentation.
*
* @param string $id The id of the dataset to create.
* @param array $options [optional] {
* Configuration options.
*
* @type array $metadata The available options for metadata are outlined
* at the
* [Dataset Resource API docs](https://cloud.google.com/bigquery/docs/reference/v2/datasets#resource)
* }
* @return Dataset
*/
public function createDataset($id, array $options = [])
{
if (isset($options['metadata'])) {
$options += $options['metadata'];
unset($options['metadata']);
}
$response = $this->connection->insertDataset(['projectId' => $this->projectId, 'datasetReference' => ['datasetId' => $id]] + $options);
return new Dataset($this->connection, $id, $this->projectId, $response);
}