[ticket/12789] Move duplicated functions to the base class

PHPBB3-12789