public function setupCredentials(array $credentials)
    {
        if (!array_key_exists('key', $credentials)) {
            throw new InvalidApplicationKeyException();
        }
        if (!array_key_exists('secret', $credentials)) {
            throw new InvalidApplicationSecretKeyException();
        }
        if (isset($credentials['redirect_uri'])) {
            $this->currentUri->setPath($credentials['redirect_uri']);
        }
        $this->credentials = new Credentials(
            $credentials['key'],
            $credentials['secret'],
            $this->getCurrentUri()
        );
    }