wantDownload ? 'application/x-php' : 'text/plain'; } /** * @return string - file extension for the downloaded file */ protected function getFileExtension() { return 'php'; } /** * Write the document to stdout ('php://output') */ protected function writeDocument() { echo "getHeaderComment(' ') . "*/\n\n"; echo "return [\n"; $first = true; foreach ($this->iterateRows() as $row) { if ($first) { $first = false; } else { echo ",\n"; } echo ' ['; $firstf = true; foreach ($this->columns as $column) { if ($firstf) { $firstf = false; } else { echo ", "; } var_export($column->name); echo ' => '; var_export($row[$column->name]); } echo ']'; } echo "\n];\n"; } }