refactoring in php files