Created
July 2, 2020 20:38
-
-
Save samadfcibd/c225a84609e2acc8e124e965fb70320c to your computer and use it in GitHub Desktop.
This file contains 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 PrinterInterface | |
{ | |
public function print(); | |
} | |
interface PhotocopyInterface | |
{ | |
public function photocopy(); | |
} | |
interface ScannerInterface | |
{ | |
public function scan(); | |
} | |
// ISP refactors here | |
class DigitalPrinter implements PrinterInterface, PhotocopyInterface, ScannerInterface | |
{ | |
public function print() | |
{ | |
return 'Print'; | |
} | |
public function photocopy() | |
{ | |
return 'Photocopy'; | |
} | |
public function scan() | |
{ | |
return 'Scan'; | |
} | |
} | |
// ISP refactors here | |
class ModernPrinter implements PrinterInterface, PhotocopyInterface | |
{ | |
public function print() | |
{ | |
return 'Print'; | |
} | |
public function photocopy() | |
{ | |
return 'Photocopy'; | |
} | |
} | |
// ISP refactors here | |
class OldPrinter implements PrinterInterface | |
{ | |
public function print() | |
{ | |
return 'print'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment