Last active
July 3, 2020 11:56
-
-
Save samadfcibd/a090a2cc28e9f9918212e9bb9127387d to your computer and use it in GitHub Desktop.
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 PrinterInterface | |
{ | |
public function print(); | |
public function photocopy(); | |
public function scan(); | |
} | |
class DigitalPrinter implements PrinterInterface | |
{ | |
public function print() | |
{ | |
return 'Print'; | |
} | |
public function photocopy() | |
{ | |
return 'Photocopy'; | |
} | |
public function scan() | |
{ | |
return 'Scan'; | |
} | |
} | |
class ModernPrinter implements PrinterInterface | |
{ | |
public function print() | |
{ | |
return 'Print'; | |
} | |
public function photocopy() | |
{ | |
return 'Photocopy'; | |
} | |
// ISP Violates here | |
public function scan() | |
{ | |
return 'Not supported'; | |
} | |
} | |
class OldPrinter implements PrinterInterface | |
{ | |
public function print() | |
{ | |
return 'print'; | |
} | |
// ISP Violates here | |
public function photocopy() | |
{ | |
return 'Not supported'; | |
} | |
// ISP Violates here | |
public function scan() | |
{ | |
return 'Not supported'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment