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 / Sync / Meta_Entry.php

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

40 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WCPOS sync meta entry adapter.
4 *
5 * @package WCPOS\WooCommercePOS\Sync
6 */
7
8 namespace WCPOS\WooCommercePOS\Sync;
9
10 /**
11 * Reads array and object forms of WooCommerce meta entries.
12 */
13 final class Meta_Entry {
14 /**
15 * Read a meta entry key.
16 *
17 * Returns the raw key without coercion. A malformed entry can carry a
18 * non-scalar key (an array, from a client that sent the wrong shape), and
19 * callers are responsible for their own tolerance — Pos_Order_Audit gates
20 * on is_scalar(), the comparison sites use strict === against a string.
21 * Declaring ?string here would fatal before those guards could run.
22 *
23 * @param mixed $entry WooCommerce meta entry.
24 * @return mixed
25 */
26 public static function key( $entry ) {
27 return \is_array( $entry ) ? ( $entry['key'] ?? null ) : ( \is_object( $entry ) ? ( $entry->key ?? null ) : null );
28 }
29
30 /**
31 * Read a meta entry value.
32 *
33 * @param mixed $entry WooCommerce meta entry.
34 * @return mixed
35 */
36 public static function value( $entry ) {
37 return \is_array( $entry ) ? ( $entry['value'] ?? null ) : ( \is_object( $entry ) ? ( $entry->value ?? null ) : null );
38 }
39 }
40