$rows) { $columns = []; if (isset($rows[0])) { $columns = array_keys($rows[0]); } $metaData = new DefaultTableMetadata($tableName, $columns); $table = new DefaultTable($metaData); foreach ($rows as $row) { $table->addRow($row); } $this->tables[$tableName] = $table; } } protected function createIterator($reverse = false) { return new DefaultTableIterator($this->tables, $reverse); } public function getTable($tableName) { if (!isset($this->tables[$tableName])) { throw new InvalidArgumentException("$tableName is not a table in the current database."); } return $this->tables[$tableName]; } }