[ticket/11924] Remove duplicated code

PHPBB3-11924