Automattic\WooCommerce\Internal\PushNotifications\DataStores

StepLogTableReader::build_row │ private static │ WC 1.0

Converts one table row to the shape the file reader produces.

Метод класса: StepLogTableReader{}

Хуков нет.

Возвращает

array{timestamp: int, level: string, message: string, context: array|null, raw: string|null}.

Использование

$result = StepLogTableReader::build_row( $result ): array;
$result(массив) (обязательный)
The row as wpdb returned it.

Код StepLogTableReader::build_row() WC 11.3.0

private static function build_row( array $result ): array {
	$context = null;
	$raw     = null;

	if ( ! empty( $result['context'] ) ) {
		$decoded = json_decode( (string) $result['context'], true );

		if ( is_array( $decoded ) ) {
			$context = $decoded;
		} else {
			$raw = (string) $result['context'];
		}
	}

	return array(
		'timestamp' => (int) strtotime( $result['timestamp'] . ' UTC' ),
		'level'     => (string) WC_Log_Levels::get_severity_level( (int) $result['level'] ),
		'message'   => (string) $result['message'],
		'context'   => $context,
		'raw'       => $raw,
	);
}