1 | <?php |
||
16 | class Term_Relationships extends Module { |
||
17 | |||
18 | /** |
||
19 | * Max terms to return in one single query |
||
20 | * |
||
21 | * @access public |
||
22 | * |
||
23 | * @const int |
||
24 | */ |
||
25 | const QUERY_LIMIT = 1000; |
||
26 | |||
27 | /** |
||
28 | * Max value for a signed INT in MySQL - https://dev.mysql.com/doc/refman/8.0/en/integer-types.html |
||
29 | * |
||
30 | * @access public |
||
31 | * |
||
32 | * @const int |
||
33 | */ |
||
34 | const MAX_INT = 2147483647; |
||
35 | |||
36 | /** |
||
37 | * Sync module name. |
||
38 | * |
||
39 | * @access public |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | public function name() { |
||
46 | |||
47 | /** |
||
48 | * The id field in the database. |
||
49 | * |
||
50 | * @access public |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | public function id_field() { |
||
57 | |||
58 | /** |
||
59 | * The table in the database. |
||
60 | * |
||
61 | * @access public |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | public function table_name() { |
||
68 | |||
69 | /** |
||
70 | * Initialize term relationships action listeners for full sync. |
||
71 | * |
||
72 | * @access public |
||
73 | * |
||
74 | * @param callable $callable Action handler callable. |
||
75 | */ |
||
76 | public function init_full_sync_listeners( $callable ) { |
||
79 | |||
80 | /** |
||
81 | * Initialize the module in the sender. |
||
82 | * |
||
83 | * @access public |
||
84 | */ |
||
85 | public function init_before_send() { |
||
89 | |||
90 | /** |
||
91 | * Enqueue the term relationships actions for full sync. |
||
92 | * |
||
93 | * @access public |
||
94 | * |
||
95 | * @param array $config Full sync configuration for this sync module. |
||
96 | * @param int $max_items_to_enqueue Maximum number of items to enqueue. |
||
97 | * @param object $last_object_enqueued Last object enqueued. |
||
98 | * |
||
99 | * @return array Number of actions enqueued, and next module state. |
||
100 | * @todo This method has similarities with Automattic\Jetpack\Sync\Modules\Module::enqueue_all_ids_as_action. Refactor to keep DRY. |
||
101 | * @see Automattic\Jetpack\Sync\Modules\Module::enqueue_all_ids_as_action |
||
102 | */ |
||
103 | public function enqueue_full_sync_actions( $config, $max_items_to_enqueue, $last_object_enqueued ) { |
||
140 | |||
141 | /** |
||
142 | * Return the initial last sent object. |
||
143 | * |
||
144 | * @return string|array initial status. |
||
145 | */ |
||
146 | public function get_initial_last_sent() { |
||
152 | |||
153 | /** |
||
154 | * Given the Module Full Sync Configuration and Status return the next chunk of items to send. |
||
155 | * |
||
156 | * @param array $config This module Full Sync configuration. |
||
157 | * @param array $status This module Full Sync status. |
||
158 | * @param int $chunk_size Chunk size. |
||
159 | * |
||
160 | * @return array|object|null |
||
161 | */ |
||
162 | public function get_next_chunk( $config, $status, $chunk_size ) { |
||
180 | |||
181 | /** |
||
182 | * |
||
183 | * Enqueue all $items within `jetpack_full_sync_term_relationships` actions. |
||
184 | * |
||
185 | * @param array $items Groups of objects to sync. |
||
186 | * @param array $previous_interval_end Last item enqueued. |
||
187 | * |
||
188 | * @return array Last enqueued object. |
||
189 | */ |
||
190 | public function bulk_enqueue_full_sync_term_relationships( $items, $previous_interval_end ) { |
||
197 | |||
198 | /** |
||
199 | * Retrieve an estimated number of actions that will be enqueued. |
||
200 | * |
||
201 | * @access public |
||
202 | * |
||
203 | * @param array $config Full sync configuration for this sync module. |
||
204 | * @return int Number of items yet to be enqueued. |
||
205 | */ |
||
206 | public function estimate_full_sync_actions( $config ) { |
||
216 | |||
217 | /** |
||
218 | * Retrieve the actions that will be sent for this module during a full sync. |
||
219 | * |
||
220 | * @access public |
||
221 | * |
||
222 | * @return array Full sync actions of this module. |
||
223 | */ |
||
224 | public function get_full_sync_actions() { |
||
227 | |||
228 | /** |
||
229 | * Expand the term relationships within a hook before they are serialized and sent to the server. |
||
230 | * |
||
231 | * @access public |
||
232 | * |
||
233 | * @param array $args The hook parameters. |
||
234 | * @return array $args The expanded hook parameters. |
||
235 | */ |
||
236 | public function expand_term_relationships( $args ) { |
||
244 | } |
||
245 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.