PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.19
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.19
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 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 All 163 releases
woocommerce-pos / includes / Interfaces / Poll_Provider_Adapter_Interface.php

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

68 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plain-data polling protocol boundary.
4 *
5 * @package WCPOS\WooCommercePOS\Interfaces
6 */
7
8 namespace WCPOS\WooCommercePOS\Interfaces;
9
10 /**
11 * Wire protocols describe requests and responses; the lifecycle owns job state.
12 */
13 interface Poll_Provider_Adapter_Interface extends Provider_Adapter_Interface {
14 /**
15 * Parse the request phase and protocol hints.
16 *
17 * @param array $request Params, raw body, JSON, method and route.
18 * @return array Phase (advertise/fetch/result), token and protocol hints.
19 */
20 public function parse( array $request ): array;
21
22 /**
23 * Build an offer, acknowledgement or not-found response.
24 *
25 * @param array $printer Printer and cached capabilities.
26 * @param array $poll Parsed request, capability hint or not-found intent.
27 * @param array|null $next_job Available job, or null for an idle/result response.
28 * @return array{status:int, headers:array, body:string|array}
29 */
30 public function advertise( array $printer, array $poll, ?array $next_job ): array;
31
32 /**
33 * Negotiate before claiming the job.
34 *
35 * @param array $printer Printer and cached capabilities.
36 * @param array $poll Parsed request.
37 * @param array $job Candidate job, not yet claimed.
38 * @return array Media type, or a response rejecting the request before claiming.
39 */
40 public function negotiate( array $printer, array $poll, array $job ): array;
41
42 /**
43 * Build the delivery response, even when rendering failed.
44 *
45 * @param array $job Claimed job.
46 * @param array $render Rendered bytes (possibly empty) and peripheral controls.
47 * @param array $poll Parsed request and negotiated media type.
48 * @return array{status:int, headers:array, body:string|array}
49 */
50 public function deliver( array $job, array $render, array $poll ): array;
51
52 /**
53 * Identify the result target.
54 *
55 * @param array $poll Parsed result.
56 * @return array{job_id:int|null} Null means active/unconfirmed claim lookup.
57 */
58 public function match_result( array $poll ): array;
59
60 /**
61 * Decode the printer result.
62 *
63 * @param array $poll Parsed result.
64 * @return array{ok:bool, code:string, detail:string}
65 */
66 public function interpret_result( array $poll ): array;
67 }
68