Skip to content

Instantly share code, notes, and snippets.

@samadfcibd
Created July 2, 2020 20:38
Show Gist options
  • Save samadfcibd/c225a84609e2acc8e124e965fb70320c to your computer and use it in GitHub Desktop.
Save samadfcibd/c225a84609e2acc8e124e965fb70320c to your computer and use it in GitHub Desktop.
<?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