Burger could be either a Veg Burger or Chicken Burger and will be packed by a wrapper. See the section titled What can PHP do for more information. It’s especially useful when you need to create an object with lots of possible configuration options. The Builder Pattern decouples the creation of the object from the object itself. A class delegates object creation to a Builder object instead of creating the objects directly. Cold drink could be either a coke or pepsi and will be packed in a bottle. Cute & Sweet – 3 Color – HTML & PHP Shopping Cart. Identification: The Builder pattern can be recognized in a class, which has a single creation method and several methods to configure the resulting object. Alternative Classes with Different Interfaces, Change Unidirectional Association to Bidirectional, Change Bidirectional Association to Unidirectional, Replace Magic Number with Symbolic Constant, Consolidate Duplicate Conditional Fragments, Replace Nested Conditional with Guard Clauses, Sequence Diagrams for Scenarios of Business Use Cases, The User View or "I don’t care how it works, as long as it works. The builder knows how to assemble the object given specification. Matching a backslash character can be confusing, because double escaping is needed in the pattern: first for PHP, second for the regex engine