[php5.4 upgrade] Move logic to traits