@@ -46,9 +46,9 @@ class Fix_Orphaned_Content extends Yoast_Provider {
4646 /**
4747 * The completed post IDs.
4848 *
49- * @var array|null
49+ * @var array
5050 */
51- protected $ completed_post_ids = null ;
51+ protected $ completed_post_ids = [] ;
5252
5353 /**
5454 * The data collector class name.
@@ -158,11 +158,7 @@ public function get_tasks_to_inject() {
158158 }
159159
160160 $ data = $ this ->transform_collector_data ( $ this ->get_data_collector ()->collect () );
161- $ task_id = $ this ->get_task_id (
162- [
163- 'target_post_id ' => $ data ['target_post_id ' ],
164- ]
165- );
161+ $ task_id = $ this ->get_task_id ( [ 'target_post_id ' => $ data ['target_post_id ' ] ] );
166162
167163 // When we have data, check if task was completed.
168164 if ( true === \progress_planner ()->get_suggested_tasks ()->was_task_completed ( $ task_id ) ) {
@@ -207,9 +203,7 @@ public function get_post_from_task_id( $task_id ) {
207203 return null ;
208204 }
209205
210- $ task = $ tasks [0 ];
211-
212- return $ task ->target_post_id ? \get_post ( $ task ->target_post_id ) : null ;
206+ return $ tasks [0 ]->target_post_id ? \get_post ( $ tasks [0 ]->target_post_id ) : null ;
213207 }
214208
215209 /**
@@ -218,18 +212,15 @@ public function get_post_from_task_id( $task_id ) {
218212 * @return array
219213 */
220214 protected function get_completed_post_ids () {
221- if ( null !== $ this ->completed_post_ids ) {
215+ if ( ! empty ( $ this ->completed_post_ids ) ) {
222216 return $ this ->completed_post_ids ;
223217 }
224218
225- $ this ->completed_post_ids = [];
226- $ tasks = \progress_planner ()->get_suggested_tasks_db ()->get_tasks_by ( [ 'provider_id ' => $ this ->get_provider_id () ] );
219+ $ tasks = \progress_planner ()->get_suggested_tasks_db ()->get_tasks_by ( [ 'provider_id ' => $ this ->get_provider_id () ] );
227220
228- if ( ! empty ( $ tasks ) ) {
229- foreach ( $ tasks as $ task ) {
230- if ( 'trash ' === $ task ->post_status ) {
231- $ this ->completed_post_ids [] = $ task ->target_post_id ;
232- }
221+ foreach ( $ tasks as $ task ) {
222+ if ( 'trash ' === $ task ->post_status ) {
223+ $ this ->completed_post_ids [] = $ task ->target_post_id ;
233224 }
234225 }
235226
0 commit comments