Skip to content

Instantly share code, notes, and snippets.

@syofyanzuhad
Forked from nahidulhasan/Coffee.php
Created September 27, 2021 15:34
Show Gist options
  • Save syofyanzuhad/2aa30780e499460ff61cbfa07928312f to your computer and use it in GitHub Desktop.
Save syofyanzuhad/2aa30780e499460ff61cbfa07928312f to your computer and use it in GitHub Desktop.
<?php
class Coffee
{
public function addCoffee()
{
var_dump('Add proper amount of coffee');
return $this;
}
protected function addHotWater()
{
var_dump('Pour Hot water into cup');
return $this;
}
protected function addSugar()
{
var_dump('Add proper amount of sugar');
return $this;
}
protected function addMilk()
{
var_dump('Add proper amount of Milk');
return $this;
}
public function make()
{
return $this
->addHotWater()
->addSugar()
->addCoffee()
->addMilk();
}
}
$tea = new Coffee();
$tea->make();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment