Automattic\WooCommerce\Internal\PushNotifications\Services

StepLogQuery::read │ private │ WC 1.0

Reads one source through the reader that matches the store's handler.

Method of the class: StepLogQuery{}

No Hooks.

Returns

array{rows: array, covered_from: int, has_more: bool}.

Usage

// private - for code of main (parent) class only
$result = $this->read( $source, $from, $to, $limit, ?callable $expand ): array;
$source(string) (required)
The log source.
$from(int) (required)
Earliest timestamp, inclusive.
$to(int) (required)
Latest timestamp, inclusive.
$limit(int) (required)
The fewest rows the reader collects before stopping.
?callable $expand(required)
.

StepLogQuery::read() code WC 11.3.0

private function read( string $source, int $from, int $to, int $limit, ?callable $expand ): array {
	$handler = LoggingUtil::get_default_handler();

	if ( is_a( $handler, WC_Log_Handler_DB::class, true ) ) {
		return $this->table_reader->read( $source, $from, $to, $limit, $expand );
	}

	if ( is_a( $handler, LogHandlerFileV2::class, true ) ) {
		return $this->file_reader->read( $source, $from, $to, $limit, $expand );
	}

	return array(
		'rows'         => array(),
		'covered_from' => $to,
		'has_more'     => false,
	);
}