Automattic\WooCommerce\Internal\Admin\Logging\FileV2

FileExporter::send_contentsprivateWC 1.0

Send the contents of the file.

Method of the class: FileExporter{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->send_contents(): void;

FileExporter::send_contents() code WC 10.8.1

private function send_contents(): void {
	// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- No suitable alternative.
	$stream = fopen( $this->path, 'rb' );

	while ( is_resource( $stream ) && ! feof( $stream ) ) {
		// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fread -- No suitable alternative.
		$chunk = fread( $stream, self::CHUNK_SIZE );

		if ( is_string( $chunk ) ) {
			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Outputting to file.
			echo $chunk;
		}
	}

	// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- No suitable alternative.
	fclose( $stream );
}