Skip to content

Instantly share code, notes, and snippets.

@HavenShen
Created May 17, 2018 08:30
Show Gist options
  • Save HavenShen/f562f2d1c2e8f4f06978227d0c027772 to your computer and use it in GitHub Desktop.
Save HavenShen/f562f2d1c2e8f4f06978227d0c027772 to your computer and use it in GitHub Desktop.
Interface Segregation Principle (ISP)
<?php
$bird = new Parrot();
$bird->fly();
interface BirdInterface
{
public function fly();
}
class Parrot implements BirdInterface
{
public function fly()
{
// ...fly away, Peter!
}
}
class Penguin implements BirdInterface
{
// ...don't fly
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment