| Línea 64... |
Línea 64... |
| 64 |
* @param callable|null $callback Optional callback method to apply to each record prior to writing, which accepts two
|
64 |
* @param callable|null $callback Optional callback method to apply to each record prior to writing, which accepts two
|
| 65 |
* parameters as such: function($record, bool $supportshtml) returning formatted record
|
65 |
* parameters as such: function($record, bool $supportshtml) returning formatted record
|
| 66 |
* @throws coding_exception
|
66 |
* @throws coding_exception
|
| 67 |
*/
|
67 |
*/
|
| 68 |
public static function download_data(string $filename, string $dataformat, array $columns, Iterable $iterator,
|
68 |
public static function download_data(string $filename, string $dataformat, array $columns, Iterable $iterator,
|
| 69 |
callable $callback = null): void {
|
69 |
?callable $callback = null): void {
|
| Línea 70... |
Línea 70... |
| 70 |
|
70 |
|
| 71 |
if (ob_get_length()) {
|
71 |
if (ob_get_length()) {
|
| 72 |
throw new coding_exception('Output can not be buffered before calling download_data()');
|
72 |
throw new coding_exception('Output can not be buffered before calling download_data()');
|
| Línea 113... |
Línea 113... |
| 113 |
* @param Iterable $iterator
|
113 |
* @param Iterable $iterator
|
| 114 |
* @param callable|null $callback
|
114 |
* @param callable|null $callback
|
| 115 |
* @return string Complete path to the file on disk
|
115 |
* @return string Complete path to the file on disk
|
| 116 |
*/
|
116 |
*/
|
| 117 |
public static function write_data(string $filename, string $dataformat, array $columns, Iterable $iterator,
|
117 |
public static function write_data(string $filename, string $dataformat, array $columns, Iterable $iterator,
|
| 118 |
callable $callback = null): string {
|
118 |
?callable $callback = null): string {
|
| Línea 119... |
Línea 119... |
| 119 |
|
119 |
|
| Línea 120... |
Línea 120... |
| 120 |
$format = self::get_format_instance($dataformat);
|
120 |
$format = self::get_format_instance($dataformat);
|
| 121 |
|
121 |
|
| Línea 157... |
Línea 157... |
| 157 |
* @param Iterable $iterator Iterable set of records to write
|
157 |
* @param Iterable $iterator Iterable set of records to write
|
| 158 |
* @param callable|null $callback Optional callback method to apply to each record prior to writing
|
158 |
* @param callable|null $callback Optional callback method to apply to each record prior to writing
|
| 159 |
* @return stored_file
|
159 |
* @return stored_file
|
| 160 |
*/
|
160 |
*/
|
| 161 |
public static function write_data_to_filearea(array $filerecord, string $dataformat, array $columns, Iterable $iterator,
|
161 |
public static function write_data_to_filearea(array $filerecord, string $dataformat, array $columns, Iterable $iterator,
|
| 162 |
callable $callback = null): stored_file {
|
162 |
?callable $callback = null): stored_file {
|
| Línea 163... |
Línea 163... |
| 163 |
|
163 |
|
| Línea 164... |
Línea 164... |
| 164 |
$filepath = self::write_data($filerecord['filename'], $dataformat, $columns, $iterator, $callback);
|
164 |
$filepath = self::write_data($filerecord['filename'], $dataformat, $columns, $iterator, $callback);
|
| 165 |
|
165 |
|