Created
July 24, 2014 16:02
-
-
Save blar/1ef0fc4bd9f790f9574c to your computer and use it in GitHub Desktop.
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 | |
| class Request { | |
| public function send() { | |
| } | |
| } | |
| // A | |
| $request = new Request(); | |
| $request->on('beforeSend', function($request) { | |
| $signature = new AmazonSignature(); | |
| $signature->sign($request); | |
| }); | |
| // B | |
| class AmazonRequest { | |
| public function sign() { | |
| $signature = new AmazonSignature(); | |
| $signature->sign($this); | |
| } | |
| public function send() { | |
| $this->sign(); | |
| return parent::send(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment