ProductShapeMapperInterface.php
36 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Product Shape Mapper Interface. |
| 4 | * |
| 5 | * @package Automattic\WooCommerce\Internal\ProductFeed |
| 6 | */ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | namespace Automattic\WooCommerce\Internal\ProductFeed\Mapping; |
| 11 | |
| 12 | /** |
| 13 | * Minimal contract for mapping a WooCommerce product to an arbitrary array shape. |
| 14 | * |
| 15 | * This interface carries no delivery semantics: implementations may produce feed |
| 16 | * rows, REST payloads, live query results, or any other shape. It can be consumed |
| 17 | * by push-feed integrations (via the ProductWalker / FeedInterface machinery) and |
| 18 | * by pull/live-query integrations alike, without taking a dependency on file or |
| 19 | * CSV delivery. |
| 20 | * |
| 21 | * This interface supersedes the Feed namespace's ProductMapperInterface, which |
| 22 | * extends it and is deprecated: all integrations, push-feed ones included, should |
| 23 | * implement this interface directly. |
| 24 | * |
| 25 | * @since 11.0.0 |
| 26 | */ |
| 27 | interface ProductShapeMapperInterface { |
| 28 | /** |
| 29 | * Map a product to an array shape. |
| 30 | * |
| 31 | * @param \WC_Product $product The product to map. |
| 32 | * @return array The mapped product data. |
| 33 | */ |
| 34 | public function map_product( \WC_Product $product ): array; |
| 35 | } |
| 36 |