Created
September 19, 2015 12:49
-
-
Save E1101/e33d828b78659983c837 to your computer and use it in GitHub Desktop.
php inheritance interface type declarations
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 iInvokable { | |
function __invoke($arg = null); | |
} | |
interface iResponder extends iInvokable { | |
/** Bind next responder */ | |
function then(iInvokable $responder); | |
} | |
class Responder implements \iResponder { | |
function __invoke($arg = null) | |
{ | |
// TODO: Implement __invoke() method. | |
} | |
/** Bind next responder */ | |
function then(iInvokable $responder) | |
{ | |
// TODO: Implement then() method. | |
} | |
} | |
class OtherResponder implements \iResponder { | |
function __invoke($arg = null) | |
{ | |
// TODO: Implement __invoke() method. | |
} | |
/** Bind next responder */ | |
function then(iInvokable $responder) | |
{ | |
// TODO: Implement then() method. | |
} | |
} | |
class Invokable implements \iInvokable { | |
function __invoke($arg = null) | |
{ | |
// TODO: Implement __invoke() method. | |
} | |
} | |
$responder = new Responder(); | |
$responder->then(new OtherResponder()); | |
$responder->then(new Invokable()); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment