product = $product_object; } $this->setup_hooks(); } /** * Registers the hooks and then delegates to the child */ public function setup_hooks() { $this->setup_hooks_child(); } /** * Calls the API * * @param string $attributes The attributes of the post body. */ protected function call_api( $attributes ) { $slug = $this->product->get_slug(); $version = $this->product->get_version(); $attributes['slug'] = $slug; $attributes['version'] = $version; $response = wp_remote_post( $this->feedback_url, array( 'body' => $attributes, ) ); } /** * Randomizes the options array * * @param array $options The options array. */ function randomize_options( $options ) { $new = array(); $keys = array_keys( $options ); shuffle( $keys ); foreach ( $keys as $key ) { $new[ $key ] = $options[ $key ]; } return $new; } /** * Abstract function for delegating to the child */ protected abstract function setup_hooks_child(); } endif;