WC_Product_Importer::get_percent_complete
Get file pointer position as a percentage of file size.
Method of the class: WC_Product_Importer{}
No Hooks.
Returns
Int.
Usage
$WC_Product_Importer = new WC_Product_Importer(); $WC_Product_Importer->get_percent_complete();
WC_Product_Importer::get_percent_complete() WC Product Importer::get percent complete code WC 10.5.0
public function get_percent_complete() {
$size = filesize( $this->file );
if ( ! $size ) {
return 0;
}
return absint( min( floor( ( $this->file_position / $size ) * 100 ), 100 ) );
}