Created
January 5, 2019 03:32
-
-
Save joaorobertopb/ec540a0f2ff98a6c3bdd9015c8813caf to your computer and use it in GitHub Desktop.
Exemplo de código PHP que usa o princípio de segregação das interfaces do SOLID.
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 Aves | |
{ | |
public function setLocalizacao($longitude, $latitude); | |
public function renderizar(); | |
} | |
interface AvesQueVoam extends Aves | |
{ | |
public function setAltitude($altitude); | |
} | |
class Papagaio implements AvesQueVoam | |
{ | |
public function setLocalizacao($longitude, $latitude) | |
{ | |
//Faz alguma coisa | |
} | |
public function setAltitude($altitude) | |
{ | |
//Faz alguma coisa | |
} | |
public function renderizar() | |
{ | |
//Faz alguma coisa | |
} | |
} | |
class Pinguim implements Aves | |
{ | |
public function setLocalizacao($longitude, $latitude) | |
{ | |
//Faz alguma coisa | |
} | |
public function renderizar() | |
{ | |
//Faz alguma coisa | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment