PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | jetpack_vendor/automattic/jetpack-sync/src/class-queue-buffer.php +78 -0 16.2-beta → 16.3 View file →
@@ -1,0 +1,78 @@
1 +<?php
2 +/**
3 + * Sync queue buffer.
4 + *
5 + * @package automattic/jetpack-sync
6 + */
7 +
8 +namespace Automattic\Jetpack\Sync;
9 +
10 +/**
11 + * A buffer of items from the queue that can be checked out.
12 + */
13 +class Queue_Buffer {
14 + /**
15 + * Sync queue buffer ID.
16 + *
17 + * @access public
18 + *
19 + * @var int
20 + */
21 + public $id;
22 +
23 + /**
24 + * Sync items.
25 + *
26 + * @access public
27 + *
28 + * @var array
29 + */
30 + public $items_with_ids;
31 +
32 + /**
33 + * Constructor.
34 + * Initializes the queue buffer.
35 + *
36 + * @access public
37 + *
38 + * @param int $id Sync queue buffer ID.
39 + * @param array $items_with_ids Items for the buffer to work with.
40 + */
41 + public function __construct( $id, $items_with_ids ) {
42 + $this->id = $id;
43 + $this->items_with_ids = $items_with_ids;
44 + }
45 +
46 + /**
47 + * Retrieve the sync items in the buffer, in an ID => value form.
48 + *
49 + * @access public
50 + *
51 + * @return bool|array Sync items in the buffer.
52 + */
53 + public function get_items() {
54 + return array_combine( $this->get_item_ids(), $this->get_item_values() );
55 + }
56 +
57 + /**
58 + * Retrieve the values of the sync items in the buffer.
59 + *
60 + * @access public
61 + *
62 + * @return array Sync items values.
63 + */
64 + public function get_item_values() {
65 + return Utils::get_item_values( $this->items_with_ids );
66 + }
67 +
68 + /**
69 + * Retrieve the IDs of the sync items in the buffer.
70 + *
71 + * @access public
72 + *
73 + * @return array Sync items IDs.
74 + */
75 + public function get_item_ids() {
76 + return Utils::get_item_ids( $this->items_with_ids );
77 + }
78 +}