Encapsulate varying behavior for the same routine based on an object's state. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements.
You can also find these code on GitHub
OrderController.php
OrderController.php
OrderFactory.php
OrderFactory.php
OrderInterface.php
OrderInterface.php
ShippingOrder.php
ShippingOrder.php
CreateOrder.php
CreateOrder.php