Skip to content

Instantly share code, notes, and snippets.

@anvodev
Created June 4, 2020 02:29
Show Gist options
  • Save anvodev/35658ea5b5f7e90b8ff99724427ba3ee to your computer and use it in GitHub Desktop.
Save anvodev/35658ea5b5f7e90b8ff99724427ba3ee to your computer and use it in GitHub Desktop.
<?php
//coffee_shop_rainy_day_context.php
//to load Class & Interface file when we need them
spl_autoload_register(function ($class_name) {
include $class_name . '.php';
});
//at the coffee shop in a rainy day
$egg = new Egg();
$coffee = new EggCoffee($egg);
$sweeterCoffee = new SweeterCoffee($coffee);
$consumer = new AtCoffeeShopConsumer($sweeterCoffee);
$consumer->readyToWork();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment