GravityKit\GravityImport\Processor
Source: src/Processor.php:13
Details
- Kind:
class - Namespace:
GravityKit\GravityImport
Methods
| Method | Description |
|---|---|
__construct() | |
set_breakpoint() | Sets the current breakpoint. |
run() | Run tasks for as long as we can. |
has_resources() | Have we got fuel for more processing? |
handle_halt() | Halt processing on this batch. |
get_args() | Return the calculated arguments for this processor. |
transform_datetime() | Transform an input datetime format to an output one. |
handle_row_processing_error() | Handle errors when a row can't be processed. |
Method Reference
__construct()
public function __construct( $args )
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$args | array | Various arguments for this processor: batch_id string Only process tasks for this batch. timeout int The maximum number of seconds to process. memory int The maximum number of bytes for memory limit. count int The maximum number of rows to process per run. breakpoint string A state to break on during run. Broken once. Any first limit to be reached will trigger processing to be suspended. |
Source: src/Processor.php:45
set_breakpoint()
public function set_breakpoint( $breakpoint )
Sets the current breakpoint.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$breakpoint | string | A batch status to break on during the run. |
Source: src/Processor.php:104
run()
public function run()
Run tasks for as long as we can.
Returns
\WP_Error|array— A batch or an error.
Source: src/Processor.php:113
has_resources()
public function has_resources()
Have we got fuel for more processing?
Returns
bool
Source: src/Processor.php:286
handle_halt()
public function handle_halt( $batch )
Halt processing on this batch.
Processing will not halt immediately if other processors are working on the batch. See timeouts and wait periods.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$batch | array | The batch. |
Returns
\WP_Error|array— The batch or an error on timeout.
Source: src/Processor.php:940
get_args()
public function get_args()
Return the calculated arguments for this processor.
Returns
array— The arguments ($this->args)
Source: src/Processor.php:3208
transform_datetime()
public static function transform_datetime( $type, $input_date, $input_date_format, $output_date_format='Y-m-d H:i:s', $partial=0 )
Transform an input datetime format to an output one.
Uses https://www.php.net/manual/en/datetime.createfromformat.php
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$type | string | The input type. | |
$input_date | string | The input date. | |
$input_date_format | string | The input date format. | |
$output_date_format | string | 'Y-m-d H:i:s' | The output date format. |
$partial | int | 0 | The partial timestamp that needs to be completed. |
Returns
string— The final date output. Remains untouched if format is incorrect/unsupported.
Source: src/Processor.php:3225
handle_row_processing_error()
public function handle_row_processing_error( $error, $row, $batch )
Handle errors when a row can't be processed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$error | string | Error message | |
$row | array | null | Row data | |
$batch | array | Batch data |
Returns
array|\WP_Error|null
Since: 2.2.3
Source: src/Processor.php:3299