/**
  * (non-PHPdoc)
  * @see \Socialite\Component\OAuth\SignatureMethod\OAuthSignatureMethod::build()
  */
 public function build(OAuthRequest $request, OAuthConsumer $consumer, OAuthToken $token = null)
 {
     $parts = array(OAuth::urlencode($consumer->getSecret()));
     $parts[] = $token instanceof OAuthToken ? OAuth::urlencode($token->getSecret()) : '';
     $base = $request->getBaseSignature();
     $key = join('&', $parts);
     if (function_exists('hash_hmac')) {
         $hmac = hash_hmac('sha1', $base, $key, true);
     } else {
         $blocksize = 64;
         $hashfunc = 'sha1';
         if (strlen($key) > $blocksize) {
             $key = pack('H*', $hashfunc($key));
         }
         $key = str_pad($key, $blocksize, chr(0x0));
         $ipad = str_repeat(chr(0x36), $blocksize);
         $opad = str_repeat(chr(0x5c), $blocksize);
         $hmac = pack('H*', $hashfunc(($key ^ $opad) . pack('H*', $hashfunc(($key ^ $ipad) . $base_string))));
     }
     return base64_encode($hmac);
 }
 /**
  * (non-PHPdoc)
  * @see \Socialite\Component\OAuth\SignatureMethod\OAuthSignatureMethod::build()
  */
 public function build(OAuthRequest $request, OAuthConsumer $consumer, OAuthToken $token = null)
 {
     $parts = array(OAuth::urlencode($consumer->getSecret()));
     $parts[] = $token instanceof OAuthToken ? OAuth::urlencode($token->getSecret()) : '';
     return join('&', $parts);
 }