[ticket/12575] Do not duplicate logic in service_collection_iterator.

PHPBB3-12575