src/MessageValidator.php
public function getStringToSign(Message $message)
    {
        static $signableKeys = [
            'Message',
            'MessageId',
            'Subject',
            'SubscribeURL',
            'Timestamp',
            'Token',
            'TopicArn',
            'Type',
        ];

        if ($message['SignatureVersion'] !== self::SIGNATURE_VERSION_1) {
            throw new InvalidSnsMessageException(
                "The SignatureVersion \"{$message['SignatureVersion']}\" is not supported."
            );
        }

        $stringToSign = '';
        foreach ($signableKeys as $key) {
            if (isset($message[$key])) {
                $stringToSign .= "{$key}\n{$message[$key]}\n";
            }
        }

        return $stringToSign;
    }
public function getStringToSign(Message $message)
    {
        static $signableKeys = [
            'Message',
            'MessageId',
            'Subject',
            'SubscribeURL',
            'Timestamp',
            'Token',
            'TopicArn',
            'Type',
        ];

        if ($message['SignatureVersion'] !== self::SIGNATURE_VERSION_1) {
            throw new InvalidSnsMessageException(
                "The SignatureVersion \"{$message['SignatureVersion']}\" is not supported."
            );
        }

        $stringToSign = '';
        foreach ($signableKeys as $key) {
            if (isset($message[$key])) {
                $stringToSign .= "{$key}\n{$message[$key]}\n";
            }
        }

        return $stringToSign;
    }
public function getStringToSign ( Message $ message ) { static $ signableKeys = [ 'Message' , 'MessageId' , 'Subject' , 'SubscribeURL' , 'Timestamp' , 'Token' , 'TopicArn' , 'Type' , ] ; if ( $ message [ 'SignatureVersion' ] !== self :: SIGNATURE_VERSION_1 ) { throw new InvalidSnsMessageException ( "The SignatureVersion \"{$message['SignatureVersion']}\" is not supported." ) ; } $ stringToSign = '' ; foreach ( $ signableKeys as $ key ) { if ( isset ( $ message [ $ key ] ) ) { $ stringToSign .= "{$key}\n{$message[$key]}\n" ; } } return $ stringToSign ; }
Builds string-to-sign according to the SNS message spec.

@param Message $message Message for which to build the string-to-sign.

@return string
@link http://docs.aws.amazon.com/sns/latest/gsg/SendMessageToHttp.verify.signature.html
Builds string - to - sign according to the SNS message spec .