[ticket/12658] Refactoring code

PHPBB3-12658