Created
August 1, 2016 23:48
-
-
Save altayalp/7927215fd33697af4a07473943ef1f38 to your computer and use it in GitHub Desktop.
ISP (Interface Segregation Principle) good practice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface MachineInterface | |
{ | |
public function open(); | |
public function heatWater(); | |
} | |
interface CoffeeMachineInterface extends MachineInterface | |
{ | |
public function makeCoffee(); | |
} | |
interface TeaMachineInterface extends MachineInterface | |
{ | |
public function makeTea(); | |
} | |
class CoffeeMachine implements CoffeeMachineInterface | |
{ | |
public function open() | |
{ | |
return 'Machine is opening'; | |
} | |
public function heatWater() | |
{ | |
return 'Water is heating'; | |
} | |
public function makeCoffee() | |
{ | |
return 'Coffee is making'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment