Refactor with PHP