WC_Product_Importer::get_percent_complete()publicWC 1.0

Get file pointer position as a percentage of file size.

Method of the class: WC_Product_Importer{}

No Hooks.

Return

Int.

Usage

$WC_Product_Importer = new WC_Product_Importer();
$WC_Product_Importer->get_percent_complete();

WC_Product_Importer::get_percent_complete() code WC 9.4.2

public function get_percent_complete() {
	$size = filesize( $this->file );
	if ( ! $size ) {
		return 0;
	}

	return absint( min( floor( ( $this->file_position / $size ) * 100 ), 100 ) );
}