PHP5 refactoring