Martin Fowler refactoring example written in PHP