Skip to content

Instantly share code, notes, and snippets.

@samadfcibd
Last active July 3, 2020 11:56
Show Gist options
  • Save samadfcibd/a090a2cc28e9f9918212e9bb9127387d to your computer and use it in GitHub Desktop.
Save samadfcibd/a090a2cc28e9f9918212e9bb9127387d to your computer and use it in GitHub Desktop.
<?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