refactor php