Skip to content

Instantly share code, notes, and snippets.

@blar
Created July 24, 2014 16:02
Show Gist options
  • Select an option

  • Save blar/1ef0fc4bd9f790f9574c to your computer and use it in GitHub Desktop.

Select an option

Save blar/1ef0fc4bd9f790f9574c to your computer and use it in GitHub Desktop.
<?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