Automattic\WooCommerce\Internal\StockNotifications\Frontend
SignupService::parse
Parse the request data from a given source.
Method of the class: SignupService{}
No Hooks.
Returns
Array|\WP_Error. The parsed request data, or a WP_Error if the request data is invalid.
Usage
$SignupService = new SignupService(); $SignupService->parse( $source );
- $source(array) (required)
- The source data, e.g. $_POST or $_REQUEST.
SignupService::parse() SignupService::parse code WC 10.3.6
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;
}