Created
May 14, 2013 19:50
-
-
Save toin0u/5578940 to your computer and use it in GitHub Desktop.
This file contains 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 ProviderInterface | |
{ | |
public function foo(); | |
} | |
abstract class AbstractProvider implements ProviderInterface | |
{ | |
public function bar() | |
{ | |
return "bar\n"; | |
} | |
// foo() is not implemented here | |
} | |
class MyProvider extends AbstractProvider | |
{ | |
public function foo() | |
{ | |
return "foo\n"; | |
} | |
} | |
$provider = new MyProvider; | |
echo $provider->foo(); // foo | |
echo $provider->bar(); // bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I totaly agree :)
This implementation gives flexibility :)
Thanks for this explanation.