Automattic\WooCommerce\Internal\StockNotifications\Frontend

SignupService::parse │ public │ WC 1.0

Parse the request data from a given source.

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

Хуков нет.

Возвращает

array|\WP_Error. The parsed request data, or a WP_Error if the request data is invalid.

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

$SignupService = new SignupService();
$SignupService->parse( $source );
$source(массив) (обязательный)
The source data, e.g. $_POST or $_REQUEST.

Код SignupService::parse() WC 11.2.2

public function parse( array $source ) {

	$parsed_data = $this->parse_user_data( $source );
	if ( \is_wp_error( $parsed_data ) ) {
		return $parsed_data;
	}

	$product = $this->parse_product( $source );
	if ( \is_wp_error( $product ) ) {
		return $product;
	}

	$parsed_data['product_id'] = $product->get_id();
	if ( $product instanceof \WC_Product_Variation ) {
		$posted_attributes = $this->parse_posted_attributes( $source, $product );

		if ( ! empty( $posted_attributes ) ) {
			$parsed_data['posted_attributes'] = $posted_attributes;
		}
	}

	return $parsed_data;
}