additional_contactmethods_collector = $additional_contactmethods_collector; $this->custom_meta_collector = $custom_meta_collector; $this->cleanup_repository = $cleanup_repository; } /** * Deletes selected empty usermeta. * * @param int $limit The limit we'll apply to the cleanups. * * @return int|bool The number of rows that was deleted or false if the query failed. */ public function cleanup_selected_empty_usermeta( int $limit ) { $meta_to_check = $this->get_meta_to_check(); return $this->cleanup_repository->delete_empty_usermeta_query( $meta_to_check, $limit ); } /** * Gets which meta are going to be checked for emptiness. * * @return array The meta to be checked for emptiness. */ private function get_meta_to_check() { $additional_contactmethods = $this->additional_contactmethods_collector->get_additional_contactmethods_keys(); $custom_meta = $this->custom_meta_collector->get_non_empty_custom_meta(); return \array_merge( $additional_contactmethods, $custom_meta ); } }