summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
committerAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
commit10ef81bf85ad0a4bad0d204838e14c99ca2526f7 (patch)
treeb4bb36a326d41de12d1a6181d2a2baf34696ac24 /plugins/jetpack/vendor/automattic/jetpack-sync/src/class-utils.php
parentUpdating script for Update (diff)
downloadblogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.gz
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.bz2
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.zip
Update jetpack 8.0
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/jetpack/vendor/automattic/jetpack-sync/src/class-utils.php')
-rw-r--r--plugins/jetpack/vendor/automattic/jetpack-sync/src/class-utils.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-utils.php b/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-utils.php
new file mode 100644
index 00000000..23f24e95
--- /dev/null
+++ b/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-utils.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Sync utils.
+ *
+ * @package automattic/jetpack-sync
+ */
+
+namespace Automattic\Jetpack\Sync;
+
+/**
+ * Class for sync utilities.
+ */
+class Utils {
+ /**
+ * Retrieve the values of sync items.
+ *
+ * @access public
+ * @static
+ *
+ * @param array $items Array of sync items.
+ * @return array Array of sync item values.
+ */
+ public static function get_item_values( $items ) {
+ return array_map( array( __CLASS__, 'get_item_value' ), $items );
+ }
+
+ /**
+ * Retrieve the IDs of sync items.
+ *
+ * @access public
+ * @static
+ *
+ * @param array $items Array of sync items.
+ * @return array Array of sync item IDs.
+ */
+ public static function get_item_ids( $items ) {
+ return array_map( array( __CLASS__, 'get_item_id' ), $items );
+ }
+
+ /**
+ * Get the value of a sync item.
+ *
+ * @access private
+ * @static
+ *
+ * @param array $item Sync item.
+ * @return mixed Sync item value.
+ */
+ private static function get_item_value( $item ) {
+ return $item->value;
+ }
+
+ /**
+ * Get the ID of a sync item.
+ *
+ * @access private
+ * @static
+ *
+ * @param array $item Sync item.
+ * @return int Sync item ID.
+ */
+ private static function get_item_id( $item ) {
+ return $item->id;
+ }
+}