public function getSignature()
    {
        if ($this->hasFileParameters()) {
            $elements = $this->getOAuthParameters();
        } else {
            $elements = array_merge(
                $this->getOAuthParameters(),
                $this->getGetParameters(),
                $this->getPostParameters()
            );
        }

        ksort($elements);

        $stringSignature = array();
        foreach ($elements as $key => $value) {
            $stringSignature[] = sprintf('%s=%s', $key, $value);
        }

        $signature = array(
            $this->getMethod(),
            rawurlencode($this->getSignatureUrl()),
            rawurlencode(implode('&', $stringSignature)),
        );

        return implode('&', $signature);
    }