PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / trunk
WCPOS – Point of Sale (POS) plugin for WooCommerce vtrunk
1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 1.9.13 1.9.12 1.9.11 1.9.10 1.9.9 All 158 releases
woocommerce-pos / includes / Interfaces / Collection_Writer_Interface.php

Collection_Writer_Interface.php in WCPOS – Point of Sale (POS) plugin for WooCommerce trunk, at includes/Interfaces/Collection_Writer_Interface.php

55 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Collection writer lifecycle contract.
4 *
5 * @package WCPOS\WooCommercePOS\Interfaces
6 */
7
8 // phpcs:disable Squiz.Commenting, Generic.Commenting -- Lifecycle docblocks are intentionally concise.
9
10 namespace WCPOS\WooCommercePOS\Interfaces;
11
12 /**
13 * Adapts collection behavior around the controller-owned mutation protocol.
14 *
15 * @internal Not a public extension point. Unlike the other contracts in this
16 * namespace, this shape is provisional: six of its methods still take a
17 * `callable` for the controller's default implementation, and the intended
18 * follow-up is to push those defaults into Null_Writer and let the other
19 * writers extend it. Third-party code must not implement this interface —
20 * narrowing it later would otherwise be a breaking change on a released line.
21 */
22 interface Collection_Writer_Interface {
23 /**
24 * Prepare a create payload and route.
25 *
26 * @return array|object Prepared write with method, route, payload, context, and optional context_factory keys; or validation error.
27 */
28 public function prepare_create( array $meta, array $payload, callable $validate_tax_ids );
29
30 /**
31 * Prepare an update payload and route.
32 *
33 * @return array|object Prepared write with method, route, payload, context, and optional context_factory keys; or validation error.
34 */
35 public function prepare_update( array $meta, int $id, array $payload, callable $validate_tax_ids );
36
37 /** Validate and repair an already-existing create target. */
38 public function validate_existing_create( int $id, array $payload, array $prepared );
39
40 /** Forward a prepared write within collection hooks. */
41 public function forward( array $prepared, callable $forward );
42
43 /** Persist collection data at a named create/update lifecycle phase. */
44 public function persist( string $phase, int $id, array $payload, array $current = array(), array $response_data = array(), array $context = array() ): void;
45
46 /** Execute the collection-specific delete forward. */
47 public function delete( array $meta, int $id, array $mutation, callable $dispatch, callable $can_delete );
48
49 /** Read the collection's authoritative response document. */
50 public function document( array $meta, int $id, callable $default_document );
51
52 /** Shape a bare document for the mutation response. */
53 public function build_response_document( array $bare, string $record_id, array $meta, int $id, callable $default_builder ): array;
54 }
55