Refactoring php structure