File tree Expand file tree Collapse file tree
classes/suggested-tasks/providers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,23 +206,6 @@ protected function is_specific_task_completed( $task_id ) {
206206 return $ term ? self ::MIN_POSTS < $ term ->count : true ;
207207 }
208208
209- /**
210- * Transform data collector data into task data format.
211- *
212- * @param array $data The data from data collector.
213- * @return array The transformed data with original data merged.
214- */
215- protected function transform_collector_data ( array $ data ): array {
216- return \array_merge (
217- $ data ,
218- [
219- 'target_term_id ' => $ data ['term_id ' ],
220- 'target_taxonomy ' => $ data ['taxonomy ' ],
221- 'target_term_name ' => $ data ['name ' ],
222- ]
223- );
224- }
225-
226209 /**
227210 * Get an array of tasks to inject.
228211 *
Original file line number Diff line number Diff line change @@ -540,4 +540,28 @@ public function get_task_details( $task_data = [] ) {
540540 'snoozable ' => $ this ->is_snoozable (),
541541 ];
542542 }
543+
544+ /**
545+ * Transform data collector data into task data format.
546+ *
547+ * @param array $data The data from data collector.
548+ * @return array The transformed data with original data merged.
549+ */
550+ protected function transform_collector_data ( array $ data ): array {
551+ $ transform_keys = [
552+ 'term_id ' => 'target_term_id ' ,
553+ 'taxonomy ' => 'target_taxonomy ' ,
554+ 'name ' => 'target_term_name ' ,
555+ 'post_id ' => 'target_post_id ' ,
556+ 'post_title ' => 'target_post_title ' ,
557+ ];
558+
559+ foreach ( $ transform_keys as $ key => $ value ) {
560+ if ( isset ( $ data [ $ key ] ) ) {
561+ $ data [ $ value ] = $ data [ $ key ];
562+ }
563+ }
564+
565+ return $ data ;
566+ }
543567}
Original file line number Diff line number Diff line change @@ -189,23 +189,6 @@ protected function is_specific_task_completed( $task_id ) {
189189 return '' !== $ term_description && ' ' !== $ term_description ;
190190 }
191191
192- /**
193- * Transform data collector data into task data format.
194- *
195- * @param array $data The data from data collector.
196- * @return array The transformed data with original data merged.
197- */
198- protected function transform_collector_data ( array $ data ): array {
199- return \array_merge (
200- $ data ,
201- [
202- 'target_term_id ' => $ data ['term_id ' ],
203- 'target_taxonomy ' => $ data ['taxonomy ' ],
204- 'target_term_name ' => $ data ['name ' ],
205- ]
206- );
207- }
208-
209192 /**
210193 * Get an array of tasks to inject.
211194 *
Original file line number Diff line number Diff line change @@ -147,22 +147,6 @@ protected function is_specific_task_completed( $task_id ) {
147147 return 0 !== (int ) $ linked_count ;
148148 }
149149
150- /**
151- * Transform data collector data into task data format.
152- *
153- * @param array $data The data from data collector.
154- * @return array The transformed data with original data merged.
155- */
156- protected function transform_collector_data ( array $ data ): array {
157- return \array_merge (
158- $ data ,
159- [
160- 'target_post_id ' => $ data ['post_id ' ],
161- 'target_post_title ' => $ data ['post_title ' ],
162- ]
163- );
164- }
165-
166150 /**
167151 * Get an array of tasks to inject.
168152 *
You can’t perform that action at this time.
0 commit comments