refactor php text_files