php refactoring, setting up configuration logic