Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/Internal/BatchPro...
File: BatchProcessorInterface.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Interface for batch data processors. See the BatchProcessingController class for usage details.
[2] Fix | Delete
*/
[3] Fix | Delete
[4] Fix | Delete
namespace Automattic\WooCommerce\Internal\BatchProcessing;
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Interface BatchProcessorInterface
[8] Fix | Delete
*
[9] Fix | Delete
* @package Automattic\WooCommerce\Internal\BatchProcessing
[10] Fix | Delete
*/
[11] Fix | Delete
interface BatchProcessorInterface {
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* Get a user-friendly name for this processor.
[15] Fix | Delete
*
[16] Fix | Delete
* @return string Name of the processor.
[17] Fix | Delete
*/
[18] Fix | Delete
public function get_name() : string;
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Get a user-friendly description for this processor.
[22] Fix | Delete
*
[23] Fix | Delete
* @return string Description of what this processor does.
[24] Fix | Delete
*/
[25] Fix | Delete
public function get_description() : string;
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Get the total number of pending items that require processing.
[29] Fix | Delete
* Once an item is successfully processed by 'process_batch' it shouldn't be included in this count.
[30] Fix | Delete
*
[31] Fix | Delete
* Note that the once the processor is enqueued the batch processor controller will keep
[32] Fix | Delete
* invoking `get_next_batch_to_process` and `process_batch` repeatedly until this method returns zero.
[33] Fix | Delete
*
[34] Fix | Delete
* @return int Number of items pending processing.
[35] Fix | Delete
*/
[36] Fix | Delete
public function get_total_pending_count() : int;
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* Returns the next batch of items that need to be processed.
[40] Fix | Delete
*
[41] Fix | Delete
* A batch item can be anything needed to identify the actual processing to be done,
[42] Fix | Delete
* but whenever possible items should be numbers (e.g. database record ids)
[43] Fix | Delete
* or at least strings, to ease troubleshooting and logging in case of problems.
[44] Fix | Delete
*
[45] Fix | Delete
* The size of the batch returned can be less than $size if there aren't that
[46] Fix | Delete
* many items pending processing (and it can be zero if there isn't anything to process),
[47] Fix | Delete
* but the size should always be consistent with what 'get_total_pending_count' returns
[48] Fix | Delete
* (i.e. the size of the returned batch shouldn't be larger than the pending items count).
[49] Fix | Delete
*
[50] Fix | Delete
* @param int $size Maximum size of the batch to be returned.
[51] Fix | Delete
*
[52] Fix | Delete
* @return array Batch of items to process, containing $size or less items.
[53] Fix | Delete
*/
[54] Fix | Delete
public function get_next_batch_to_process( int $size ) : array;
[55] Fix | Delete
[56] Fix | Delete
/**
[57] Fix | Delete
* Process data for the supplied batch.
[58] Fix | Delete
*
[59] Fix | Delete
* This method should be prepared to receive items that don't actually need processing
[60] Fix | Delete
* (because they have been processed before) and ignore them, but if at least
[61] Fix | Delete
* one of the batch items that actually need processing can't be processed, an exception should be thrown.
[62] Fix | Delete
*
[63] Fix | Delete
* Once an item has been processed it shouldn't be counted in 'get_total_pending_count'
[64] Fix | Delete
* nor included in 'get_next_batch_to_process' anymore (unless something happens that causes it
[65] Fix | Delete
* to actually require further processing).
[66] Fix | Delete
*
[67] Fix | Delete
* @throw \Exception Something went wrong while processing the batch.
[68] Fix | Delete
*
[69] Fix | Delete
* @param array $batch Batch to process, as returned by 'get_next_batch_to_process'.
[70] Fix | Delete
*/
[71] Fix | Delete
public function process_batch( array $batch ): void;
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
* Default (preferred) batch size to pass to 'get_next_batch_to_process'.
[75] Fix | Delete
* The controller will pass this size unless it's externally configured
[76] Fix | Delete
* to use a different size.
[77] Fix | Delete
*
[78] Fix | Delete
* @return int Default batch size.
[79] Fix | Delete
*/
[80] Fix | Delete
public function get_default_batch_size() : int;
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function