weather php refactoring