public function sign_request($signature_method, $consumer, $token)
{
$empty = false;
$msg = array();
if ($token->key == null) {
$msg[] = 'Token key';
}
if ($token->secret == null) {
$msg[] = 'Token secret';
}
if ($consumer->key == null) {
$msg[] = 'Consumer key';
}
if ($consumer->secret == null) {
$msg[] = 'Consumer secret';
}
if ($this->http_url == null) {
$msg[] = 'Endpoint';
}
if ($this->http_method == null) {
$msg[] = 'HTTP method';
}
if (count($msg)) {
throw new OAuthException('Enter valid ' . implode(',', $msg));
}
$this->set_parameter("oauth_signature_method", $signature_method->get_name(), false);
$signature = $this->build_signature($signature_method, $consumer, $token);
$this->set_parameter("oauth_signature", $signature, false);
}