| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class Rest_API\V4\Barcode\Service file. |
| 4 |
* |
| 5 |
* @package PostNLWooCommerce\Rest_API\V4\Barcode |
| 6 |
*/ |
| 7 |
|
| 8 |
declare( strict_types = 1 ); |
| 9 |
|
| 10 |
namespace PostNLWooCommerce\Rest_API\V4\Barcode; |
| 11 |
|
| 12 |
use PostNLWooCommerce\Rest_API\Contracts\Barcode_Service_Interface; |
| 13 |
|
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Class Service |
| 20 |
* |
| 21 |
* V4 barcode "service" — intentionally a no-op. |
| 22 |
* |
| 23 |
* V4 has no standalone barcode endpoint: the label call auto-issues the barcode and |
| 24 |
* returns it, so there is nothing for generate() to request. Order\Base takes the |
| 25 |
* label-first branch on V4 and never calls generate(); this class exists only so |
| 26 |
* Service_Factory can return a uniform Barcode_Service_Interface. |
| 27 |
* |
| 28 |
* @since 6.0.0 |
| 29 |
* @package PostNLWooCommerce\Rest_API\V4\Barcode |
| 30 |
*/ |
| 31 |
class Service implements Barcode_Service_Interface { |
| 32 |
|
| 33 |
/** |
| 34 |
* No-op barcode generation. |
| 35 |
* |
| 36 |
* Returns an empty array, which create_barcode() rejects loudly — reaching this |
| 37 |
* method means the V4 path was mis-wired, not that a barcode is unavailable. |
| 38 |
* |
| 39 |
* @param array $post_data Post data (unused on V4). |
| 40 |
* |
| 41 |
* @return array Always empty; the barcode is harvested from the label response. |
| 42 |
* |
| 43 |
* @since 6.0.0 |
| 44 |
*/ |
| 45 |
public function generate( array $post_data ): array { |
| 46 |
return array(); |
| 47 |
} |
| 48 |
} |
| 49 |
|